summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordac <qt-info@nokia.com>2010-06-09 12:00:17 +1000
committerdac <qt-info@nokia.com>2010-06-09 12:00:17 +1000
commit7fd00ac1deddb755b47458f65f2900fc4772d616 (patch)
tree06ea504de072a814a44821817d76dae86b2672c9
Initial commit
-rw-r--r--LGPL_EXCEPTION.txt22
-rw-r--r--LICENSE.LGPL514
-rw-r--r--LICENSE.PREVIEW.COMMERCIAL629
-rw-r--r--README109
-rw-r--r--convert/README17
-rw-r--r--convert/convert.pl114
-rw-r--r--doc/html/assistant.dcf3
-rw-r--r--doc/html/classic.css279
-rw-r--r--doc/html/designer.dcf3
-rw-r--r--doc/html/images/qt-logo.pngbin0 -> 1422 bytes
-rw-r--r--doc/html/index.html124
-rw-r--r--doc/html/linguist.dcf3
-rw-r--r--doc/html/qmake.dcf3
-rw-r--r--doc/html/qsystemtest.html701
-rw-r--r--doc/html/qtuitest-activatewidget-members.html26
-rw-r--r--doc/html/qtuitest-activatewidget.html53
-rw-r--r--doc/html/qtuitest-checkitemwidget-members.html27
-rw-r--r--doc/html/qtuitest-checkitemwidget.html48
-rw-r--r--doc/html/qtuitest-checkwidget-members.html28
-rw-r--r--doc/html/qtuitest-checkwidget.html62
-rw-r--r--doc/html/qtuitest-indexedwidget-members.html25
-rw-r--r--doc/html/qtuitest-indexedwidget.html50
-rw-r--r--doc/html/qtuitest-inputwidget-members.html27
-rw-r--r--doc/html/qtuitest-inputwidget.html60
-rw-r--r--doc/html/qtuitest-labelwidget-members.html26
-rw-r--r--doc/html/qtuitest-labelwidget.html49
-rw-r--r--doc/html/qtuitest-listwidget-members.html27
-rw-r--r--doc/html/qtuitest-listwidget.html53
-rw-r--r--doc/html/qtuitest-manual.html290
-rw-r--r--doc/html/qtuitest-plugins.html219
-rw-r--r--doc/html/qtuitest-selectwidget-members.html30
-rw-r--r--doc/html/qtuitest-selectwidget.html71
-rw-r--r--doc/html/qtuitest-testwidget-members.html65
-rw-r--r--doc/html/qtuitest-testwidget.html111
-rw-r--r--doc/html/qtuitest-textwidget-members.html28
-rw-r--r--doc/html/qtuitest-textwidget.html58
-rw-r--r--doc/html/qtuitest-tutorial.html39
-rw-r--r--doc/html/qtuitest-tutorial1.html177
-rw-r--r--doc/html/qtuitest-tutorial2.html93
-rw-r--r--doc/html/qtuitest-tutorial3.html105
-rw-r--r--doc/html/qtuitest-tutorial4.html106
-rw-r--r--doc/html/qtuitest-widget-members.html58
-rw-r--r--doc/html/qtuitest-widget.html200
-rw-r--r--doc/html/qtuitest-widgetfactory-members.html27
-rw-r--r--doc/html/qtuitest-widgetfactory.html54
-rw-r--r--doc/html/qtuitest.dcf318
-rw-r--r--doc/html/qtuitest.html128
-rw-r--r--doc/html/qtuitest.index801
-rw-r--r--doc/html/qtuitestrecorder-members.html33
-rw-r--r--doc/html/qtuitestrecorder.html83
-rw-r--r--doc/src/classic.css279
-rwxr-xr-xdoc/src/gendoc.sh6
-rw-r--r--doc/src/images/qt-logo.pngbin0 -> 1422 bytes
-rw-r--r--doc/src/qtuitest.qdocconf55
-rw-r--r--doc/src/qtuitest_manual.qdoc372
-rw-r--r--doc/src/qtuitest_plugins.qdoc297
-rw-r--r--doc/src/qtuitest_tutorial.qdoc511
-rw-r--r--examples/cppsystemtest/README8
-rw-r--r--examples/cppsystemtest/cppsystemtest.pro22
-rw-r--r--examples/cppsystemtest/main.cpp25
-rw-r--r--examples/examples.pro2
-rw-r--r--features/systemtest.prf53
-rw-r--r--features/unittest.prf86
-rw-r--r--interpreter/DESCRIPTION1
-rw-r--r--interpreter/builtins.js530
-rw-r--r--interpreter/config.js72
-rw-r--r--interpreter/interpreter.pro53
-rw-r--r--interpreter/main.cpp66
-rw-r--r--interpreter/qscriptsystemtest.cpp747
-rw-r--r--interpreter/qscriptsystemtest.h106
-rw-r--r--interpreter/qtscript_bindings.cpp310
-rw-r--r--interpreter/qtscript_bindings.h72
-rw-r--r--interpreter/scriptpreprocessor.cpp256
-rw-r--r--interpreter/scriptpreprocessor.h58
-rw-r--r--interpreter/scripts.qrc6
-rw-r--r--libqsystemtest/DESCRIPTION1
-rw-r--r--libqsystemtest/failuredlg.ui95
-rw-r--r--libqsystemtest/gracefulquit.cpp192
-rw-r--r--libqsystemtest/gracefulquit.h53
-rw-r--r--libqsystemtest/libqsystemtest.pro67
-rw-r--r--libqsystemtest/manualverificationdlg.ui111
-rw-r--r--libqsystemtest/qabstracttest.cpp774
-rw-r--r--libqsystemtest/qabstracttest.h144
-rw-r--r--libqsystemtest/qsystemtest.cpp3310
-rw-r--r--libqsystemtest/qsystemtest.h457
-rw-r--r--libqsystemtest/qsystemtest_p.cpp764
-rw-r--r--libqsystemtest/qsystemtest_p.h189
-rw-r--r--libqsystemtest/qsystemtestmaster.cpp109
-rw-r--r--libqsystemtest/qsystemtestmaster_p.h110
-rw-r--r--libqsystemtest/qtestremote.cpp81
-rw-r--r--libqsystemtest/qtestremote_p.h69
-rw-r--r--libqsystemtest/qtestverifydlg.cpp174
-rw-r--r--libqsystemtest/qtestverifydlg_p.h73
-rw-r--r--libqsystemtest/recorddlg.ui108
-rw-r--r--libqtslave/DESCRIPTION1
-rw-r--r--libqtslave/libqtslave.pro45
-rw-r--r--libqtslave/qtestslave.cpp1771
-rw-r--r--libqtslave/qtestslave.h77
-rw-r--r--libqtslave/qtestslaveglobal.h55
-rw-r--r--libqtslave/qtestwidgets.cpp1008
-rw-r--r--libqtslave/qtestwidgets.h167
-rw-r--r--libqtuitest/DESCRIPTION1
-rw-r--r--libqtuitest/demowidgets_p.h100
-rw-r--r--libqtuitest/libqtuitest.pro83
-rw-r--r--libqtuitest/qalternatestack_p.h90
-rw-r--r--libqtuitest/qalternatestack_symbian.cpp92
-rw-r--r--libqtuitest/qalternatestack_unix.cpp529
-rw-r--r--libqtuitest/qalternatestack_win.cpp210
-rw-r--r--libqtuitest/qeventwatcher.cpp108
-rw-r--r--libqtuitest/qeventwatcher_p.h100
-rw-r--r--libqtuitest/qinputgenerator.cpp88
-rw-r--r--libqtuitest/qinputgenerator_mac.cpp479
-rw-r--r--libqtuitest/qinputgenerator_p.h89
-rw-r--r--libqtuitest/qinputgenerator_qws.cpp333
-rw-r--r--libqtuitest/qinputgenerator_symbian.cpp425
-rw-r--r--libqtuitest/qinputgenerator_win.cpp496
-rw-r--r--libqtuitest/qinputgenerator_x11.cpp514
-rw-r--r--libqtuitest/qtestprotocol.cpp1162
-rw-r--r--libqtuitest/qtestprotocol_p.h228
-rw-r--r--libqtuitest/qtuitestconnectionmanager.cpp165
-rw-r--r--libqtuitest/qtuitestconnectionmanager_p.h84
-rw-r--r--libqtuitest/qtuitestelapsedtimer.cpp103
-rw-r--r--libqtuitest/qtuitestelapsedtimer_p.h71
-rw-r--r--libqtuitest/qtuitestglobal.h80
-rw-r--r--libqtuitest/qtuitestnamespace.cpp1085
-rw-r--r--libqtuitest/qtuitestnamespace.h165
-rw-r--r--libqtuitest/qtuitestrecorder.cpp367
-rw-r--r--libqtuitest/qtuitestrecorder.h83
-rw-r--r--libqtuitest/qtuitestwidgetinterface.cpp1102
-rw-r--r--libqtuitest/qtuitestwidgetinterface.h263
-rw-r--r--libqtuitest/qtuitestwidgets.cpp658
-rw-r--r--libqtuitest/qtuitestwidgets_p.h122
-rw-r--r--libqtuitest/recordevent_p.h135
-rw-r--r--libqtuitest/testwidget.cpp298
-rw-r--r--libqtuitest/testwidget.h105
-rw-r--r--plugins/plugins.pro4
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/hbwidgets.pro59
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhbabstractbutton.cpp85
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhbabstractbutton.h76
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhbabstractitemview.cpp282
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhbabstractitemview.h188
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhbabstractviewitem.cpp71
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhbabstractviewitem.h77
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhbcombobox.cpp175
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhbcombobox.h98
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhbfactory.cpp123
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhbfactory.h64
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhbinputmethod.cpp71
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhbinputmethod.h72
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhblabel.cpp72
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhblabel.h78
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhblineedit.cpp91
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhblineedit.h77
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhbmainwindow.cpp69
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhbmainwindow.h69
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhbpushbutton.cpp66
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhbpushbutton.h73
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhbwidget.cpp121
-rw-r--r--plugins/qtuitest_widgets/hbwidgets/testhbwidget.h83
-rw-r--r--plugins/qtuitest_widgets/qgraphicsviewwidgets/qgraphicsviewwidgets.pro50
-rw-r--r--plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsitem.cpp132
-rw-r--r--plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsitem.h85
-rw-r--r--plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsproxywidget.cpp256
-rw-r--r--plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsproxywidget.h105
-rw-r--r--plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicstextitem.cpp66
-rw-r--r--plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicstextitem.h74
-rw-r--r--plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsview.cpp69
-rw-r--r--plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsview.h69
-rw-r--r--plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsviewfactory.cpp109
-rw-r--r--plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsviewfactory.h66
-rw-r--r--plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicswidget.cpp55
-rw-r--r--plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicswidget.h64
-rw-r--r--plugins/qtuitest_widgets/qmlwidgets/qmlwidgets.pro51
-rw-r--r--plugins/qtuitest_widgets/qmlwidgets/testdeclarativefactory.cpp107
-rw-r--r--plugins/qtuitest_widgets/qmlwidgets/testdeclarativefactory.h62
-rw-r--r--plugins/qtuitest_widgets/qmlwidgets/testdeclarativeitem.cpp299
-rw-r--r--plugins/qtuitest_widgets/qmlwidgets/testdeclarativeitem.h122
-rw-r--r--plugins/qtuitest_widgets/qmlwidgets/testdeclarativelistview.cpp188
-rw-r--r--plugins/qtuitest_widgets/qmlwidgets/testdeclarativelistview.h89
-rw-r--r--plugins/qtuitest_widgets/qmlwidgets/testdeclarativemousearea.cpp60
-rw-r--r--plugins/qtuitest_widgets/qmlwidgets/testdeclarativemousearea.h64
-rw-r--r--plugins/qtuitest_widgets/qmlwidgets/testdeclarativetext.cpp79
-rw-r--r--plugins/qtuitest_widgets/qmlwidgets/testdeclarativetext.h72
-rw-r--r--plugins/qtuitest_widgets/qmlwidgets/testdeclarativetextinput.cpp91
-rw-r--r--plugins/qtuitest_widgets/qmlwidgets/testdeclarativetextinput.h69
-rw-r--r--plugins/qtuitest_widgets/qmlwidgets/testdeclarativeview.cpp58
-rw-r--r--plugins/qtuitest_widgets/qmlwidgets/testdeclarativeview.h65
-rw-r--r--plugins/qtuitest_widgets/qmlwidgets/testdeclarativewebview.cpp209
-rw-r--r--plugins/qtuitest_widgets/qmlwidgets/testdeclarativewebview.h88
-rw-r--r--plugins/qtuitest_widgets/qtuitest_widgets.pro8
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/DESCRIPTION1
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/qtwidgets.pro103
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testabstractbutton.cpp195
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testabstractbutton.h91
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testabstractitemview.cpp475
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testabstractitemview.h185
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testabstractspinbox.cpp125
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testabstractspinbox.h68
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testcalendarwidget.cpp185
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testcalendarwidget.h77
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testcheckbox.cpp93
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testcheckbox.h69
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testcombobox.cpp252
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testcombobox.h94
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testdateedit.cpp78
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testdateedit.h71
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testdatetimeedit.cpp463
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testdatetimeedit.h84
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testdockwidget.cpp99
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testdockwidget.h75
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testfactory.cpp183
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testfactory.h65
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testgenericcheckwidget.cpp87
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testgenericcheckwidget.h68
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testgenericinputmethod.cpp74
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testgenericinputmethod.h72
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testgenerictextwidget.cpp105
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testgenerictextwidget.h71
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testgroupbox.cpp132
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testgroupbox.h84
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testheaderview.cpp84
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testheaderview.h74
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testignore.cpp59
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testignore.h64
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testlabel.cpp121
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testlabel.h78
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testlineedit.cpp146
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testlineedit.h76
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testlistview.cpp96
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testlistview.h69
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testmenu.cpp398
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testmenu.h108
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testmenubar.cpp391
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testmenubar.h107
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testpushbutton.cpp114
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testpushbutton.h78
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testtabbar.cpp231
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testtabbar.h93
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testtext.cpp116
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testtext.h139
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testtextedit.cpp298
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testtextedit.h106
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testtimeedit.cpp78
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testtimeedit.h72
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testtoolbar.cpp116
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testtoolbar.h93
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testtreeview.cpp193
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testtreeview.h76
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testtreewidget.cpp212
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testtreewidget.h78
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testwebview.cpp188
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testwebview.h94
-rw-r--r--plugins/qtuitest_widgets/qtwidgets/testwidgetslog.h85
-rw-r--r--plugins/styles/qtuitest/qtuitest.pro41
-rw-r--r--plugins/styles/qtuitest/style.cpp235
-rw-r--r--plugins/styles/qtuitest/style.h62
-rw-r--r--plugins/styles/styles.pro3
-rw-r--r--qtbindings/README13
-rw-r--r--qtbindings/com_nokia_qt_core/com_nokia_qt_core.pri136
-rw-r--r--qtbindings/com_nokia_qt_core/main.cpp357
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_Global.cpp42
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QAbstractItemModel.cpp740
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QAbstractListModel.cpp195
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QAbstractTableModel.cpp195
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QBasicTimer.cpp212
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QBitArray.cpp480
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QBuffer.cpp233
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QByteArray.cpp1248
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QByteArrayMatcher.cpp244
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QChildEvent.cpp217
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QCoreApplication.cpp655
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QCryptographicHash.cpp306
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QDataStream.cpp703
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QDir.cpp1285
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QDirIterator.cpp497
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QDynamicPropertyChangeEvent.cpp181
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QEvent.cpp631
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QEventLoop.cpp460
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QFile.cpp878
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QFileInfo.cpp648
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QFileSystemWatcher.cpp278
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QIODevice.cpp693
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QLibraryInfo.cpp305
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QLocale.cpp2251
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QMimeData.cpp415
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QModelIndex.cpp321
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QMutex.cpp292
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QObject.cpp425
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QPersistentModelIndex.cpp335
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QPoint.cpp318
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QPointF.cpp323
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QProcess.cpp931
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QRect.cpp839
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QRectF.cpp842
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QRunnable.cpp202
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QSemaphore.cpp234
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QSettings.cpp916
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QSignalMapper.cpp274
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QSize.cpp380
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QSizeF.cpp395
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QSocketNotifier.cpp314
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QStringMatcher.cpp282
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QSystemSemaphore.cpp425
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QTemporaryFile.cpp298
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QTextBoundaryFinder.cpp548
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QTextCodec.cpp575
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QTextCodecPlugin.cpp250
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QTextDecoder.cpp192
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QTextEncoder.cpp192
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QTextStream.cpp1208
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QThreadPool.cpp271
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QTime.cpp469
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QTimeLine.cpp541
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QTimer.cpp204
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QTimerEvent.cpp184
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QTranslator.cpp266
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QUrl.cpp1359
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QUuid.cpp466
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QWaitCondition.cpp224
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QXmlStreamAttribute.cpp280
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QXmlStreamAttributes.cpp568
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QXmlStreamEntityDeclaration.cpp257
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QXmlStreamEntityResolver.cpp194
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QXmlStreamNamespaceDeclaration.cpp221
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QXmlStreamNotationDeclaration.cpp229
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QXmlStreamReader.cpp942
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_QXmlStreamWriter.cpp524
-rw-r--r--qtbindings/com_nokia_qt_core/qtscript_Qt.cpp7259
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractItemModel.cpp568
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractItemModel.h93
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractListModel.cpp528
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractListModel.h90
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractTableModel.cpp542
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractTableModel.h91
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QBuffer.cpp339
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QBuffer.h82
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QChildEvent.cpp56
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QChildEvent.h60
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QCoreApplication.cpp149
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QCoreApplication.h66
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QDataStream.cpp67
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QDataStream.h63
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QDirIterator.cpp68
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QDirIterator.h63
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QEvent.cpp55
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QEvent.h60
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QEventLoop.cpp133
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QEventLoop.h65
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QFile.cpp357
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QFile.h85
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QFileSystemWatcher.cpp138
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QFileSystemWatcher.h66
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QIODevice.cpp339
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QIODevice.h82
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QMimeData.cpp180
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QMimeData.h68
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QObject.cpp134
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QObject.h65
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QProcess.cpp348
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QProcess.h82
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QRunnable.cpp66
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QRunnable.h61
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QSettings.cpp149
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QSettings.h69
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QSignalMapper.cpp134
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QSignalMapper.h65
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QSocketNotifier.cpp134
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QSocketNotifier.h65
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QTemporaryFile.cpp358
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QTemporaryFile.h85
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QTextCodec.cpp128
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QTextCodec.h65
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QTextCodecPlugin.cpp199
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QTextCodecPlugin.h70
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QTextStream.cpp66
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QTextStream.h64
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QThreadPool.cpp135
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QThreadPool.h65
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QTimeLine.cpp148
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QTimeLine.h66
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QTimer.cpp134
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QTimer.h65
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QTimerEvent.cpp55
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QTimerEvent.h60
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QTranslator.cpp162
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QTranslator.h67
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QUuid.cpp63
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QUuid.h63
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QXmlStreamAttributes.cpp58
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QXmlStreamAttributes.h60
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QXmlStreamEntityResolver.cpp84
-rw-r--r--qtbindings/com_nokia_qt_core/qtscriptshell_QXmlStreamEntityResolver.h62
-rw-r--r--qtbindings/qtbindings.pro2
-rw-r--r--qtbindings/qtbindingsbase.pri8
-rw-r--r--qtbindings/qtscript_core/qtscript_core.pro8
-rw-r--r--qtuitest-orbit.pro37
-rw-r--r--qtuitest-qml.pro37
-rw-r--r--qtuitest.pro37
-rw-r--r--qtuitest_config.h8
-rw-r--r--scripts/qtestxml2junitxml.xsl82
-rwxr-xr-xscripts/storetest75
-rwxr-xr-xscripts/storetestresultsbin0 -> 121612 bytes
-rw-r--r--symbian/qtuitest.pro20
-rw-r--r--symbian/scripts/startProcess.bat44
-rw-r--r--symbian/scripts/stopProcess.bat37
-rw-r--r--tests/qtuitest/qtuitest.pro33
-rw-r--r--tests/qtuitest/sys_assistant/sys_assistant.js231
-rw-r--r--tests/qtuitest/sys_assistant/sys_assistant.pro2
-rw-r--r--tests/qtuitest/sys_designer/sys_designer.js419
-rw-r--r--tests/qtuitest/sys_designer/sys_designer.pro2
-rw-r--r--tests/qtuitest/sys_graphicsView/sys_graphicsView.js55
-rw-r--r--tests/qtuitest/sys_graphicsView/sys_graphicsView.pro3
-rw-r--r--tests/qtuitest/sys_input/sys_input.js343
-rw-r--r--tests/qtuitest/sys_input/sys_input.pro3
-rw-r--r--tests/qtuitest/sys_input/testdata/enter_invisible/failure_.pngbin0 -> 10526 bytes
-rw-r--r--tests/qtuitest/sys_input/testdata/enter_invisible/failure_.txt48
-rw-r--r--tests/qtuitest/sys_input/testdata/select_groupbox_subitem/failure_.txt46
-rw-r--r--tests/qtuitest/sys_linguist/sys_linguist.js152
-rw-r--r--tests/qtuitest/sys_linguist/sys_linguist.pro2
-rw-r--r--tests/qtuitest/sys_linguist/testdata/test_fr.ts158
-rw-r--r--tests/qtuitest/testapps/fileDialogSaveApp/fileDialogSaveApp.pro11
-rw-r--r--tests/qtuitest/testapps/fileDialogSaveApp/main.cpp10
-rw-r--r--tests/qtuitest/testapps/graphicsViewTest/graphicsViewTest.pro7
-rw-r--r--tests/qtuitest/testapps/graphicsViewTest/main.cpp15
-rw-r--r--tests/qtuitest/testapps/graphicsViewTest/mainwindow.cpp35
-rw-r--r--tests/qtuitest/testapps/graphicsViewTest/mainwindow.h27
-rw-r--r--tests/qtuitest/testapps/testapp1/main.cpp237
-rw-r--r--tests/qtuitest/testapps/testapp1/testapp1.pro19
-rw-r--r--tests/qtuitest/testapps/testapp2/main.cpp262
-rw-r--r--tests/qtuitest/testapps/testapp2/testapp2.pro16
-rw-r--r--tests/qtuitest/testapps/testapp3/main.cpp142
-rw-r--r--tests/qtuitest/testapps/testapp3/testapp3.pro16
-rw-r--r--tests/qtuitest/testapps/testapp4/main.cpp90
-rw-r--r--tests/qtuitest/testapps/testapp4/testapp4.pro16
-rw-r--r--tests/qtuitest/testapps/testapps.pro8
-rw-r--r--tests/qtuitest/tst_qalternatestack/tst_qalternatestack.cpp418
-rw-r--r--tests/qtuitest/tst_qalternatestack/tst_qalternatestack.pro10
-rw-r--r--tests/qtuitest/tst_qelapsedtimer/tst_qelapsedtimer.cpp78
-rw-r--r--tests/qtuitest/tst_qelapsedtimer/tst_qelapsedtimer.pro9
-rw-r--r--tests/qtuitest/tst_qinputgenerator/nativeevent.h19
-rw-r--r--tests/qtuitest/tst_qinputgenerator/nativeevent_noop.cpp17
-rw-r--r--tests/qtuitest/tst_qinputgenerator/nativeevent_x11.cpp85
-rw-r--r--tests/qtuitest/tst_qinputgenerator/tst_qinputgenerator.cpp756
-rw-r--r--tests/qtuitest/tst_qinputgenerator/tst_qinputgenerator.pro17
-rw-r--r--tests/qtuitest/tst_qtestprotocol/testprotocol.cpp49
-rw-r--r--tests/qtuitest/tst_qtestprotocol/testprotocol.h65
-rw-r--r--tests/qtuitest/tst_qtestprotocol/testprotocolserver.cpp71
-rw-r--r--tests/qtuitest/tst_qtestprotocol/testprotocolserver.h72
-rw-r--r--tests/qtuitest/tst_qtestprotocol/tst_qtestprotocol.cpp192
-rw-r--r--tests/qtuitest/tst_qtestprotocol/tst_qtestprotocol.pro19
-rw-r--r--tests/qtuitest/tst_qtuitestnamespace/tst_qtuitestnamespace.cpp898
-rw-r--r--tests/qtuitest/tst_qtuitestnamespace/tst_qtuitestnamespace.pro9
-rw-r--r--tests/qtuitest/tst_qtuitestwidgets/tst_qtuitestwidgets.cpp554
-rw-r--r--tests/qtuitest/tst_qtuitestwidgets/tst_qtuitestwidgets.pro19
-rw-r--r--tests/shared/filedialog.js113
-rw-r--r--tests/tests.pro3
456 files changed, 98758 insertions, 0 deletions
diff --git a/LGPL_EXCEPTION.txt b/LGPL_EXCEPTION.txt
new file mode 100644
index 0000000..8f73eca
--- /dev/null
+++ b/LGPL_EXCEPTION.txt
@@ -0,0 +1,22 @@
+Nokia Qt LGPL Exception version 1.1
+
+As an additional permission to the GNU Lesser General Public License version
+2.1, the object code form of a "work that uses the Library" may incorporate
+material from a header file that is part of the Library. You may distribute
+such object code under terms of your choice, provided that:
+ (i) the header files of the Library have not been modified; and
+ (ii) the incorporated material is limited to numerical parameters, data
+ structure layouts, accessors, macros, inline functions and
+ templates; and
+ (iii) you comply with the terms of Section 6 of the GNU Lesser General
+ Public License version 2.1.
+
+Moreover, you may apply this exception to a modified version of the Library,
+provided that such modification does not involve copying material from the
+Library into the modified Library's header files unless such material is
+limited to (i) numerical parameters; (ii) data structure layouts;
+(iii) accessors; and (iv) small macros, templates and inline functions of
+five lines or less in length.
+
+Furthermore, you are not required to apply this additional permission to a
+modified version of the Library.
diff --git a/LICENSE.LGPL b/LICENSE.LGPL
new file mode 100644
index 0000000..9a30e8c
--- /dev/null
+++ b/LICENSE.LGPL
@@ -0,0 +1,514 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+
+ The Qt GUI Toolkit is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ Contact: Nokia Corporation (qt-info@nokia.com)
+
+ You may use, distribute and copy the Qt GUI Toolkit under the terms of
+ GNU Lesser General Public License version 2.1, which is displayed below.
+
+-------------------------------------------------------------------------
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/LICENSE.PREVIEW.COMMERCIAL b/LICENSE.PREVIEW.COMMERCIAL
new file mode 100644
index 0000000..45740cb
--- /dev/null
+++ b/LICENSE.PREVIEW.COMMERCIAL
@@ -0,0 +1,629 @@
+TECHNOLOGY PREVIEW LICENSE AGREEMENT
+
+For individuals and/or legal entities resident in the Americas (North
+America, Central America and South America), the applicable licensing
+terms are specified under the heading "Technology Preview License
+Agreement: The Americas".
+
+For individuals and/or legal entities not resident in The Americas, the
+applicable licensing terms are specified under the heading "Technology
+Preview License Agreement: Rest of the World".
+
+
+TECHNOLOGY PREVIEW LICENSE AGREEMENT: The Americas
+Agreement version 2.4
+
+This Technology Preview License Agreement ("Agreement") is a legal
+agreement between Nokia Inc. ("Nokia"), with its registered office at
+102 Corporate Park Drive, White Plains, N.Y., U.S.A. 10604 and you (either an
+individual or a legal entity) ("Licensee") for the Licensed Software (as
+defined below).
+
+1. DEFINITIONS
+
+"Affiliate" of a Party shall mean an entity (i) which is directly or
+indirectly controlling such Party; (ii) which is under the same direct
+or indirect ownership or control as such Party; or (iii) which is
+directly or indirectly owned or controlled by such Party. For these
+purposes, an entity shall be treated as being controlled by another if
+that other entity has fifty percent (50 %) or more of the votes in such
+entity, is able to direct its affairs and/or to control the composition
+of its board of directors or equivalent body.
+
+"Applications" shall mean Licensee's software products created using the
+Licensed Software which may include portions of the Licensed Software.
+
+"Term" shall mean the period of time six (6) months from the later of
+(a) the Effective Date; or (b) the date the Licensed Software was
+initially delivered to Licensee by Nokia. If no specific Effective Date
+is set forth in the Agreement, the Effective Date shall be deemed to be
+the date the Licensed Software was initially delivered to Licensee.
+
+"Licensed Software" shall mean the computer software, "online" or
+electronic documentation, associated media and printed materials,
+including the source code, example programs and the documentation
+delivered by Nokia to Licensee in conjunction with this Agreement.
+
+"Party" or "Parties" shall mean Licensee and/or Nokia.
+
+
+2. OWNERSHIP
+
+The Licensed Software is protected by copyright laws and international
+copyright treaties, as well as other intellectual property laws and
+treaties. The Licensed Software is licensed, not sold.
+
+If Licensee provides any findings, proposals, suggestions or other
+feedback ("Feedback") to Nokia regarding the Licensed Software, Nokia
+shall own all right, title and interest including the intellectual
+property rights in and to such Feedback, excluding however any existing
+patent rights of Licensee. To the extent Licensee owns or controls any
+patents for such Feedback Licensee hereby grants to Nokia and its
+Affiliates, a worldwide, perpetual, non-transferable, sublicensable,
+royalty-free license to (i) use, copy and modify Feedback and to create
+derivative works thereof, (ii) to make (and have made), use, import,
+sell, offer for sale, lease, dispose, offer for disposal or otherwise
+exploit any products or services of Nokia containing Feedback,, and
+(iii) sublicense all the foregoing rights to third party licensees and
+customers of Nokia and/or its Affiliates.
+
+
+3. VALIDITY OF THE AGREEMENT
+
+By installing, copying, or otherwise using the Licensed Software,
+Licensee agrees to be bound by the terms of this Agreement. If Licensee
+does not agree to the terms of this Agreement, Licensee may not install,
+copy, or otherwise use the Licensed Software. Upon Licensee's acceptance
+of the terms and conditions of this Agreement, Nokia grants Licensee the
+right to use the Licensed Software in the manner provided below.
+
+
+4. LICENSES
+
+4.1. Using and Copying
+
+Nokia grants to Licensee a non-exclusive, non-transferable, time-limited
+license to use and copy the Licensed Software for sole purpose of
+designing, developing and testing Applications, and evaluating and the
+Licensed Software during the Term.
+
+Licensee may install copies of the Licensed Software on an unlimited
+number of computers provided that (a) if an individual, only such
+individual; or (b) if a legal entity only its employees; use the
+Licensed Software for the authorized purposes.
+
+4.2 No Distribution or Modifications
+
+Licensee may not disclose, modify, sell, market, commercialise,
+distribute, loan, rent, lease, or license the Licensed Software or any
+copy of it or use the Licensed Software for any purpose that is not
+expressly granted in this Section 4. Licensee may not alter or remove
+any details of ownership, copyright, trademark or other property right
+connected with the Licensed Software. Licensee may not distribute any
+software statically or dynamically linked with the Licensed Software.
+
+4.3 No Technical Support
+
+Nokia has no obligation to furnish Licensee with any technical support
+whatsoever. Any such support is subject to separate agreement between
+the Parties.
+
+
+5. PRE-RELEASE CODE
+The Licensed Software contains pre-release code that is not at the level
+of performance and compatibility of a final, generally available,
+product offering. The Licensed Software may not operate correctly and
+may be substantially modified prior to the first commercial product
+release, if any. Nokia is not obligated to make this or any later
+version of the Licensed Software commercially available. The License
+Software is "Not for Commercial Use" and may only be used for the
+purposes described in Section 4. The Licensed Software may not be used
+in a live operating environment where it may be relied upon to perform
+in the same manner as a commercially released product or with data that
+has not been sufficiently backed up.
+
+6. THIRD PARTY SOFTWARE
+
+The Licensed Software may provide links to third party libraries or code
+(collectively "Third Party Software") to implement various functions.
+Third Party Software does not comprise part of the Licensed Software. In
+some cases, access to Third Party Software may be included along with
+the Licensed Software delivery as a convenience for development and
+testing only. Such source code and libraries may be listed in the
+".../src/3rdparty" source tree delivered with the Licensed Software or
+documented in the Licensed Software where the Third Party Software is
+used, as may be amended from time to time, do not comprise the Licensed
+Software. Licensee acknowledges (1) that some part of Third Party
+Software may require additional licensing of copyright and patents from
+the owners of such, and (2) that distribution of any of the Licensed
+Software referencing any portion of a Third Party Software may require
+appropriate licensing from such third parties.
+
+
+7. LIMITED WARRANTY AND WARRANTY DISCLAIMER
+
+The Licensed Software is licensed to Licensee "as is". To the maximum
+extent permitted by applicable law, Nokia on behalf of itself and its
+suppliers, disclaims all warranties and conditions, either express or
+implied, including, but not limited to, implied warranties of
+merchantability, fitness for a particular purpose, title and
+non-infringement with regard to the Licensed Software.
+
+
+8. LIMITATION OF LIABILITY
+
+If, Nokia's warranty disclaimer notwithstanding, Nokia is held liable to
+Licensee, whether in contract, tort or any other legal theory, based on
+the Licensed Software, Nokia's entire liability to Licensee and
+Licensee's exclusive remedy shall be, at Nokia's option, either (A)
+return of the price Licensee paid for the Licensed Software, or (B)
+repair or replacement of the Licensed Software, provided Licensee
+returns to Nokia all copies of the Licensed Software as originally
+delivered to Licensee. Nokia shall not under any circumstances be liable
+to Licensee based on failure of the Licensed Software if the failure
+resulted from accident, abuse or misapplication, nor shall Nokia under
+any circumstances be liable for special damages, punitive or exemplary
+damages, damages for loss of profits or interruption of business or for
+loss or corruption of data. Any award of damages from Nokia to Licensee
+shall not exceed the total amount Licensee has paid to Nokia in
+connection with this Agreement.
+
+
+9. CONFIDENTIALITY
+
+Each party acknowledges that during the Term of this Agreement it shall
+have access to information about the other party's business, business
+methods, business plans, customers, business relations, technology, and
+other information, including the terms of this Agreement, that is
+confidential and of great value to the other party, and the value of
+which would be significantly reduced if disclosed to third parties (the
+"Confidential Information"). Accordingly, when a party (the "Receiving
+Party") receives Confidential Information from another party (the
+"Disclosing Party"), the Receiving Party shall, and shall obligate its
+employees and agents and employees and agents of its Affiliates to: (i)
+maintain the Confidential Information in strict confidence; (ii) not
+disclose the Confidential Information to a third party without the
+Disclosing Party's prior written approval; and (iii) not, directly or
+indirectly, use the Confidential Information for any purpose other than
+for exercising its rights and fulfilling its responsibilities pursuant
+to this Agreement. Each party shall take reasonable measures to protect
+the Confidential Information of the other party, which measures shall
+not be less than the measures taken by such party to protect its own
+confidential and proprietary information.
+
+"Confidential Information" shall not include information that (a) is or
+becomes generally known to the public through no act or omission of the
+Receiving Party; (b) was in the Receiving Party's lawful possession
+prior to the disclosure hereunder and was not subject to limitations on
+disclosure or use; (c) is developed by the Receiving Party without
+access to the Confidential Information of the Disclosing Party or by
+persons who have not had access to the Confidential Information of the
+Disclosing Party as proven by the written records of the Receiving
+Party; (d) is lawfully disclosed to the Receiving Party without
+restrictions, by a third party not under an obligation of
+confidentiality; or (e) the Receiving Party is legally compelled to
+disclose the information, in which case the Receiving Party shall assert
+the privileged and confidential nature of the information and cooperate
+fully with the Disclosing Party to protect against and prevent
+disclosure of any Confidential Information and to limit the scope of
+disclosure and the dissemination of disclosed Confidential Information
+by all legally available means.
+
+The obligations of the Receiving Party under this Section shall continue
+during the Initial Term and for a period of five (5) years after
+expiration or termination of this Agreement. To the extent that the
+terms of the Non-Disclosure Agreement between Nokia and Licensee
+conflict with the terms of this Section 9, this Section 9 shall be
+controlling over the terms of the Non-Disclosure Agreement.
+
+
+10. GENERAL PROVISIONS
+
+10.1 No Assignment
+
+Licensee shall not be entitled to assign or transfer all or any of its
+rights, benefits and obligations under this Agreement without the prior
+written consent of Nokia, which shall not be unreasonably withheld.
+
+10.2 Termination
+
+Nokia may terminate the Agreement at any time immediately upon written
+notice by Nokia to Licensee if Licensee breaches this Agreement.
+
+Upon termination of this Agreement, Licensee shall return to Nokia all
+copies of Licensed Software that were supplied by Nokia. All other
+copies of Licensed Software in the possession or control of Licensee
+must be erased or destroyed. An officer of Licensee must promptly
+deliver to Nokia a written confirmation that this has occurred.
+
+10.3 Surviving Sections
+
+Any terms and conditions that by their nature or otherwise reasonably
+should survive a cancellation or termination of this Agreement shall
+also be deemed to survive. Such terms and conditions include, but are
+not limited to the following Sections: 2, 5, 6, 7, 8, 9, 10.2, 10.3, 10.4,
+10.5, 10.6, 10.7, and 10.8 of this Agreement.
+
+10.4 Entire Agreement
+
+This Agreement constitutes the complete agreement between the parties
+and supersedes all prior or contemporaneous discussions,
+representations, and proposals, written or oral, with respect to the
+subject matters discussed herein, with the exception of the
+non-disclosure agreement executed by the parties in connection with this
+Agreement ("Non-Disclosure Agreement"), if any, shall be subject to
+Section 9. No modification of this Agreement shall be effective unless
+contained in a writing executed by an authorized representative of each
+party. No term or condition contained in Licensee's purchase order shall
+apply unless expressly accepted by Nokia in writing. If any provision of
+the Agreement is found void or unenforceable, the remainder shall remain
+valid and enforceable according to its terms. If any remedy provided is
+determined to have failed for its essential purpose, all limitations of
+liability and exclusions of damages set forth in this Agreement shall
+remain in effect.
+
+10.5 Export Control
+
+Licensee acknowledges that the Licensed Software may be subject to
+export control restrictions of various countries. Licensee shall fully
+comply with all applicable export license restrictions and requirements
+as well as with all laws and regulations relating to the importation of
+the Licensed Software and shall procure all necessary governmental
+authorizations, including without limitation, all necessary licenses,
+approvals, permissions or consents, where necessary for the
+re-exportation of the Licensed Software.,
+
+10.6 Governing Law and Legal Venue
+
+This Agreement shall be governed by and construed in accordance with the
+federal laws of the United States of America and the internal laws of
+the State of New York without given effect to any choice of law rule
+that would result in the application of the laws of any other
+jurisdiction. The United Nations Convention on Contracts for the
+International Sale of Goods (CISG) shall not apply. Each Party (a)
+hereby irrevocably submits itself to and consents to the jurisdiction of
+the United States District Court for the Southern District of New York
+(or if such court lacks jurisdiction, the state courts of the State of
+New York) for the purposes of any action, claim, suit or proceeding
+between the Parties in connection with any controversy, claim, or
+dispute arising out of or relating to this Agreement; and (b) hereby
+waives, and agrees not to assert by way of motion, as a defense or
+otherwise, in any such action, claim, suit or proceeding, any claim that
+is not personally subject to the jurisdiction of such court(s), that the
+action, claim, suit or proceeding is brought in an inconvenient forum or
+that the venue of the action, claim, suit or proceeding is improper.
+Notwithstanding the foregoing, nothing in this Section 9.6 is intended
+to, or shall be deemed to, constitute a submission or consent to, or
+selection of, jurisdiction, forum or venue for any action for patent
+infringement, whether or not such action relates to this Agreement.
+
+10.7 No Implied License
+
+There are no implied licenses or other implied rights granted under this
+Agreement, and all rights, save for those expressly granted hereunder,
+shall remain with Nokia and its licensors. In addition, no licenses or
+immunities are granted to the combination of the Licensed Software with
+any other software or hardware not delivered by Nokia under this
+Agreement.
+
+10.8 Government End Users
+
+A "U.S. Government End User" shall mean any agency or entity of the
+government of the United States. The following shall apply if Licensee
+is a U.S. Government End User. The Licensed Software is a "commercial
+item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995),
+consisting of "commercial computer software" and "commercial computer
+software documentation," as such terms are used in 48 C.F.R. 12.212
+(Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+through 227.7202-4 (June 1995), all U.S. Government End Users acquire
+the Licensed Software with only those rights set forth herein. The
+Licensed Software (including related documentation) is provided to U.S.
+Government End Users: (a) only as a commercial end item; and (b) only
+pursuant to this Agreement.
+
+
+
+
+
+TECHNOLOGY PREVIEW LICENSE AGREEMENT: Rest of the World
+Agreement version 2.4
+
+This Technology Preview License Agreement ("Agreement") is a legal
+agreement between Nokia Corporation ("Nokia"), with its registered
+office at Keilalahdentie 4, 02150 Espoo, Finland and you (either an
+individual or a legal entity) ("Licensee") for the Licensed Software (as
+defined below).
+
+1. DEFINITIONS
+
+"Affiliate" of a Party shall mean an entity (i) which is directly or
+indirectly controlling such Party; (ii) which is under the same direct
+or indirect ownership or control as such Party; or (iii) which is
+directly or indirectly owned or controlled by such Party. For these
+purposes, an entity shall be treated as being controlled by another if
+that other entity has fifty percent (50 %) or more of the votes in such
+entity, is able to direct its affairs and/or to control the composition
+of its board of directors or equivalent body.
+
+"Applications" shall mean Licensee's software products created using the
+Licensed Software which may include portions of the Licensed Software.
+
+"Term" shall mean the period of time six (6) months from the later of
+(a) the Effective Date; or (b) the date the Licensed Software was
+initially delivered to Licensee by Nokia. If no specific Effective Date
+is set forth in the Agreement, the Effective Date shall be deemed to be
+the date the Licensed Software was initially delivered to Licensee.
+
+"Licensed Software" shall mean the computer software, "online" or
+electronic documentation, associated media and printed materials,
+including the source code, example programs and the documentation
+delivered by Nokia to Licensee in conjunction with this Agreement.
+
+"Party" or "Parties" shall mean Licensee and/or Nokia.
+
+
+2. OWNERSHIP
+
+The Licensed Software is protected by copyright laws and international
+copyright treaties, as well as other intellectual property laws and
+treaties. The Licensed Software is licensed, not sold.
+
+If Licensee provides any findings, proposals, suggestions or other
+feedback ("Feedback") to Nokia regarding the Licensed Software, Nokia
+shall own all right, title and interest including the intellectual
+property rights in and to such Feedback, excluding however any existing
+patent rights of Licensee. To the extent Licensee owns or controls any
+patents for such Feedback Licensee hereby grants to Nokia and its
+Affiliates, a worldwide, perpetual, non-transferable, sublicensable,
+royalty-free license to (i) use, copy and modify Feedback and to create
+derivative works thereof, (ii) to make (and have made), use, import,
+sell, offer for sale, lease, dispose, offer for disposal or otherwise
+exploit any products or services of Nokia containing Feedback,, and
+(iii) sublicense all the foregoing rights to third party licensees and
+customers of Nokia and/or its Affiliates.
+
+3. VALIDITY OF THE AGREEMENT
+
+By installing, copying, or otherwise using the Licensed Software,
+Licensee agrees to be bound by the terms of this Agreement. If Licensee
+does not agree to the terms of this Agreement, Licensee may not install,
+copy, or otherwise use the Licensed Software. Upon Licensee's acceptance
+of the terms and conditions of this Agreement, Nokia grants Licensee the
+right to use the Licensed Software in the manner provided below.
+
+
+4. LICENSES
+
+4.1. Using and Copying
+
+Nokia grants to Licensee a non-exclusive, non-transferable, time-limited
+license to use and copy the Licensed Software for sole purpose of
+designing, developing and testing Applications, and evaluating and the
+Licensed Software during the Term.
+
+Licensee may install copies of the Licensed Software on an unlimited
+number of computers provided that (a) if an individual, only such
+individual; or (b) if a legal entity only its employees; use the
+Licensed Software for the authorized purposes.
+
+4.2 No Distribution or Modifications
+
+Licensee may not disclose, modify, sell, market, commercialise,
+distribute, loan, rent, lease, or license the Licensed Software or any
+copy of it or use the Licensed Software for any purpose that is not
+expressly granted in this Section 4. Licensee may not alter or remove
+any details of ownership, copyright, trademark or other property right
+connected with the Licensed Software. Licensee may not distribute any
+software statically or dynamically linked with the Licensed Software.
+
+4.3 No Technical Support
+
+Nokia has no obligation to furnish Licensee with any technical support
+whatsoever. Any such support is subject to separate agreement between
+the Parties.
+
+
+5. PRE-RELEASE CODE
+
+The Licensed Software contains pre-release code that is not at the level
+of performance and compatibility of a final, generally available,
+product offering. The Licensed Software may not operate correctly and
+may be substantially modified prior to the first commercial product
+release, if any. Nokia is not obligated to make this or any later
+version of the Licensed Software commercially available. The License
+Software is "Not for Commercial Use" and may only be used for the
+purposes described in Section 4. The Licensed Software may not be used
+in a live operating environment where it may be relied upon to perform
+in the same manner as a commercially released product or with data that
+has not been sufficiently backed up.
+
+6. THIRD PARTY SOFTWARE
+
+The Licensed Software may provide links to third party libraries or code
+(collectively "Third Party Software") to implement various functions.
+Third Party Software does not comprise part of the Licensed Software. In
+some cases, access to Third Party Software may be included along with
+the Licensed Software delivery as a convenience for development and
+testing only. Such source code and libraries may be listed in the
+".../src/3rdparty" source tree delivered with the Licensed Software or
+documented in the Licensed Software where the Third Party Software is
+used, as may be amended from time to time, do not comprise the Licensed
+Software. Licensee acknowledges (1) that some part of Third Party
+Software may require additional licensing of copyright and patents from
+the owners of such, and (2) that distribution of any of the Licensed
+Software referencing any portion of a Third Party Software may require
+appropriate licensing from such third parties.
+
+
+7. LIMITED WARRANTY AND WARRANTY DISCLAIMER
+
+The Licensed Software is licensed to Licensee "as is". To the maximum
+extent permitted by applicable law, Nokia on behalf of itself and its
+suppliers, disclaims all warranties and conditions, either express or
+implied, including, but not limited to, implied warranties of
+merchantability, fitness for a particular purpose, title and
+non-infringement with regard to the Licensed Software.
+
+
+8. LIMITATION OF LIABILITY
+
+If, Nokia's warranty disclaimer notwithstanding, Nokia is held liable to
+Licensee, whether in contract, tort or any other legal theory, based on
+the Licensed Software, Nokia's entire liability to Licensee and
+Licensee's exclusive remedy shall be, at Nokia's option, either (A)
+return of the price Licensee paid for the Licensed Software, or (B)
+repair or replacement of the Licensed Software, provided Licensee
+returns to Nokia all copies of the Licensed Software as originally
+delivered to Licensee. Nokia shall not under any circumstances be liable
+to Licensee based on failure of the Licensed Software if the failure
+resulted from accident, abuse or misapplication, nor shall Nokia under
+any circumstances be liable for special damages, punitive or exemplary
+damages, damages for loss of profits or interruption of business or for
+loss or corruption of data. Any award of damages from Nokia to Licensee
+shall not exceed the total amount Licensee has paid to Nokia in
+connection with this Agreement.
+
+
+9. CONFIDENTIALITY
+
+Each party acknowledges that during the Term of this Agreement it shall
+have access to information about the other party's business, business
+methods, business plans, customers, business relations, technology, and
+other information, including the terms of this Agreement, that is
+confidential and of great value to the other party, and the value of
+which would be significantly reduced if disclosed to third parties (the
+"Confidential Information"). Accordingly, when a party (the "Receiving
+Party") receives Confidential Information from another party (the
+"Disclosing Party"), the Receiving Party shall, and shall obligate its
+employees and agents and employees and agents of its Affiliates to: (i)
+maintain the Confidential Information in strict confidence; (ii) not
+disclose the Confidential Information to a third party without the
+Disclosing Party's prior written approval; and (iii) not, directly or
+indirectly, use the Confidential Information for any purpose other than
+for exercising its rights and fulfilling its responsibilities pursuant
+to this Agreement. Each party shall take reasonable measures to protect
+the Confidential Information of the other party, which measures shall
+not be less than the measures taken by such party to protect its own
+confidential and proprietary information.
+
+"Confidential Information" shall not include information that (a) is or
+becomes generally known to the public through no act or omission of the
+Receiving Party; (b) was in the Receiving Party's lawful possession
+prior to the disclosure hereunder and was not subject to limitations on
+disclosure or use; (c) is developed by the Receiving Party without
+access to the Confidential Information of the Disclosing Party or by
+persons who have not had access to the Confidential Information of the
+Disclosing Party as proven by the written records of the Receiving
+Party; (d) is lawfully disclosed to the Receiving Party without
+restrictions, by a third party not under an obligation of
+confidentiality; or (e) the Receiving Party is legally compelled to
+disclose the information, in which case the Receiving Party shall assert
+the privileged and confidential nature of the information and cooperate
+fully with the Disclosing Party to protect against and prevent
+disclosure of any Confidential Information and to limit the scope of
+disclosure and the dissemination of disclosed Confidential Information
+by all legally available means.
+
+The obligations of the Receiving Party under this Section shall continue
+during the Initial Term and for a period of five (5) years after
+expiration or termination of this Agreement. To the extent that the
+terms of the Non-Disclosure Agreement between Nokia and Licensee
+conflict with the terms of this Section 9, this Section 9 shall be
+controlling over the terms of the Non-Disclosure Agreement.
+
+
+10. GENERAL PROVISIONS
+
+10.1 No Assignment
+
+Licensee shall not be entitled to assign or transfer all or any of its
+rights, benefits and obligations under this Agreement without the prior
+written consent of Nokia, which shall not be unreasonably withheld.
+
+10.2 Termination
+
+Nokia may terminate the Agreement at any time immediately upon written
+notice by Nokia to Licensee if Licensee breaches this Agreement.
+
+Upon termination of this Agreement, Licensee shall return to Nokia all
+copies of Licensed Software that were supplied by Nokia. All other
+copies of Licensed Software in the possession or control of Licensee
+must be erased or destroyed. An officer of Licensee must promptly
+deliver to Nokia a written confirmation that this has occurred.
+
+10.3 Surviving Sections
+
+Any terms and conditions that by their nature or otherwise reasonably
+should survive a cancellation or termination of this Agreement shall
+also be deemed to survive. Such terms and conditions include, but are
+not limited to the following Sections: 2, 5, 6, 7, 8, 9, 10.2, 10.3, 10.4,
+10.5, 10.6, 10.7, and 10.8 of this Agreement.
+
+10.4 Entire Agreement
+
+This Agreement constitutes the complete agreement between the parties
+and supersedes all prior or contemporaneous discussions,
+representations, and proposals, written or oral, with respect to the
+subject matters discussed herein, with the exception of the
+non-disclosure agreement executed by the parties in connection with this
+Agreement ("Non-Disclosure Agreement"), if any, shall be subject to
+Section 9. No modification of this Agreement shall be effective unless
+contained in a writing executed by an authorized representative of each
+party. No term or condition contained in Licensee's purchase order shall
+apply unless expressly accepted by Nokia in writing. If any provision of
+the Agreement is found void or unenforceable, the remainder shall remain
+valid and enforceable according to its terms. If any remedy provided is
+determined to have failed for its essential purpose, all limitations of
+liability and exclusions of damages set forth in this Agreement shall
+remain in effect.
+
+10.5 Export Control
+
+Licensee acknowledges that the Licensed Software may be subject to
+export control restrictions of various countries. Licensee shall fully
+comply with all applicable export license restrictions and requirements
+as well as with all laws and regulations relating to the importation of
+the Licensed Software and shall procure all necessary governmental
+authorizations, including without limitation, all necessary licenses,
+approvals, permissions or consents, where necessary for the
+re-exportation of the Licensed Software.,
+
+10.6 Governing Law and Legal Venue
+
+This Agreement shall be construed and interpreted in accordance with the
+laws of Finland, excluding its choice of law provisions. Any disputes
+arising out of or relating to this Agreement shall be resolved in
+arbitration under the Rules of Arbitration of the Chamber of Commerce of
+Helsinki, Finland. The arbitration tribunal shall consist of one (1), or
+if either Party so requires, of three (3), arbitrators. The award shall
+be final and binding and enforceable in any court of competent
+jurisdiction. The arbitration shall be held in Helsinki, Finland and the
+process shall be conducted in the English language.
+
+10.7 No Implied License
+
+There are no implied licenses or other implied rights granted under this
+Agreement, and all rights, save for those expressly granted hereunder,
+shall remain with Nokia and its licensors. In addition, no licenses or
+immunities are granted to the combination of the Licensed Software with
+any other software or hardware not delivered by Nokia under this
+Agreement.
+
+10.8 Government End Users
+
+A "U.S. Government End User" shall mean any agency or entity of the
+government of the United States. The following shall apply if Licensee
+is a U.S. Government End User. The Licensed Software is a "commercial
+item," as that term is defined in 48 C.F.R. 2.101 (Oct. 1995),
+consisting of "commercial computer software" and "commercial computer
+software documentation," as such terms are used in 48 C.F.R. 12.212
+(Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1
+through 227.7202-4 (June 1995), all U.S. Government End Users acquire
+the Licensed Software with only those rights set forth herein. The
+Licensed Software (including related documentation) is provided to U.S.
+Government End Users: (a) only as a commercial end item; and (b) only
+pursuant to this Agreement.
+
+
+
+
diff --git a/README b/README
new file mode 100644
index 0000000..7bb0d63
--- /dev/null
+++ b/README
@@ -0,0 +1,109 @@
+==== INTRO ===================================================================
+
+QtUiTest is an experimental tool for automated testing of Qt user interfaces.
+Do NOT use this tool for any serious development work, instead use the tools
+provided by our partners.
+
+==== BUILDING ================================================================
+
+* Qt
+
+ QtUiTest requires Qt 4.5 or higher. Please ensure Qt has been built or
+ installed before continuing.
+
+* Default TCP/IP port for communication
+ By default the TCP/IP port used is 5656, this can be changed by
+ 1) running qmake with the port specified, eg:
+ qmake DEFINES+="DEFAULT_AUT_PORT=5156" ~/depot/qtuitest/qtuitest.pro
+ and 'touching' qtuitest_config.h eg:
+ touch ~/depot/qtuitest/qtuitest_config.h
+ OR
+ 2) changing the value of DEFAULT_AUT_PORT macro in qtuitest_config.h
+
+ Hint: If QtUitest is reporting problem connecting try a different TCP/IP port for autport.
+ *nix users can try seeing what TCP/IP ports are being used by running : netstat -n
+ See below for setting autport via QTUITEST_DEFAULT_OPTIONS environment variable
+
+
+* Enabling building support for Orbit or QML
+
+ To enable Orbit suport run qmake with the addition of CONFIG+=hbwidgets
+
+ To enable QML suport run qmake with addition of CONFIG+=qmlwidget
+
+* Disable building tests or examples
+ To disable tests run qmake with addition of CONFIG+=no_tests
+
+ To disable example run qmake with addition of CONFIG+=no_examples
+
+* Enabling debug code
+ By default no debuging code is printed. To enable print of debuging to console
+ 1) set QTUITEST_DEBUG environment variable to greater than zero value eg:
+ export QTUITEST_DEBUG=1
+ OR
+ 2) run qmake with DEFINES+=QTUITEST_DEBUG eg :
+ qmake DEFINES+=QTUITEST_DEBUG ~/depot/qtuitest/qtuitest.pro
+
+* Linux and Mac OS X
+
+ Assuming source is in ~/depot/qtuitest, build in ~/build/qtuitest :
+
+ mkdir -p ~/build/qtuitest
+ cd ~/build/qtuitest
+ qmake ~/depot/qtuitest/qtuitest.pro
+ make
+ make install
+
+* Windows
+
+ Assuming source is in c:\depot\qtuitest :
+
+ mkdir \build\qtuitest
+ cd \build\qtuitest
+ qmake c:\depot\qtuitest\qtuitest.pro
+ nmake
+ nmake install
+
+ If using MinGW, use mingw32-make instead of nmake.
+
+* Symbian
+
+ Shadow building is not supported for Symbian, you need to build in the
+ same directory as the source. The build procedure is essentially the same
+ as for other platforms :
+
+ qmake
+ make debug-winscw (to build for emulator)
+ make release-armv5 (to build for device)
+
+ Note that by default qtuitestrunner is not built for Symbian, as you
+ would normally run qtuitestrunner on a local machine and connect to a
+ device to run tests.
+
+ Once built, an installable .SIS package must be created and installed
+ on the phone. For example :
+
+ cd symbian
+ qmake qtuitest.pro
+ createpackage.bat QtUiTest_template.pkg release-armv5 rd.cer rd-key.pem
+
+* Orbit
+
+ QtUiTest includes experimental support for Orbit. To build, ensure that the
+ environment variables HB_SOURCE_DIR and HB_INSTALL_DIR are set to the
+ appropriate locations, and use qtuitest-orbit.pro instead of qtuitest.pro.
+
+ The sys_orbit tests require the Orbit test applications to be built, and
+ HB_INSTALL_DIR set correctly.
+
+==== USING ===================================================================
+
+There are some tests included which can be run like this (Linux):
+
+ cd ~/build/qtuitest/tests/qtuitest/sys_input
+ make test
+
+ To set a different autport to eg 5121 run:
+ export QTUITEST_DEFAULT_OPTIONS="-autport 5121"
+ before starting the test.
+
diff --git a/convert/README b/convert/README
new file mode 100644
index 0000000..4d3c7c4
--- /dev/null
+++ b/convert/README
@@ -0,0 +1,17 @@
+convert.pl converts a BAT Test Plan document (in LaTeX) to a QtUiTest test case
+(in QtScript). Formatting is retained as far as possible (using TWiki markup).
+
+Input is read from STDIN and output to STDOUT.
+
+Usage: perl convert.pl < document.tex > testcase.js
+
+NOTES
+1: Several assumptions are made about the structure of the document (eg,
+subsubsections correspond to test functions).
+2: Not all content in the document is converted, and not all layout is
+preserved. Converted tests must be reviewed against the original document.
+3: Tests are numbered in order, so adding a new test to the LaTeX document will
+result in subsequent tests having different numbers from what they had in
+previous revisions of the test plan. In order to be able to compare test results
+in a meaningful way, new tests must be added to the end of the document, not in
+the middle.
diff --git a/convert/convert.pl b/convert/convert.pl
new file mode 100644
index 0000000..c9730d4
--- /dev/null
+++ b/convert/convert.pl
@@ -0,0 +1,114 @@
+# This script converts the Test House BAT LaTeX documents into
+# twiki markup which is suitable for QtUiTest.
+
+sub printTestFunc {
+ my $funcName = shift(@_);
+ print " $funcName: function()\n {\n prompt(twiki(\n";
+ foreach (@_) {
+ s/\n/\\n/g;
+ s/\"/\\\"/g;
+ print "\"$_\"+\n";
+ }
+ print "\"\"));\n },\n";
+}
+
+$testprefix="QTBATMA_";
+$instep = 0;
+$indescr = 0;
+$insubsection = 0;
+$testcounter = 0;
+@testlines = ();
+@lines = <STDIN>;
+
+print "testcase = {\n\n";
+
+foreach (@lines) {
+ chomp;
+ if ($insubsection) {
+ push @subsectionlines, @templines;
+ } else {
+ push @testlines, @templines;
+ }
+ @templines = ();
+ s/(``|'')/\"/g;
+ s/\\url{(.*)}/%BLUE%$1%ENDCOLOR%/g;
+ s/\t/ /g;
+
+ if (/\\subsection{(.*)}/) {
+ $insubsection = 1;
+ @subsectionlines = ();
+ push @templines, "---++ $1\n";
+ next;
+ }
+ if (/\\subsubsection{(.*)}/) {
+ if (defined $testname) {
+ printTestFunc($testname, @testlines);
+ @testlines = ();
+ }
+ if ($insubsection) {
+ $insubsection = 0;
+ push @templines, @subsectionlines;
+ push @templines, "-------\n";
+ }
+ $testcounter++;
+ if ($testcounter < 10) {
+ $tcs = "0$testcounter";
+ } else {
+ $tcs = "$testcounter";
+ }
+ $testname = "$testprefix$tcs";
+ push @templines, "---+++ $testname: $1\n";
+ next;
+ }
+ if (/descr{(.*)}\s*(.*)/) {
+ push @templines, "---++++ $1\n";
+ if ($2 ne "") {
+ push @templines, "$2\n";
+ }
+ $indescr = 1;
+ next;
+ }
+ if (/\\begin{(?:short)?stepstable}/) {
+ $step = 1;
+ push @templines, "---++++ Steps:\n";
+ push @templines, "| *No.* | *Description* | *Expected Result* |";
+ next;
+ }
+ if (/\\end{(?:short)?stepstable}/) {
+ $instep = 0;
+ push @templines, "\n";
+ next;
+ }
+ if (/\\step\s*(.*)/) {
+ $instep = 1;
+ $x = $1;
+ $x =~ s/\s*(&|\\\\)\s*/ | /g;
+ push @templines, "\n| $step $x";
+ $step++;
+ next;
+ }
+ if (/^\s*\\hline/ || /^\s*\\footnote/ || /^\s*\\begin/ || /^\s*\\end/) {
+ next;
+ }
+ if ($instep) {
+ s/\\item/%BB%/;
+ } else {
+ s/\\item/\ */;
+ }
+ if ($indescr) {
+ push @templines, "$_\n";
+ if (/^\s*$/) {
+ $indescr=0;
+ }
+ next;
+ }
+ if ($instep) {
+ $x = $_;
+ $x =~ s/\s*(&|\\\\)\s*/ | /g;
+ push @templines, "$x";
+ next;
+ }
+}
+
+printTestFunc($testname, @testlines);
+print "\n}\n";
diff --git a/doc/html/assistant.dcf b/doc/html/assistant.dcf
new file mode 100644
index 0000000..ca2fdea
--- /dev/null
+++ b/doc/html/assistant.dcf
@@ -0,0 +1,3 @@
+<!DOCTYPE DCF>
+<DCF ref="assistant-manual.html" icon="assistant.png" imagedir="../../gif" title="Qt Assistant Manual">
+</DCF>
diff --git a/doc/html/classic.css b/doc/html/classic.css
new file mode 100644
index 0000000..320da66
--- /dev/null
+++ b/doc/html/classic.css
@@ -0,0 +1,279 @@
+BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV {
+ font-family: Arial, Geneva, Helvetica, sans-serif;
+}
+H1 {
+ text-align: center;
+ font-size: 160%;
+}
+H2 {
+ font-size: 120%;
+}
+H3 {
+ font-size: 100%;
+}
+
+h3.fn,span.fn
+{
+ background-color: #eee;
+ border-width: 1px;
+ border-style: solid;
+ border-color: #ddd;
+ font-weight: bold;
+ padding: 6px 0px 6px 10px;
+ margin: 42px 0px 0px 0px;
+}
+
+hr {
+ border: 0;
+ color: #a0a0a0;
+ background-color: #ccc;
+ height: 1px;
+ width: 100%;
+ text-align: left;
+ margin: 34px 0px 34px 0px;
+}
+
+table.valuelist {
+ border-width: 1px 1px 1px 1px;
+ border-style: solid;
+ border-color: #dddddd;
+ border-collapse: collapse;
+ background-color: #f0f0f0;
+}
+
+table.indextable {
+ border-width: 1px 1px 1px 1px;
+ border-style: solid;
+ border-collapse: collapse;
+ background-color: #f0f0f0;
+ border-color:#555;
+ font-size: 100%;
+}
+
+table td.largeindex {
+ border-width: 1px 1px 1px 1px;
+ border-collapse: collapse;
+ background-color: #f0f0f0;
+ border-color:#555;
+ font-size: 120%;
+}
+
+table.valuelist th {
+ border-width: 1px 1px 1px 2px;
+ padding: 4px;
+ border-style: solid;
+ border-color: #666;
+ color:white;
+ background-color:#666;
+}
+
+th.titleheader {
+ border-width: 1px 0px 1px 0px;
+ padding: 2px;
+ border-style: solid;
+ border-color: #666;
+ color:white;
+ background-color:#555;
+ background-image:url('images/gradient.png')};
+ background-repeat: repeat-x;
+ font-size: 100%;
+}
+
+
+th.largeheader {
+ border-width: 1px 0px 1px 0px;
+ padding: 4px;
+ border-style: solid;
+ border-color: #444;
+ color:white;
+ background-color:#555555;
+ font-size: 120%;
+}
+
+p {
+
+ margin-left: 4px;
+ margin-top: 8px;
+ margin-bottom: 8px;
+}
+
+a:link
+{
+ color: #0046ad;
+ text-decoration: none
+}
+
+a:visited
+{
+ color: #672967;
+ text-decoration: none
+}
+
+a.obsolete
+{
+ color: #661100;
+ text-decoration: none
+}
+
+a.compat
+{
+ color: #661100;
+ text-decoration: none
+}
+
+a.obsolete:visited
+{
+ color: #995500;
+ text-decoration: none
+}
+
+a.compat:visited
+{
+ color: #995500;
+ text-decoration: none
+}
+
+body
+{
+ background: #ffffff;
+ color: black
+}
+
+table.generic, table.annotated
+{
+ border-width: 1px;
+ border-color:#bbb;
+ border-style:solid;
+ border-collapse:collapse;
+}
+
+table td.memItemLeft {
+ width: 180px;
+ padding: 2px 0px 0px 8px;
+ margin: 4px;
+ border-width: 1px;
+ border-color: #E0E0E0;
+ border-style: none;
+ font-size: 100%;
+ white-space: nowrap
+}
+
+table td.memItemRight {
+ padding: 2px 8px 0px 8px;
+ margin: 4px;
+ border-width: 1px;
+ border-color: #E0E0E0;
+ border-style: none;
+ font-size: 100%;
+}
+
+table tr.odd {
+ background: #f0f0f0;
+ color: black;
+}
+
+table tr.even {
+ background: #e4e4e4;
+ color: black;
+}
+
+table.annotated th {
+ padding: 3px;
+ text-align: left
+}
+
+table.annotated td {
+ padding: 3px;
+}
+
+table tr pre
+{
+ padding-top: 0px;
+ padding-bottom: 0px;
+ padding-left: 0px;
+ padding-right: 0px;
+ border: none;
+ background: none
+}
+
+tr.qt-style
+{
+ background: #96E066;
+ color: black
+}
+
+body pre
+{
+ padding: 0.2em;
+ border: #e7e7e7 1px solid;
+ background: #f1f1f1;
+ color: black
+}
+
+table tr.qt-code pre
+{
+ padding: 0.2em;
+ border: #e7e7e7 1px solid;
+ background: #f1f1f1;
+ color: black
+}
+
+span.preprocessor, span.preprocessor a
+{
+ color: darkblue;
+}
+
+span.comment
+{
+ color: darkred;
+ font-style: italic
+}
+
+span.string,span.char
+{
+ color: darkgreen;
+}
+
+.title
+{
+ text-align: center
+}
+
+.subtitle
+{
+ font-size: 0.8em
+}
+
+.small-subtitle
+{
+ font-size: 0.65em
+}
+
+.qmlitem {
+ padding: 0;
+}
+
+.qmlname {
+ white-space: nowrap;
+}
+
+.qmltype {
+ text-align: center;
+ font-size: 160%;
+}
+
+.qmlproto {
+ background-color: #eee;
+ border-width: 1px;
+ border-style: solid;
+ border-color: #ddd;
+ font-weight: bold;
+ padding: 6px 0px 6px 10px;
+ margin: 42px 0px 0px 0px;
+}
+
+.qmldoc {
+}
+
+*.qmlitem p {
+}
diff --git a/doc/html/designer.dcf b/doc/html/designer.dcf
new file mode 100644
index 0000000..d307129
--- /dev/null
+++ b/doc/html/designer.dcf
@@ -0,0 +1,3 @@
+<!DOCTYPE DCF>
+<DCF ref="designer-manual.html" icon="designer.png" imagedir="../../gif" title="Qt Designer Manual">
+</DCF>
diff --git a/doc/html/images/qt-logo.png b/doc/html/images/qt-logo.png
new file mode 100644
index 0000000..2dc6716
--- /dev/null
+++ b/doc/html/images/qt-logo.png
Binary files differ
diff --git a/doc/html/index.html b/doc/html/index.html
new file mode 100644
index 0000000..1f9ab89
--- /dev/null
+++ b/doc/html/index.html
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../doc/src/index.qdoc -->
+<head>
+ <title>Qt Reference Documentation</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">Qt Reference Documentation<br /><span class="subtitle"></span>
+</h1>
+<a name="qt-reference-documentation"></a> <table cellpadding="2" cellspacing="1" border="0" width="95%" class="indextable" align="center">
+ <tr>
+ <th class="titleheader" width="33%">
+ Getting Started</th>
+ <th class="titleheader" width="33%">
+ API Reference</th>
+ <th class="titleheader" width="33%">
+ Working with Qt</th>
+ </tr>
+ <tr>
+ <td valign="top">
+ <ul>
+ <li><a href="installation.html">Installation</a> and <a href="how-to-learn-qt.html">First Steps with Qt</a></li>
+ <li><a href="tutorials.html">Tutorials</a> and <a href="examples.html">Examples</a></li>
+ <li><a href="demos.html">Demonstrations</a> and <a href="qt4-6-intro.html"><b>New in Qt 4.6</b></a></li>
+ </ul>
+ </td>
+ <td valign="top">
+ <ul>
+ <li><a href="classlists.html">Class and Function Documentation</a></li>
+ <li><a href="frameworks-technologies.html">Frameworks and Technologies</a></li>
+ <li><a href="best-practices.html">How-To&#39;s and Best Practices</a></li>
+ </ul>
+ </td>
+ <td valign="top">
+ <ul>
+ <li><a href="developing-with-qt.html">Cross-Platform Development with Qt</a></li>
+ <li><a href="qtestlib-manual.html">Unit Testing</a> and <a href="debug.html">Debugging</a></li>
+ <li><a href="deployment.html">Deploying Qt Applications</a></li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <th class="titleheader">
+ Fundamentals</th>
+ <th class="titleheader">
+ User Interface Design</th>
+ <th class="titleheader">
+ Technologies</th>
+ </tr>
+ <tr>
+ <td valign="top">
+ <ul>
+ <li><a href="object.html">The Qt Object Model</a></li>
+ <li><a href="eventsandfilters.html">Event System</a></li>
+ <li><a href="threads.html">Threading</a></li>
+ <li><a href="internationalization.html">Internationalization</a></li>
+ <li><a href="platform-specific.html">Platform Specifics</a></li>
+ </ul>
+ </td>
+ <td valign="top">
+ <ul>
+ <li><a href="widgets-and-layouts.html">Widgets and Layouts</a></li>
+ <li><a href="application-windows.html">Application Windows</a></li>
+ <li><a href="paintsystem.html">Painting and Printing</a></li>
+ <li><a href="graphicsview.html">Canvas UI with Graphics View</a></li>
+ <li><a href="webintegration.html">Integrating Web Content</a></li>
+ <li><a href="qtdeclarative.html">Declarative UI</a></li>
+ </ul>
+ </td>
+ <td valign="top">
+ <ul>
+ <li><a href="io.html">Input/Output</a> and <a href="resources.html">Resources</a></li>
+ <li><a href="network-programming.html">Network Programming</a></li>
+ <li><a href="sql-programming.html">SQL Development</a></li>
+ <li><a href="xml-processing.html">XML Processing</a></li>
+ <li><a href="scripting.html">Scripting</a></li>
+ </ul>
+ </td>
+ </tr>
+ <tr>
+ <th class="titleheader">
+ Community and Resources</th>
+ <th class="titleheader">
+ Contributing</th>
+ <th class="titleheader">
+ Licenses</th>
+ </tr>
+ <tr>
+ <td valign="top">
+ <ul>
+ <li><a href="http://qt.nokia.com/developer">Online Resources</a></li>
+ <li><a href="http://labs.qt.nokia.com/blogs">Developer Blogs</a></li>
+ <li><a href="http://qt.nokia.com/support-services">Support</a>, <a href="http://qt.nokia.com/services-partners">Training and Services</a></li>
+ </ul>
+ </td>
+ <td valign="top">
+ <ul>
+ <li><a href="bughowto.html">Report Bugs and Make Suggestions</a></li>
+ <li><a href="http://qt.gitorious.org">Open Repository</a></li>
+ <li><a href="credits.html">Credits</a></li>
+ </ul>
+ </td>
+ <td valign="top">
+ <ul>
+ <li><a href="gpl.html">GNU GPL</a>, <a href="lgpl.html">GNU LGPL</a></li>
+ <li><a href="commercialeditions.html">Commercial Editions</a></li>
+ <li><a href="licensing.html">Licenses Used in Qt</a></li>
+ </ul>
+ </td>
+ </tr>
+ </table>
+ <p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/linguist.dcf b/doc/html/linguist.dcf
new file mode 100644
index 0000000..9e27d2b
--- /dev/null
+++ b/doc/html/linguist.dcf
@@ -0,0 +1,3 @@
+<!DOCTYPE DCF>
+<DCF ref="linguist-manual.html" icon="linguist.png" imagedir="../../gif" title="Qt Linguist Manual">
+</DCF>
diff --git a/doc/html/qmake.dcf b/doc/html/qmake.dcf
new file mode 100644
index 0000000..d7b2821
--- /dev/null
+++ b/doc/html/qmake.dcf
@@ -0,0 +1,3 @@
+<!DOCTYPE DCF>
+<DCF ref="qmake-manual.html" imagedir="../../gif" title="qmake Manual">
+</DCF>
diff --git a/doc/html/qsystemtest.html b/doc/html/qsystemtest.html
new file mode 100644
index 0000000..48661e9
--- /dev/null
+++ b/doc/html/qsystemtest.html
@@ -0,0 +1,701 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../libqsystemtest/qsystemtest.cpp -->
+<head>
+ <title>QSystemTest Namespace Reference</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">QSystemTest Namespace Reference<br /><span class="small-subtitle">[QtUiTestModule]</span>
+</h1>
+<p>The QSystemTest namespace provides script based system test functionality for Qt. <a href="#details">More...</a></p>
+<pre> #include &lt;QSystemTest&gt;</pre><p><b>This namespace is under development and is subject to change.</b></p>
+<ul>
+</ul>
+<hr />
+<a name="types"></a>
+<h2>Types</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">typedef </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#Array-typedef">Array</a></b></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">typedef </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#Boolean-typedef">Boolean</a></b></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#EnterMode-enum">EnterMode</a></b> { Commit, NoCommit }</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">typedef </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#Function-typedef">Function</a></b></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#LabelOrientation-enum">LabelOrientation</a></b> { LabelLeft, LabelRight, LabelAbove, LabelBelow }</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">typedef </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#Number-typedef">Number</a></b></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">typedef </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#QVariantArray-typedef">QVariantArray</a></b></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#Role-enum">Role</a></b> { NoRole, TitleBar, MenuBar, ScrollBar, ..., UserRole }</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#SkipMode-enum">SkipMode</a></b> { SkipSingle, SkipAll }</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#StartApplicationFlag-enum">StartApplicationFlag</a></b> { NoFlag, WaitForFocus, BackgroundCurrentApplication }</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">flags </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#StartApplicationFlag-enum">StartApplicationFlags</a></b></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">flags </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#StateFlag-enum">State</a></b></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#StateFlag-enum">StateFlag</a></b> { Normal, Unavailable, Selected, Focused, ..., Modal }</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">typedef </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#StringArray-typedef">StringArray</a></b></td></tr>
+</table>
+<hr />
+<a name="functions"></a>
+<h2>Functions</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#Q_ENUMS">Q_ENUMS</a></b> ( SkipMode )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#activate">activate</a></b> ( const QString &amp; <i>queryPath</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#addExpectedMessageBox">addExpectedMessageBox</a></b> ( const QString &amp; <i>title</i>, const QString &amp; <i>text</i>, const QString &amp; <i>option</i> = QString() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#checkOS">checkOS</a></b> ( const QString &amp; )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#checkState">checkState</a></b> ( const QString &amp; <i>queryPath</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#clearExpectedMessageBox">clearExpectedMessageBox</a></b> ( const QString &amp; <i>title</i>, const QString &amp; <i>text</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#clearExpectedMessageBoxes">clearExpectedMessageBoxes</a></b> ()</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#compare">compare</a></b> ( Variant <i>actual</i>, Variant <i>expected</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#compareImage">compareImage</a></b> ( const QString &amp; <i>expectedName</i>, const QString &amp; <i>queryPath</i>, const QStringList &amp; <i>maskedWidgets</i> = QStringList() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#currentApplication">currentApplication</a></b> ()</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#currentTitle">currentTitle</a></b> ( const QString &amp; <i>queryPath</i> = QString() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#deletePath">deletePath</a></b> ( const QString &amp; <i>path</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#enter">enter</a></b> ( const QVariant &amp; <i>value</i>, const QString &amp; <i>queryPath</i> = QString(), EnterMode <i>mode</i> = Commit )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#expectApplicationClose">expectApplicationClose</a></b> ( bool <i>value</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#expectFail">expectFail</a></b> ( const QString &amp; <i>reason</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#expectMessageBox">expectMessageBox</a></b> ( String <i>title</i>, String <i>text</i>, String <i>option</i>, Number <i>timeout</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#fail">fail</a></b> ( String <i>message</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QStringList </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#findByProperty">findByProperty</a></b> ( const QString &amp; <i>property</i>, const QVariant &amp; <i>searchValue</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QStringList </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#findByProperty-2">findByProperty</a></b> ( const QVariantMap &amp; <i>searchValues</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#focusWidget">focusWidget</a></b> ( const QString &amp; <i>queryPath</i> = QString() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#getClipboardText">getClipboardText</a></b> ()</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#getData">getData</a></b> ( const QString &amp; <i>srcFile</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QDateTime </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#getDateTime">getDateTime</a></b> ()</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QStringList </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#getDirectoryEntries">getDirectoryEntries</a></b> ( const QString &amp; <i>dir</i>, QDir::Filters <i>filters</i> = QDir::NoFilter )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#getFile">getFile</a></b> ( const QString &amp; <i>srcFile</i>, const QString &amp; <i>destFile</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QRect </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#getGeometry">getGeometry</a></b> ( const QString &amp; <i>queryPath</i> = QString() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QStringList </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#getLabels">getLabels</a></b> ( const QString &amp; <i>queryPath</i> = QString() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QStringList </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#getList">getList</a></b> ( const QString &amp; <i>queryPath</i> = QString() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QLocale </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#getLocale">getLocale</a></b> ()</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QVariant </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#getProperty">getProperty</a></b> ( const QString &amp; <i>queryPath</i>, const QString &amp; <i>name</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#getSelectedText">getSelectedText</a></b> ( const QString &amp; <i>queryPath</i> = QString() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QVariant </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#getSelectedValue">getSelectedValue</a></b> ( const QString &amp; <i>queryPath</i> = QString() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QVariant </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#getSetting">getSetting</a></b> ( const QString &amp; <i>file</i>, const QString &amp; <i>group</i>, const QString &amp; <i>key</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QVariant </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#getSetting-2">getSetting</a></b> ( const QString &amp; <i>organization</i>, const QString &amp; <i>application</i>, const QString &amp; <i>group</i>, const QString &amp; <i>key</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#getText">getText</a></b> ( const QString &amp; <i>queryPath</i> = QString() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QVariant </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#getValue">getValue</a></b> ( const QString &amp; <i>queryPath</i> = QString() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#getenv">getenv</a></b> ( const QString &amp; )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#ignoreMessageBoxes">ignoreMessageBoxes</a></b> ( bool <i>ignore</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#invokeMethod">invokeMethod</a></b> ( const QString &amp; <i>queryPath</i>, const QString &amp; <i>method</i>, Qt::ConnectionType <i>type</i>, const QVariant &amp; <i>arg0</i> = QVariant(), const QVariant &amp; <i>arg1</i> = QVariant(), const QVariant &amp; <i>arg2</i> = QVariant(), const QVariant &amp; <i>arg3</i> = QVariant(), const QVariant &amp; <i>arg4</i> = QVariant(), const QVariant &amp; <i>arg5</i> = QVariant(), const QVariant &amp; <i>arg6</i> = QVariant(), const QVariant &amp; <i>arg7</i> = QVariant(), const QVariant &amp; <i>arg8</i> = QVariant(), const QVariant &amp; <i>arg9</i> = QVariant() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#invokeMethod-2">invokeMethod</a></b> ( const QString &amp; <i>queryPath</i>, const QString &amp; <i>method</i>, const QVariant &amp; <i>arg0</i> = QVariant(), const QVariant &amp; <i>arg1</i> = QVariant(), const QVariant &amp; <i>arg2</i> = QVariant(), const QVariant &amp; <i>arg3</i> = QVariant(), const QVariant &amp; <i>arg4</i> = QVariant(), const QVariant &amp; <i>arg5</i> = QVariant(), const QVariant &amp; <i>arg6</i> = QVariant(), const QVariant &amp; <i>arg7</i> = QVariant(), const QVariant &amp; <i>arg8</i> = QVariant(), const QVariant &amp; <i>arg9</i> = QVariant() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#isChecked">isChecked</a></b> ( const QString &amp; <i>queryPath</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#isChecked-2">isChecked</a></b> ( const QString &amp; <i>item</i>, const QString &amp; <i>queryPath</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#isEnabled">isEnabled</a></b> ( const QString &amp; <i>queryPath</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#isVisible">isVisible</a></b> ( const QString &amp; <i>queryPath</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#keyClick">keyClick</a></b> ( Qt::Key <i>key</i>, const QString &amp; <i>queryPath</i> = QString() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#keyClickHold">keyClickHold</a></b> ( Qt::Key <i>key</i>, int <i>duration</i>, const QString &amp; <i>queryPath</i> = QString() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#keyPress">keyPress</a></b> ( Qt::Key <i>key</i>, const QString &amp; <i>queryPath</i> = QString() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#keyRelease">keyRelease</a></b> ( Qt::Key <i>key</i>, const QString &amp; <i>queryPath</i> = QString() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">LabelOrientation </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#labelOrientation">labelOrientation</a></b> ()</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#mouseClick">mouseClick</a></b> ( int <i>x</i>, int <i>y</i>, QFlags&lt;Qt::MouseButton&gt; <i>buttons</i> = Qt::LeftButton )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#mouseClick-2">mouseClick</a></b> ( const QString &amp; <i>queryPath</i>, QFlags&lt;Qt::MouseButton&gt; <i>buttons</i> = Qt::LeftButton )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#mouseClickHold">mouseClickHold</a></b> ( int <i>x</i>, int <i>y</i>, int <i>duration</i>, QFlags&lt;Qt::MouseButton&gt; <i>buttons</i> = Qt::LeftButton )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#mouseClickHold-2">mouseClickHold</a></b> ( const QString &amp; <i>queryPath</i>, int <i>duration</i>, QFlags&lt;Qt::MouseButton&gt; <i>buttons</i> = Qt::LeftButton )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#mousePreferred">mousePreferred</a></b> ()</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#mousePress">mousePress</a></b> ( int <i>x</i>, int <i>y</i>, QFlags&lt;Qt::MouseButton&gt; <i>buttons</i> = Qt::LeftButton )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#mousePress-2">mousePress</a></b> ( const QString &amp; <i>queryPath</i>, QFlags&lt;Qt::MouseButton&gt; <i>buttons</i> = Qt::LeftButton )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#mouseRelease">mouseRelease</a></b> ( int <i>x</i>, int <i>y</i>, QFlags&lt;Qt::MouseButton&gt; <i>buttons</i> = Qt::LeftButton )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#mouseRelease-2">mouseRelease</a></b> ( const QString &amp; <i>queryPath</i>, QFlags&lt;Qt::MouseButton&gt; <i>buttons</i> = Qt::LeftButton )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#prompt">prompt</a></b> ( const QString &amp; <i>promptText</i> = QString() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#putData">putData</a></b> ( const QByteArray &amp; <i>data</i>, const QString &amp; <i>destFile</i>, QFile::Permissions <i>permissions</i> = 0 )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#putFile">putFile</a></b> ( const QString &amp; <i>srcFile</i>, const QString &amp; <i>destFile</i>, QFile::Permissions <i>permissions</i> = 0 )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#readLocalFile">readLocalFile</a></b> ( const QString &amp; <i>file</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#runProcess">runProcess</a></b> ( const QString &amp; <i>application</i>, const QStringList &amp; <i>args</i>, const QString &amp; <i>input</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#runsOnDevice">runsOnDevice</a></b> ()</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#saveScreen">saveScreen</a></b> ( const QString &amp; <i>name</i>, const QString &amp; <i>queryPath</i> = &quot;qpe:&quot; )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#select">select</a></b> ( const QString &amp; <i>item</i>, const QString &amp; <i>queryPath</i> = QString() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#selectIndex">selectIndex</a></b> ( const QVariantList &amp; <i>index</i>, const QString &amp; <i>queryPath</i> = QString() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#setCheckState">setCheckState</a></b> ( int <i>state</i>, const QString &amp; <i>queryPath</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#setChecked">setChecked</a></b> ( bool <i>doCheck</i>, const QString &amp; <i>queryPath</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#setChecked-2">setChecked</a></b> ( bool <i>doCheck</i>, const QString &amp; <i>item</i>, const QString &amp; <i>queryPath</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#setClipboardText">setClipboardText</a></b> ( const QString &amp; <i>text</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#setLabelOrientation">setLabelOrientation</a></b> ( LabelOrientation <i>orientation</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#setMousePreferred">setMousePreferred</a></b> ( bool <i>useMouse</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#setProperty">setProperty</a></b> ( const QString &amp; <i>queryPath</i>, const QString &amp; <i>name</i>, const QVariant &amp; <i>value</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#setSetting">setSetting</a></b> ( const QString &amp; <i>file</i>, const QString &amp; <i>group</i>, const QString &amp; <i>key</i>, const QVariant &amp; <i>value</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#setSetting-2">setSetting</a></b> ( const QString &amp; <i>organization</i>, const QString &amp; <i>application</i>, const QString &amp; <i>group</i>, const QString &amp; <i>key</i>, const QVariant &amp; <i>value</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#setVisibleResponseTime">setVisibleResponseTime</a></b> ( int <i>time</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#signature">signature</a></b> ( const QString &amp; <i>labelText</i>, int <i>offset</i> = 0 )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#skip">skip</a></b> ( const QString &amp; <i>message</i>, SkipMode <i>mode</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#startApplication">startApplication</a></b> ( const QString &amp; <i>application</i>, const QStringList &amp; <i>arguments</i> = QStringList(), int <i>timeout</i> = 5000, QSystemTest::StartApplicationFlags <i>flags</i> = QSystemTest::WaitForFocus )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#strict">strict</a></b> ( bool <i>on</i> = true )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#tabBar">tabBar</a></b> ( int <i>index</i> = 0 )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#translate">translate</a></b> ( const QString &amp; <i>context</i>, const QString &amp; <i>text</i>, const QString &amp; <i>comment</i> = QString(), int <i>n</i> = 0 )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#userName">userName</a></b> ()</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#verify">verify</a></b> ( Boolean <i>condition</i>, String <i>message</i> = null )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#verifyImage">verifyImage</a></b> ( const QString &amp; <i>expectedName</i>, const QString &amp; <i>queryPath</i> = QString(), const QString &amp; <i>comment</i> = QString(), const QStringList &amp; <i>maskedWidgets</i> = QStringList() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#visibleResponseTime">visibleResponseTime</a></b> ()</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#wait">wait</a></b> ( int <i>msecs</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#waitExpectedMessageBox">waitExpectedMessageBox</a></b> ( uint <i>timeout</i>, bool <i>waitForAll</i> = true, const QString &amp; <i>title</i> = QString(), const QString &amp; <i>text</i> = QString() )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#waitFor">waitFor</a></b> ( Number <i>timeout</i> = 10000, Number <i>intervals</i> = 20, String <i>message</i> = null )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qsystemtest.html#waitForTitle">waitForTitle</a></b> ( const QString &amp; <i>title</i>, int <i>timeout</i> = 0 )</td></tr>
+</table>
+<a name="details"></a>
+<hr />
+<h2>Detailed Description</h2>
+<p>The QSystemTest namespace provides script based system test functionality for Qt.</p>
+<p>This documentation describes the API reference for the <a href="qtuitest.html">QtUiTest</a> scripting language. Please read the <a href="qtuitest-manual.html">QtUiTest Manual</a> for a full description of the system test tool.</p>
+<hr />
+<h2>Type Documentation</h2>
+<h3 class="fn"><a name="Array-typedef"></a>typedef Array</h3>
+<p>The Array type as documented in ECMA-262, section 15.4&#x2e;</p>
+<p>The following extensions are provided in <a href="qtuitest.html">QtUiTest</a>.</p>
+<p><table class="generic" align="center" cellpadding="2" cellspacing="1" border="0">
+<tr valign="top" class="odd"><td><tt><a href="qsystemtest.html#Boolean-typedef">Boolean</a> Array.prototype.contains(value)</tt></td><td>Returns true if the array contains the given value.</td></tr>
+</table></p>
+<h3 class="fn"><a name="Boolean-typedef"></a>typedef Boolean</h3>
+<p>The Boolean type as documented in ECMA-262, section 15.6&#x2e;</p>
+<h3 class="fn"><a name="EnterMode-enum"></a>enum QSystemTest::EnterMode</h3>
+<p>This enum specifies whether <a href="qsystemtest.html#enter">enter</a>() should commit the entered value (eg, by simulating a Select keypress) or not.</p>
+<p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%">
+<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
+<tr><td valign="top"><tt>QSystemTest::Commit</tt></td><td align="center" valign="top"><tt>0x00</tt></td><td valign="top">Commit the value (default).</td></tr>
+<tr><td valign="top"><tt>QSystemTest::NoCommit</tt></td><td align="center" valign="top"><tt>0x01</tt></td><td valign="top">Do not commit the value.</td></tr>
+</table></p>
+<h3 class="fn"><a name="Function-typedef"></a>typedef Function</h3>
+<p>The Function type as documented in ECMA-262, section 15.3&#x2e;</p>
+<h3 class="fn"><a name="LabelOrientation-enum"></a>enum QSystemTest::LabelOrientation</h3>
+<p>This enum is used to indicate the expected position of a label relative to the widget it is associated with. Use <a href="qsystemtest.html#setLabelOrientation">setLabelOrientation</a>() to change the expected layout.</p>
+<p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%">
+<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
+<tr><td valign="top"><tt>QSystemTest::LabelLeft</tt></td><td align="center" valign="top"><tt>0x01</tt></td><td valign="top">Label is located to left of widget.</td></tr>
+<tr><td valign="top"><tt>QSystemTest::LabelRight</tt></td><td align="center" valign="top"><tt>0x02</tt></td><td valign="top">Label is located to right of widget.</td></tr>
+<tr><td valign="top"><tt>QSystemTest::LabelAbove</tt></td><td align="center" valign="top"><tt>0x03</tt></td><td valign="top">Label is located above widget.</td></tr>
+<tr><td valign="top"><tt>QSystemTest::LabelBelow</tt></td><td align="center" valign="top"><tt>0x04</tt></td><td valign="top">Label is located below widget.</td></tr>
+</table></p>
+<p>See also <a href="qsystemtest.html#labelOrientation">labelOrientation</a>() and <a href="qsystemtest.html#setLabelOrientation">setLabelOrientation</a>().</p>
+<h3 class="fn"><a name="Number-typedef"></a>typedef Number</h3>
+<p>The Number type as documented in ECMA-262, section 15.7&#x2e;</p>
+<h3 class="fn"><a name="QVariantArray-typedef"></a>typedef QVariantArray</h3>
+<p>An <a href="qsystemtest.html#Array-typedef">Array</a> object in which every element is a QVariant.</p>
+<h3 class="fn"><a name="Role-enum"></a>enum QSystemTest::Role</h3>
+<h3 class="fn"><a name="SkipMode-enum"></a>enum QSystemTest::SkipMode</h3>
+<p>This enum describes the modes for skipping tests during execution of the test data.</p>
+<p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%">
+<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
+<tr><td valign="top"><tt>QSystemTest::SkipSingle</tt></td><td align="center" valign="top"><tt>0x01</tt></td><td valign="top">Skip the rest of this test function for the current test data entry, but continue execution of the remaining test data.</td></tr>
+<tr><td valign="top"><tt>QSystemTest::SkipAll</tt></td><td align="center" valign="top"><tt>0x02</tt></td><td valign="top">Skip the rest of this test function, and do not process any further test data for this test function.</td></tr>
+</table></p>
+<p>See also <a href="qsystemtest.html#skip">skip</a>() and QTest::SkipMode.</p>
+<h3 class="flags"><a name="StartApplicationFlag-enum"></a>enum QSystemTest::StartApplicationFlag<br />flags QSystemTest::StartApplicationFlags</h3>
+<p>This enum describes additional behaviour to use when starting applications by <a href="qsystemtest.html#startApplication">startApplication</a>().</p>
+<p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%">
+<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
+<tr><td valign="top"><tt>QSystemTest::NoFlag</tt></td><td align="center" valign="top"><tt>0x00</tt></td><td valign="top">Don't apply any of the below flags.</td></tr>
+<tr><td valign="top"><tt>QSystemTest::WaitForFocus</tt></td><td align="center" valign="top"><tt>0x01</tt></td><td valign="top">Wait for the application to gain keyboard focus before returning.</td></tr>
+<tr><td valign="top"><tt>QSystemTest::BackgroundCurrentApplication</tt></td><td align="center" valign="top"><tt>0x02</tt></td><td valign="top">Use multitasking to background the current application. The default behaviour is to exit the current application.</td></tr>
+</table></p>
+<p>The StartApplicationFlags type is a typedef for <a href="qflags.html">QFlags</a>&lt;StartApplicationFlag&gt;. It stores an OR combination of StartApplicationFlag values.</p>
+<h3 class="flags"><a name="StateFlag-enum"></a>enum QSystemTest::StateFlag<br />flags QSystemTest::State</h3>
+<p>The State type is a typedef for <a href="qflags.html">QFlags</a>&lt;StateFlag&gt;. It stores an OR combination of StateFlag values.</p>
+<h3 class="fn"><a name="StringArray-typedef"></a>typedef StringArray</h3>
+<p>An <a href="qsystemtest.html#Array-typedef">Array</a> object in which every element is a String.</p>
+<hr />
+<h2>Function Documentation</h2>
+<h3 class="fn"><a name="Q_ENUMS"></a>QSystemTest::Q_ENUMS ( <a href="qsystemtest.html#SkipMode-enum">SkipMode</a> )</h3>
+<h3 class="fn"><a name="activate"></a>void QSystemTest::activate ( const QString &amp; <i>queryPath</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Activate the widget specified by <i>queryPath</i>. This is typically used to activate button widgets.</p>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a>.</p>
+<h3 class="fn"><a name="addExpectedMessageBox"></a>void QSystemTest::addExpectedMessageBox ( const QString &amp; <i>title</i>, const QString &amp; <i>text</i>, const QString &amp; <i>option</i> = QString() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Informs the test that a message box is expected to pop up (soon) with the given <i>title</i> and <i>text</i>. When <i>option</i> is specified <a href="qtuitest.html">QtUiTest</a> will try to activate a menu item from the softmenu that has the text specified by <i>option</i>. If a message box appears while executing a test which hasn't been marked as expected, the current test fails.</p>
+<p>When the message box appears, the user-visible <i>option</i> will be selected.</p>
+<p>Use this function when <a href="qsystemtest.html#expectMessageBox">expectMessageBox</a>() is unsuitable, e.g&#x2e; when several different types of message boxes might occur.</p>
+<p>Example:</p>
+<pre> addExpectedMessageBox(&quot;Calendar&quot;, &quot;Are you sure you want to delete:&quot;);
+ addExpectedMessageBox(&quot;Delete Event&quot;, &quot;This appointment is part of&quot;);
+ select( &quot;Delete event&quot;, optionsMenu() );
+ waitExpectedMessageBox(4000,false);
+ if (currentTitle() == &quot;Delete Event&quot;) select( &quot;Back&quot;, softMenu() )
+ else if (currentTitle() == &quot;Calendar&quot;) select( &quot;Yes&quot;, softMenu() );
+ clearExpectedMessageBoxes();</pre>
+<p>See also <a href="qsystemtest.html#expectMessageBox">expectMessageBox</a>(), <a href="qsystemtest.html#clearExpectedMessageBox">clearExpectedMessageBox</a>(), <a href="qsystemtest.html#clearExpectedMessageBoxes">clearExpectedMessageBoxes</a>(), and <a href="qsystemtest.html#waitExpectedMessageBox">waitExpectedMessageBox</a>().</p>
+<h3 class="fn"><a name="checkOS"></a>bool QSystemTest::checkOS ( const QString &amp; )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<h3 class="fn"><a name="checkState"></a>int QSystemTest::checkState ( const QString &amp; <i>queryPath</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns the checked state of the checkbox-like widget specified by <i>queryPath</i>. Checkbox-like widgets include QCheckBox and anything inheriting QAbstractButton.</p>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a>, <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>, <a href="qsystemtest.html#isChecked">isChecked</a>(), and <a href="qsystemtest.html#setCheckState">setCheckState</a>().</p>
+<h3 class="fn"><a name="clearExpectedMessageBox"></a>void QSystemTest::clearExpectedMessageBox ( const QString &amp; <i>title</i>, const QString &amp; <i>text</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Removes the message box with the given <i>title</i> and <i>text</i> from the list of expected message boxes.</p>
+<p>See also <a href="qsystemtest.html#addExpectedMessageBox">addExpectedMessageBox</a>() and <a href="qsystemtest.html#waitExpectedMessageBox">waitExpectedMessageBox</a>().</p>
+<h3 class="fn"><a name="clearExpectedMessageBoxes"></a>void QSystemTest::clearExpectedMessageBoxes ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Clears the list of expected message boxes.</p>
+<p>See also <a href="qsystemtest.html#addExpectedMessageBox">addExpectedMessageBox</a>(), <a href="qsystemtest.html#waitExpectedMessageBox">waitExpectedMessageBox</a>(), and <a href="qsystemtest.html#clearExpectedMessageBox">clearExpectedMessageBox</a>().</p>
+<h3 class="fn"><a name="compare"></a>void QSystemTest::compare ( Variant <i>actual</i>, Variant <i>expected</i> )</h3>
+<p>Verifies that <i>actual</i> is equal to <i>expected</i>. If this is not the case, the current test fails.</p>
+<p>Note that the order of <i>actual</i> and <i>expected</i> is significant, as it affects the test failure message.</p>
+<h3 class="fn"><a name="compareImage"></a>bool QSystemTest::compareImage ( const QString &amp; <i>expectedName</i>, const QString &amp; <i>queryPath</i>, const QStringList &amp; <i>maskedWidgets</i> = QStringList() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Compares the widget specified by <i>queryPath</i> against the reference snapshot <i>expectedName</i>.</p>
+<p><i>maskedWidgets</i> is a list of query paths specifying widgets to be excluded from the snapshot. This allows constantly changing widgets to be hidden from view while the snapshot is taken.</p>
+<p>Returns true if the images match, or false otherwise.</p>
+<p>The reference snapshot can be one previously learned using <a href="qsystemtest.html#verifyImage">verifyImage</a>(), or an image saved using <a href="qsystemtest.html#saveScreen">saveScreen</a>(), in which case the .png filename extension must be specified.</p>
+<p>See also <a href="qsystemtest.html#verifyImage">verifyImage</a>() and <a href="qsystemtest.html#saveScreen">saveScreen</a>().</p>
+<h3 class="fn"><a name="currentApplication"></a>QString QSystemTest::currentApplication ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns the name of the application which currently has keyboard focus. The name will be the name returned by QCoreApplication::applicationName(), which is typically the name of the executable file.</p>
+<p>Example:</p>
+<pre> compare( currentApplication(), &quot;addressbook&quot; );</pre>
+<h3 class="fn"><a name="currentTitle"></a>QString QSystemTest::currentTitle ( const QString &amp; <i>queryPath</i> = QString() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns the current window title for the application specified by <i>queryPath</i>. If <i>queryPath</i> contains a widget component, it will be ignored.</p>
+<p>Example:</p>
+<pre> startApplication(&quot;Contacts&quot;) );
+
+ ...
+
+<span class="comment"> // Make sure we are still in contacts</span>
+ compare( currentTitle(), &quot;Contacts&quot; );</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a>.</p>
+<h3 class="fn"><a name="deletePath"></a>void QSystemTest::deletePath ( const QString &amp; <i>path</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Delete <i>path</i> from the test system. Can be a file, or can be a directory tree, in which case the entire tree is recursively deleted. If <i>path</i> contains environment variables, they will be expanded on the test system.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Force test system to start with clean settings</span>
+ deletePath(&quot;$HOME/Settings&quot;);</pre>
+<p>See also <a href="qtuitest-manual.html#file-management">File Management</a>.</p>
+<h3 class="fn"><a name="enter"></a>void QSystemTest::enter ( const QVariant &amp; <i>value</i>, const QString &amp; <i>queryPath</i> = QString(), <a href="qsystemtest.html#EnterMode-enum">EnterMode</a> <i>mode</i> = Commit )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Simulates <i>value</i> being entered into the widget specified by <i>queryPath</i>.</p>
+<p>Some widgets go into an editing mode when entering text and need to be taken out of the editing mode by e.g&#x2e; a Qt::Key_Select or by navigating to another field in the dialog. By default, enter() will automatically take whatever action is necessary to commit the text and leave edit mode. Set <i>mode</i> to <a href="qsystemtest.html#EnterMode-enum">NoCommit</a> to override this.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Enter my job in &quot;Occupation&quot; field</span>
+ enter( &quot;Dog Walker&quot;, &quot;Occupation&quot; );
+
+<span class="comment"> // Enter date of birth in &quot;Birthday&quot; field</span>
+ enter( new Date(1985, 11, 10), &quot;Birthday&quot; );
+
+<span class="comment"> // Enter start time in &quot;Start&quot; field</span>
+ enter( new QTime(11, 30), &quot;Start&quot; );</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and Keypad Simulation.</p>
+<h3 class="fn"><a name="expectApplicationClose"></a>void QSystemTest::expectApplicationClose ( bool <i>value</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Indicate to the test framework if the application under test is expected to close.</p>
+<p>If <i>value</i> is true, the test framework will not report a failure when it loses its connection to the application. If <i>value</i> is false, unexpected application terminations will result in a test failure.</p>
+<p>Example:</p>
+<pre> expectApplicationClose( true );
+ select( &quot;Close&quot; ); <span class="comment">// Selecting this causes the current application to close</span>
+ expectApplicationClose( false ); <span class="comment">// Resume normal checking</span></pre>
+<h3 class="fn"><a name="expectFail"></a>void QSystemTest::expectFail ( const QString &amp; <i>reason</i> )&nbsp;&nbsp;<tt> [virtual slot]</tt></h3>
+<p>Uses the <i>reason</i> to mark the current testfunction as expected to fail.</p>
+<h3 class="fn"><a name="expectMessageBox"></a>void QSystemTest::expectMessageBox ( String <i>title</i>, String <i>text</i>, String <i>option</i>, <a href="qsystemtest.html#Number-typedef">Number</a> <i>timeout</i> )</h3>
+<p>Denotes the start of a block of code which, immediately after or during execution, should cause a message box to pop up with the given <i>title</i> and <i>text</i>. When the message box appears, the given menu <i>option</i> will be chosen from the message box softmenu bar (if one exists).</p>
+<p>If the message box hasn't appeared by the end of the block of code, the test will wait until the <i>timeout</i> expires. If it still doesn't appear, the current test fails.</p>
+<p>If a message box appears which hasn't been marked as expected, the current test fails.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Delete a contact - select &quot;Yes&quot; on the popped-up message box</span>
+<span class="comment"> // If the message box doesn't pop up, the test fails.</span>
+ expectMessageBox(&quot;Contacts&quot;, &quot;Are you sure you want to delete: &quot; + contact_name + &quot;?&quot;, &quot;Yes&quot;) {
+ select(&quot;Delete contact&quot;, optionsMenu());
+ }</pre>
+<h3 class="fn"><a name="fail"></a>void QSystemTest::fail ( String <i>message</i> )</h3>
+<p>Immediately fail the current test with the specified <i>message</i>.</p>
+<h3 class="fn"><a name="findByProperty"></a>QStringList QSystemTest::findByProperty ( const QString &amp; <i>property</i>, const QVariant &amp; <i>searchValue</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns the signatures of the widgets that have <i>property</i> matching <i>value</i>. This can be used to identify widgets that do not have an associated label text.</p>
+<p>In addition to normal QObject properties, &quot;inherits&quot; and &quot;className&quot; may also be used, with the class specified as a string.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Select the button with the tool tip &quot;Quit&quot;</span>
+<span class="comment"> // assumes that only one widget will match</span>
+ var button = findByProperty(&quot;toolTip&quot;, &quot;Quit&quot;);
+ activate(button);</pre>
+<p>If more than one widget matches, the list returned is sorted by widget position.</p>
+<p>See also <a href="qsystemtest.html#signature">signature</a>(), <a href="qtuitest-manual.html#query-paths">Query Paths</a>, and <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>.</p>
+<h3 class="fn"><a name="findByProperty-2"></a>QStringList QSystemTest::findByProperty ( const QVariantMap &amp; <i>searchValues</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns the signatures of the widgets that match all of the property values specified in <i>searchValues</i>.</p>
+<p>This can be used to identify widgets that do not have an associated label text.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Select the button with the tool tip &quot;Quit&quot;</span>
+<span class="comment"> // assumes that only one widget will match</span>
+ var button = findByProperty( {className: &quot;QToolButton&quot;,
+ toolTip: &quot;Quit&quot;} );
+ activate(button);</pre>
+<p>If more than one widget matches, the list returned is sorted by widget position.</p>
+<p>See also <a href="qsystemtest.html#signature">signature</a>(), <a href="qtuitest-manual.html#query-paths">Query Paths</a>, and <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>.</p>
+<h3 class="fn"><a name="focusWidget"></a>QString QSystemTest::focusWidget ( const QString &amp; <i>queryPath</i> = QString() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns the name of the specific widget with input focus specified by <i>queryPath</i>. If <i>queryPath</i> refers to a widget, then the name of the child widget with focus will be returned, otherwise all widgets in the specified application will be queried.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Get the currently focused widget in the current app</span>
+ print( focusWidget() );</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a>.</p>
+<h3 class="fn"><a name="getClipboardText"></a>QString QSystemTest::getClipboardText ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns text stored in the clipboard, or an empty string if the clipboard does not contain any text.</p>
+<p>See also <a href="qsystemtest.html#setClipboardText">setClipboardText</a>().</p>
+<h3 class="fn"><a name="getData"></a>QString QSystemTest::getData ( const QString &amp; <i>srcFile</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Reads <i>srcFile</i> from the test system and returns its contents. if <i>srcFile</i> contains environment variables, they will be expanded on the test system.</p>
+<p>See also <a href="qtuitest-manual.html#file-management">File Management</a>, <a href="qsystemtest.html#getFile">getFile</a>(), <a href="qsystemtest.html#putData">putData</a>(), and <a href="qsystemtest.html#putFile">putFile</a>().</p>
+<h3 class="fn"><a name="getDateTime"></a>QDateTime QSystemTest::getDateTime ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns the current date and time of the test system.</p>
+<h3 class="fn"><a name="getDirectoryEntries"></a>QStringList QSystemTest::getDirectoryEntries ( const QString &amp; <i>dir</i>, QDir::Filters <i>filters</i> = QDir::NoFilter )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>List the contents of directory <i>dir</i> on the test system, applying <i>filters</i> to the listing. If <i>dir</i> contains environment variables, they will be expanded on the test system.</p>
+<p>The returned listing will be relative to <i>dir</i>.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Delete entire contents of Documents directory on the test system</span>
+ var list = getDirectoryEntries( documentsPath(), QDir.AllEntries);
+ for (var i = 0; i &lt; list.length; ++i) {
+ deletePath( documentsPath() + list[i]);
+ }</pre>
+<p>See also QDir::entryList() and <a href="qtuitest-manual.html#file-management">File Management</a>.</p>
+<h3 class="fn"><a name="getFile"></a>void QSystemTest::getFile ( const QString &amp; <i>srcFile</i>, const QString &amp; <i>destFile</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Retrieves <i>srcFile</i> from the test system and copies it to <i>destFile</i> on the local machine. if <i>srcFile</i> contains environment variables, they will be expanded on the test system.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Copy a settings file to the local machine</span>
+ getFile(&quot;$HOME/Settings/foo.conf&quot;, &quot;/tmp/foo.conf&quot; );</pre>
+<p>See also <a href="qtuitest-manual.html#file-management">File Management</a>, <a href="qsystemtest.html#getData">getData</a>(), <a href="qsystemtest.html#putData">putData</a>(), and <a href="qsystemtest.html#putFile">putFile</a>().</p>
+<h3 class="fn"><a name="getGeometry"></a>QRect QSystemTest::getGeometry ( const QString &amp; <i>queryPath</i> = QString() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns geometry of the widget specified in <i>queryPath</i>, with position (x,y) co-ordinates being global. Note: QRect does not have toString() method, refer to QRect docs for methods returning common types.</p>
+<p>Example:</p>
+<pre><span class="comment"> // pass the test if widgets do not overlap</span>
+ var first_widget = getGeometry(&quot;Button1&quot;);
+ var second_widget = getGeometry(&quot;Button2&quot;);
+<span class="comment"> // intersects returns true on overlap, false when not; verify causes test to fail on false</span>
+ verify( !first_widget.intersects(second_widget), &quot;Specified widgets overlap.&quot;);</pre>
+<p>Example two - a non-mainstream situation:</p>
+<p><a href="qsystemtest.html#select">select</a>() may work in an undefined manner with custom widgets/items, implementing custom <a href="qsystemtest.html#select">select</a>() methods isn't ideal - each would require writing and testing. On a device with a primary input method of mouse/touchscreen there may not be key code mapping for keys which don't exist - therefore mouse events should be used. However devices may have different geometry, and widget geometry can change between invocations. The example below uses <a href="qsystemtest.html#mouseClick">mouseClick</a>() without prior geometry knowledge, though a way is needed to determine where to click, the example shows <a href="qsystemtest.html#mouseClick">mouseClick</a>() in the middle of an area defined by the 4th col and 4th row in a uniform grid of the area of the active widget.</p>
+<pre><span class="comment"> // mouseClick() a widget or item with a fixed position inside its parent widget</span>
+ var geo = getGeometry();
+ var select_x = geo.x() + (( geo.width() / 8) * 7);
+ var select_y = geo.y() + (( geo.height() / 8) * 7);
+ mouseClick(select_x, select_y);</pre>
+<p>See also <a href="qsystemtest.html#select">select</a>(), <a href="qsystemtest.html#mouseClick">mouseClick</a>(), and QRect.</p>
+<h3 class="fn"><a name="getLabels"></a>QStringList QSystemTest::getLabels ( const QString &amp; <i>queryPath</i> = QString() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns a list of all the labels that are visible in the current active window or the widget specified by <i>queryPath</i>. A label is usually a non-editable widget (such as a QLabel) that is associated with an editable field. The label is used to give the user a visual clue of the meaning of the editable field. Labels are used by the user, and by QtUitest, to navigate to fields.</p>
+<p>The items will be returned in the order they are stored in the widget, i.e&#x2e; from top to bottom.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Verify that the current dialogs contains Labels named 'Name' and 'Email'</span>
+ var g = getLabels();
+ verify( g.length == 2 );
+ verify( g.contains(&quot;Name&quot;) );
+ verify( g.contains(&quot;Email&quot;) );</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>.</p>
+<h3 class="fn"><a name="getList"></a>QStringList QSystemTest::getList ( const QString &amp; <i>queryPath</i> = QString() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns a list of all items from the list-type widget specified by <i>queryPath</i>.</p>
+<p>The items will be returned in the order they are stored in the widget (for example, for a simple list view the items will be returned from top to bottom).</p>
+<p>Example:</p>
+<pre><span class="comment"> // Verify that &quot;gender&quot; combobox contains male and female only</span>
+ var g = getList(&quot;Gender&quot;);
+ compare( g.length == 2 );
+ verify( g.contains(&quot;Male&quot;) );
+ verify( g.contains(&quot;Female&quot;) );</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>.</p>
+<h3 class="fn"><a name="getLocale"></a>QLocale QSystemTest::getLocale ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns the system locale.</p>
+<p>See also QLocale::system() and <a href="qsystemtest.html#translate">translate</a>().</p>
+<h3 class="fn"><a name="getProperty"></a>QVariant QSystemTest::getProperty ( const QString &amp; <i>queryPath</i>, const QString &amp; <i>name</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Get the value of the Qt property named <i>name</i> on object <i>queryPath</i> on the test system.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Get the text of this field without using getText()</span>
+ var t = getProperty(&quot;Name&quot;, &quot;text&quot;).toString();</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>.</p>
+<h3 class="fn"><a name="getSelectedText"></a>QString QSystemTest::getSelectedText ( const QString &amp; <i>queryPath</i> = QString() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns the currently selected text from the widget specified by <i>queryPath</i>. If no text is selected, returns all text. For list-type widgets, returns the text for the currently selected item.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Enter text in two fields, then go back to the first</span>
+<span class="comment"> // and make sure it still has the right text</span>
+ enter(&quot;Australia&quot;, &quot;Home&quot;);
+ enter(&quot;dog walker&quot;, &quot;Occupation&quot;);
+ compare( getSelectedText(&quot;Home&quot;), &quot;Australia&quot; );</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>.</p>
+<h3 class="fn"><a name="getSelectedValue"></a>QVariant QSystemTest::getSelectedValue ( const QString &amp; <i>queryPath</i> = QString() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns the currently selected value from the widget specified by <i>queryPath</i>. If no value is selected, returns all data in a single value. For list-type widgets, returns the currently selected value.</p>
+<p>See also <a href="qsystemtest.html#getSelectedText">getSelectedText</a>(), <a href="qtuitest-manual.html#query-paths">Query Paths</a>, and <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>.</p>
+<h3 class="fn"><a name="getSetting"></a>QVariant QSystemTest::getSetting ( const QString &amp; <i>file</i>, const QString &amp; <i>group</i>, const QString &amp; <i>key</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Retrieves a QSettings settings value from the test system located in <i>file</i>, settings group <i>group</i>, key <i>key</i>. If <i>file</i> contains environment variables, they will be expanded on the test system.</p>
+<p>Example:</p>
+<pre><span class="comment"> // What's our primary input mode?</span>
+ var primaryInput = getSetting(&quot;$QPEDIR/etc/defaultbuttons.conf&quot;, &quot;Device&quot;, &quot;PrimaryInput&quot;);</pre>
+<p>See also <a href="qsystemtest.html#setSetting">setSetting</a>() and QSettings.</p>
+<h3 class="fn"><a name="getSetting-2"></a>QVariant QSystemTest::getSetting ( const QString &amp; <i>organization</i>, const QString &amp; <i>application</i>, const QString &amp; <i>group</i>, const QString &amp; <i>key</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Retrieves a QSettings settings value from the test system located in the settings file for organization <i>organization</i> and application <i>application</i>, as passed to the QSettings constructor. The settings value retrieved will be group <i>group</i>, key <i>key</i>.</p>
+<p>See also <a href="qsystemtest.html#setSetting">setSetting</a>() and QSettings.</p>
+<h3 class="fn"><a name="getText"></a>QString QSystemTest::getText ( const QString &amp; <i>queryPath</i> = QString() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns all text from the widget specified by <i>queryPath</i>, or the current focus widget if <i>queryPath</i> is not specified. For list-type widgets, returns the text for all items separated by newlines.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Get current content of &quot;address&quot; field</span>
+ print( getText(&quot;Address&quot;) );</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>.</p>
+<h3 class="fn"><a name="getValue"></a>QVariant QSystemTest::getValue ( const QString &amp; <i>queryPath</i> = QString() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns the value from the widget specified by <i>queryPath</i>. For list-type widgets, returns a list containing all values.</p>
+<p>See also <a href="qsystemtest.html#getText">getText</a>(), <a href="qtuitest-manual.html#query-paths">Query Paths</a>, and <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>.</p>
+<h3 class="fn"><a name="getenv"></a>QString QSystemTest::getenv ( const QString &amp; )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<h3 class="fn"><a name="ignoreMessageBoxes"></a>void QSystemTest::ignoreMessageBoxes ( bool <i>ignore</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>If <i>ignore</i> is true, message boxes will be ignored by the test framework. Under normal circumstances during automated testing, message boxes need to be processed. However, short-lived, self dismissing message boxes may disappear before the test framework can handle them. Set <i>ignore</i> to false to resume normal processing of message boxes.</p>
+<p>See also <a href="qsystemtest.html#addExpectedMessageBox">addExpectedMessageBox</a>(), <a href="qsystemtest.html#expectMessageBox">expectMessageBox</a>(), <a href="qsystemtest.html#clearExpectedMessageBox">clearExpectedMessageBox</a>(), <a href="qsystemtest.html#clearExpectedMessageBoxes">clearExpectedMessageBoxes</a>(), and <a href="qsystemtest.html#waitExpectedMessageBox">waitExpectedMessageBox</a>().</p>
+<h3 class="fn"><a name="invokeMethod"></a>bool QSystemTest::invokeMethod ( const QString &amp; <i>queryPath</i>, const QString &amp; <i>method</i>, Qt::ConnectionType <i>type</i>, const QVariant &amp; <i>arg0</i> = QVariant(), const QVariant &amp; <i>arg1</i> = QVariant(), const QVariant &amp; <i>arg2</i> = QVariant(), const QVariant &amp; <i>arg3</i> = QVariant(), const QVariant &amp; <i>arg4</i> = QVariant(), const QVariant &amp; <i>arg5</i> = QVariant(), const QVariant &amp; <i>arg6</i> = QVariant(), const QVariant &amp; <i>arg7</i> = QVariant(), const QVariant &amp; <i>arg8</i> = QVariant(), const QVariant &amp; <i>arg9</i> = QVariant() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Invoke method <i>method</i> on object <i>queryPath</i> on the test system. Invokable methods include only Qt signals and slots.</p>
+<p>The method will be invoked using the Qt connection type <i>type</i>. This can almost always be Qt::AutoConnection, but in a few cases Qt.QueuedConnection may be necessary (for example, if executing a method that will cause Qt Extended to shutdown, Qt.QueuedConnection should be used to ensure Qt Extended sends a response to the system test before shutting down).</p>
+<p>The optional arguments <i>arg0</i>, <i>arg1</i>, <i>arg2</i>, <i>arg3</i>, <i>arg4</i>, <i>arg5</i>, <i>arg6</i>, <i>arg7</i>, <i>arg8</i> and <i>arg9</i> will be passed to the method if given.</p>
+<p>Returns true if the method could be invoked, false otherwise.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Hide this field because it keeps changing and we want a snapshot</span>
+ verify( invokeMethod(&quot;Time&quot;, &quot;setVisible(bool)&quot;, Qt.AutoConnection, false) );
+ verifyImage(&quot;good_snapshot&quot;);
+<span class="comment"> // Put the field back</span>
+ verify( invokeMethod(&quot;Time&quot;, &quot;setVisible(bool)&quot;, Qt.AutoConnection, true) );</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>.</p>
+<h3 class="fn"><a name="invokeMethod-2"></a>bool QSystemTest::invokeMethod ( const QString &amp; <i>queryPath</i>, const QString &amp; <i>method</i>, const QVariant &amp; <i>arg0</i> = QVariant(), const QVariant &amp; <i>arg1</i> = QVariant(), const QVariant &amp; <i>arg2</i> = QVariant(), const QVariant &amp; <i>arg3</i> = QVariant(), const QVariant &amp; <i>arg4</i> = QVariant(), const QVariant &amp; <i>arg5</i> = QVariant(), const QVariant &amp; <i>arg6</i> = QVariant(), const QVariant &amp; <i>arg7</i> = QVariant(), const QVariant &amp; <i>arg8</i> = QVariant(), const QVariant &amp; <i>arg9</i> = QVariant() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>This is an overloaded function.</p>
+<p>Invokes the given method using connection type Qt.AutoConnection.</p>
+<h3 class="fn"><a name="isChecked"></a>bool QSystemTest::isChecked ( const QString &amp; <i>queryPath</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns the checked state of the checkbox-like widget specified by <i>queryPath</i>. Checkbox-like widgets include QCheckBox and anything inheriting QAbstractButton.</p>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a>, <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>, <a href="qsystemtest.html#setChecked">setChecked</a>(), and <a href="qsystemtest.html#checkState">checkState</a>().</p>
+<h3 class="fn"><a name="isChecked-2"></a>bool QSystemTest::isChecked ( const QString &amp; <i>item</i>, const QString &amp; <i>queryPath</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns the checked state of <i>item</i> in the widget specified by <i>queryPath</i>.</p>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a>, <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>, <a href="qsystemtest.html#setChecked">setChecked</a>(), and <a href="qsystemtest.html#checkState">checkState</a>().</p>
+<h3 class="fn"><a name="isEnabled"></a>bool QSystemTest::isEnabled ( const QString &amp; <i>queryPath</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>The function returns whether the widget specified by <i>queryPath</i> is enabled.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Verify the AM/PM field is disabled when using 24 hour format</span>
+ select(&quot;24 hour&quot;, &quot;Time format&quot;);
+ verify( !isEnabled(&quot;AM-PM&quot;), &quot;AM-PM field still enabled.&quot; );</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>.</p>
+<h3 class="fn"><a name="isVisible"></a>bool QSystemTest::isVisible ( const QString &amp; <i>queryPath</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns true if the widget specified by <i>queryPath</i> exists and is currently visible to the user.</p>
+<p>The widget is considered to be visible to the user if QWidget::visibleRegion() returns a non-empty region. Thus, isVisible() will return true if even a single pixel of the widget is unobscured.</p>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>.</p>
+<h3 class="fn"><a name="keyClick"></a>void QSystemTest::keyClick ( Qt::Key <i>key</i>, const QString &amp; <i>queryPath</i> = QString() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Simulates a <i>key</i> click (press and release) for the application specified by <i>queryPath</i>. <i>key</i> is a string describing the key to be released.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Go right 5 times, then select</span>
+ for (int i = 0; i &lt; 5; ++i) keyClick( Qt.Key_Right );
+ keyClick( Qt.Key_Select );</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and Keypad Simulation.</p>
+<h3 class="fn"><a name="keyClickHold"></a>void QSystemTest::keyClickHold ( Qt::Key <i>key</i>, int <i>duration</i>, const QString &amp; <i>queryPath</i> = QString() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Simulates a <i>key</i> click and hold (press + wait + release) for <i>queryPath</i>. The interval between press and release is set in milliseconds by <i>duration</i>.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Hold hangup key to bring up shutdown app</span>
+ keyClickHold(Qt.Key_Hangup, 3000);</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and Keypad Simulation.</p>
+<h3 class="fn"><a name="keyPress"></a>void QSystemTest::keyPress ( Qt::Key <i>key</i>, const QString &amp; <i>queryPath</i> = QString() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Simulates a <i>key</i> press for the application specified by <i>queryPath</i>. <i>key</i> is a Qt::Key describing the key to be pressed.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Press (do not release) F23 key in current app</span>
+ keyPress( Qt.Key_F23 );</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and Keypad Simulation.</p>
+<h3 class="fn"><a name="keyRelease"></a>void QSystemTest::keyRelease ( Qt::Key <i>key</i>, const QString &amp; <i>queryPath</i> = QString() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Simulates a <i>key</i> release for the application specified by <i>queryPath</i>. <i>key</i> is a Qt::Key describing the key to be released.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Release Up key in current app</span>
+ keyRelease( Qt.Key_Up );</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and Keypad Simulation.</p>
+<h3 class="fn"><a name="labelOrientation"></a><a href="qsystemtest.html#LabelOrientation-enum">LabelOrientation</a> QSystemTest::labelOrientation ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns the label orientation, used by <a href="qtuitest.html">QtUiTest</a> to assign labels to widgets.</p>
+<p>See also <a href="qsystemtest.html#setLabelOrientation">setLabelOrientation</a>().</p>
+<h3 class="fn"><a name="mouseClick"></a>void QSystemTest::mouseClick ( int <i>x</i>, int <i>y</i>, QFlags&lt;Qt::MouseButton&gt; <i>buttons</i> = Qt::LeftButton )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Simulates a mouse click / touchscreen tap at co-ordinates ( <i>x</i>, <i>y</i> ).</p>
+<p>Example:</p>
+<pre> mouseClick(200, 300);</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and <a href="qtuitest-manual.html#mouse-touchscreen-simulation">Mouse / Touchscreen Simulation</a>.</p>
+<h3 class="fn"><a name="mouseClick-2"></a>void QSystemTest::mouseClick ( const QString &amp; <i>queryPath</i>, QFlags&lt;Qt::MouseButton&gt; <i>buttons</i> = Qt::LeftButton )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Simulates a mouse click / touchscreen tap at the center of the widget specified by <i>queryPath</i>.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Click on Accept button</span>
+ mouseClick(&quot;Accept&quot;);</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and <a href="qtuitest-manual.html#mouse-touchscreen-simulation">Mouse / Touchscreen Simulation</a>.</p>
+<h3 class="fn"><a name="mouseClickHold"></a>void QSystemTest::mouseClickHold ( int <i>x</i>, int <i>y</i>, int <i>duration</i>, QFlags&lt;Qt::MouseButton&gt; <i>buttons</i> = Qt::LeftButton )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Simulates a mouse click / touchscreen tap at co-ordinates ( <i>x</i>, <i>y</i> ), with a custom <i>duration</i> in milliseconds between press and release.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Hold at (200, 300) for three seconds</span>
+ mouseClickHold(200, 300, 3000);</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and <a href="qtuitest-manual.html#mouse-touchscreen-simulation">Mouse / Touchscreen Simulation</a>.</p>
+<h3 class="fn"><a name="mouseClickHold-2"></a>void QSystemTest::mouseClickHold ( const QString &amp; <i>queryPath</i>, int <i>duration</i>, QFlags&lt;Qt::MouseButton&gt; <i>buttons</i> = Qt::LeftButton )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Simulates a mouse click / touchscreen tap at the center of the widget specified by <i>queryPath</i>, with a custom <i>duration</i> in milliseconds between press and release.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Hold on the &quot;Shutdown&quot; button for three seconds</span>
+ mouseClickHold(&quot;Shutdown&quot;, 3000);</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and <a href="qtuitest-manual.html#mouse-touchscreen-simulation">Mouse / Touchscreen Simulation</a>.</p>
+<h3 class="fn"><a name="mousePreferred"></a>bool QSystemTest::mousePreferred ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns true if the primary input method is mouse/touchscreen.</p>
+<p>See also <a href="qsystemtest.html#setMousePreferred">setMousePreferred</a>().</p>
+<h3 class="fn"><a name="mousePress"></a>void QSystemTest::mousePress ( int <i>x</i>, int <i>y</i>, QFlags&lt;Qt::MouseButton&gt; <i>buttons</i> = Qt::LeftButton )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Simulates a mouse / touchscreen press at co-ordinates ( <i>x</i>, <i>y</i> ).</p>
+<p>Example:</p>
+<pre> mousePress(200, 300);</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and <a href="qtuitest-manual.html#mouse-touchscreen-simulation">Mouse / Touchscreen Simulation</a>.</p>
+<h3 class="fn"><a name="mousePress-2"></a>void QSystemTest::mousePress ( const QString &amp; <i>queryPath</i>, QFlags&lt;Qt::MouseButton&gt; <i>buttons</i> = Qt::LeftButton )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Simulates a mouse / touchscreen press at the center of the widget specified by <i>queryPath</i>.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Press &quot;Edit&quot; button</span>
+ mousePress(&quot;Edit&quot;);</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and <a href="qtuitest-manual.html#mouse-touchscreen-simulation">Mouse / Touchscreen Simulation</a>.</p>
+<h3 class="fn"><a name="mouseRelease"></a>void QSystemTest::mouseRelease ( int <i>x</i>, int <i>y</i>, QFlags&lt;Qt::MouseButton&gt; <i>buttons</i> = Qt::LeftButton )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Simulates a mouse / touchscreen release at co-ordinates ( <i>x</i>, <i>y</i> ).</p>
+<p>Example:</p>
+<pre> mouseRelease(200, 300);</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and <a href="qtuitest-manual.html#mouse-touchscreen-simulation">Mouse / Touchscreen Simulation</a>.</p>
+<h3 class="fn"><a name="mouseRelease-2"></a>void QSystemTest::mouseRelease ( const QString &amp; <i>queryPath</i>, QFlags&lt;Qt::MouseButton&gt; <i>buttons</i> = Qt::LeftButton )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Simulates a mouse / touchscreen release at the center of the widget specified by <i>queryPath</i>.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Release mouse over &quot;Edit&quot; button</span>
+ mouseRelease(&quot;Edit&quot;);</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and <a href="qtuitest-manual.html#mouse-touchscreen-simulation">Mouse / Touchscreen Simulation</a>.</p>
+<h3 class="fn"><a name="prompt"></a>void QSystemTest::prompt ( const QString &amp; <i>promptText</i> = QString() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Displays a dialog with the <i>promptText</i> and Pass/Fail/Record buttons, then waits for a response from the user. If Pass is clicked, the test will continue. If Fail is clicked, a failure will be generated and the current testcase will abort. If Record is clicked, event recording will start and recorded events can be appended to the testcase once recording is finished.</p>
+<p>This function is intended to be used for verification of testcases that cannot be fully automated. Testcases containing this function will be skipped if the test is run with the <tt>-auto</tt> option.</p>
+<p>Example:</p>
+<pre> prompt( &quot;Did something totally amazing just happen?&quot; );</pre>
+<h3 class="fn"><a name="putData"></a>void QSystemTest::putData ( const QByteArray &amp; <i>data</i>, const QString &amp; <i>destFile</i>, QFile::Permissions <i>permissions</i> = 0 )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Transfers <i>data</i> from the local machine and copies it to <i>destFile</i> on the test system. if <i>destFile</i> contains environment variables, they will be expanded on the test system. The file permissions of the destination file can be specified using <i>permissions</i>.</p>
+<p>See also <a href="qtuitest-manual.html#file-management">File Management</a> and <a href="qsystemtest.html#putFile">putFile</a>().</p>
+<h3 class="fn"><a name="putFile"></a>void QSystemTest::putFile ( const QString &amp; <i>srcFile</i>, const QString &amp; <i>destFile</i>, QFile::Permissions <i>permissions</i> = 0 )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Transfers <i>srcFile</i> from the local machine and copies it to <i>destFile</i> on the test system. if <i>destFile</i> contains environment variables, they will be expanded on the test system.</p>
+<p>By default, the file permissions of the destination file will be set to those of the source file. This can be overridden by specifying <i>permissions</i>.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Force test system to use certain settings</span>
+ putFile(&quot;testdata/my_settings.conf&quot;, &quot;$HOME/Settings/foo.conf&quot;);
+
+<span class="comment"> // Specify file permissions</span>
+ putFile(&quot;testdata/my_file&quot;, &quot;$HOME/my_file&quot;, QFile.WriteOwner | QFile.ReadOwner | QFile.ReadOther);</pre>
+<p>See also <a href="qtuitest-manual.html#file-management">File Management</a> and <a href="qsystemtest.html#putData">putData</a>().</p>
+<h3 class="fn"><a name="readLocalFile"></a>QString QSystemTest::readLocalFile ( const QString &amp; <i>file</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Reads text from the specified <i>file</i> and returns the contents as a QString.</p>
+<p>This can be useful when prompting the user with larger amounts of text.</p>
+<p>See also <a href="qtuitest-manual.html#file-management">File Management</a> and <a href="qsystemtest.html#prompt">prompt</a>().</p>
+<h3 class="fn"><a name="runProcess"></a>QString QSystemTest::runProcess ( const QString &amp; <i>application</i>, const QStringList &amp; <i>args</i>, const QString &amp; <i>input</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Runs <i>application</i> with arguments <i>args</i> on the local machine, with <i>input</i> given as standard input. The combined stderr and stdout text will be returned.</p>
+<p>If the process fails to run or returns a non-zero exit code, the current test fails.</p>
+<h3 class="fn"><a name="runsOnDevice"></a>bool QSystemTest::runsOnDevice ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns true if the test is running on an actual device, and false if it is running locally.</p>
+<h3 class="fn"><a name="saveScreen"></a>void QSystemTest::saveScreen ( const QString &amp; <i>name</i>, const QString &amp; <i>queryPath</i> = &quot;qpe:&quot; )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Take a full screenshot and save it as <i>name</i>. The screenshot will be placed in the test data directory in PNG format, and will automatically have .png appended to the name.</p>
+<p>This function is intended to be used as a simple way to automate the gathering of screenshots, i.e&#x2e; to be used in documentation and such.</p>
+<p>If a <i>queryPath</i> is specified the snapshot will be limited to the Widget that is identified by the queryPath.</p>
+<p>See also <a href="qsystemtest.html#verifyImage">verifyImage</a>().</p>
+<h3 class="fn"><a name="select"></a>void QSystemTest::select ( const QString &amp; <i>item</i>, const QString &amp; <i>queryPath</i> = QString() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Selects the <i>item</i> from the application/widget specified by <i>queryPath</i>. This can be used to, e.g&#x2e;, select a certain item from a list widget or combo box. select() works with widgets which are conceptually a list, including list views, combo boxes and menus.</p>
+<p>When used with a list widget, the specified item is navigated to and no further action is taken.</p>
+<p>When used with a combo box, the drop-down list is opened, the item is selected, and the drop-down list is closed again.</p>
+<p>Items in submenus are denoted using '/' delimiters (e.g&#x2e;, &quot;View/All&quot; means navigate to the &quot;View&quot; submenu, then the &quot;All&quot; item). Menu items which have a '/' in their name can be escaped using '' (e.g&#x2e; &quot;Add\/Remove Words&quot;).</p>
+<p>Example:</p>
+<pre><span class="comment"> // Select &quot;Female&quot; from &quot;Gender&quot; field</span>
+ select(&quot;Female&quot;, &quot;Gender&quot;);</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and Keypad Simulation.</p>
+<h3 class="fn"><a name="selectIndex"></a>void QSystemTest::selectIndex ( const QVariantList &amp; <i>index</i>, const QString &amp; <i>queryPath</i> = QString() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Selects the item with <i>index</i> from an indexed widget (such as a QAbstractItemView) specified by <i>queryPath</i>.</p>
+<p>This function is lower level than using <a href="qsystemtest.html#select">select</a>(), but is more appropriate when there are large numbers of items in the view, or the view contains unnamed or ambiguously named items.</p>
+<p>The <i>index</i> is specified as a list of row and column values.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Select item (row 2, column 3) from table view</span>
+ select( [2, 3], table );</pre>
+<p>The index may be hierarchical, in which case the row and column values should be specified as [row, column, parentRow, parentColumn, ..&#x2e;]&#x2e;</p>
+<p>See also <a href="qsystemtest.html#select">select</a>().</p>
+<h3 class="fn"><a name="setCheckState"></a>void QSystemTest::setCheckState ( int <i>state</i>, const QString &amp; <i>queryPath</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Sets the check state of a checkbox-like widget specified by <i>queryPath</i> to <i>state</i>. Checkbox-like widgets include QCheckBox and anything inheriting QAbstractButton.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Set tri-state button to partially checked state</span>
+ setCheckState(Qt.PartiallyChecked, &quot;Tri-state button&quot;);</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a>, <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>, <a href="qsystemtest.html#checkState">checkState</a>(), and <a href="qsystemtest.html#setChecked">setChecked</a>().</p>
+<h3 class="fn"><a name="setChecked"></a>void QSystemTest::setChecked ( bool <i>doCheck</i>, const QString &amp; <i>queryPath</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Based on the value of <i>doCheck</i> checks or un-checks a checkbox-like widget specified by <i>queryPath</i>. Checkbox-like widgets include QCheckBox and anything inheriting QAbstractButton.</p>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a>, <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>, <a href="qsystemtest.html#isChecked">isChecked</a>(), and <a href="qsystemtest.html#setCheckState">setCheckState</a>().</p>
+<h3 class="fn"><a name="setChecked-2"></a>void QSystemTest::setChecked ( bool <i>doCheck</i>, const QString &amp; <i>item</i>, const QString &amp; <i>queryPath</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Based on the value of <i>doCheck</i> checks or un-checks <i>item</i> in the widget specified by <i>queryPath</i>.</p>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a>, <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>, <a href="qsystemtest.html#isChecked">isChecked</a>(), and <a href="qsystemtest.html#setCheckState">setCheckState</a>().</p>
+<h3 class="fn"><a name="setClipboardText"></a>void QSystemTest::setClipboardText ( const QString &amp; <i>text</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Copies <i>text</i> into the clipboard.</p>
+<p>See also <a href="qsystemtest.html#getClipboardText">getClipboardText</a>().</p>
+<h3 class="fn"><a name="setLabelOrientation"></a>void QSystemTest::setLabelOrientation ( <a href="qsystemtest.html#LabelOrientation-enum">LabelOrientation</a> <i>orientation</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Set the expected label orientation to <i>orientation</i>. This value is used by <a href="qtuitest.html">QtUiTest</a> to work out which labels refer to which widgets. By default, this value is <a href="qsystemtest.html#LabelOrientation-enum">LabelLeft</a> (on left-to-right locales) or <a href="qsystemtest.html#LabelOrientation-enum">LabelRight</a> (on right-to-left locales).</p>
+<p>The setting will remain active until the application under test closes, or until the value is changed by another call to setLabelOrientation().</p>
+<p>See also <a href="qsystemtest.html#labelOrientation">labelOrientation</a>().</p>
+<h3 class="fn"><a name="setMousePreferred"></a>void QSystemTest::setMousePreferred ( bool <i>useMouse</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>If <i>useMouse</i> is true, indicates that <a href="qtuitest.html">QtUiTest</a> should use mouse/touchscreen events to select items on the screen. If false, the keyboard will be used.</p>
+<p>The setting will remain active until the application under test closes, or until the value is changed by another call to setMousePreferred().</p>
+<p>See also <a href="qsystemtest.html#mousePreferred">mousePreferred</a>().</p>
+<h3 class="fn"><a name="setProperty"></a>void QSystemTest::setProperty ( const QString &amp; <i>queryPath</i>, const QString &amp; <i>name</i>, const QVariant &amp; <i>value</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Set the Qt property named <i>name</i> on object <i>queryPath</i> to value <i>value</i> on the test system.</p>
+<p>Errors can occur in this function.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Set the text of this field without simulating key presses</span>
+ setProperty(&quot;Name&quot;, &quot;text&quot;, &quot;Billy Jones&quot;);</pre>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>.</p>
+<h3 class="fn"><a name="setSetting"></a>void QSystemTest::setSetting ( const QString &amp; <i>file</i>, const QString &amp; <i>group</i>, const QString &amp; <i>key</i>, const QVariant &amp; <i>value</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Set a QSettings settings <i>value</i> on the test system located in <i>file</i>, settings group <i>group</i>, key <i>key</i>.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Turn on english and deutsch input languages</span>
+ setSetting(&quot;$HOME/Settings/Trolltech/locale.conf&quot;, &quot;Language&quot;, &quot;InputLanguages&quot;, &quot;en_US de&quot; );</pre>
+<p>See also <a href="qsystemtest.html#getSetting">getSetting</a>() and QSettings.</p>
+<h3 class="fn"><a name="setSetting-2"></a>void QSystemTest::setSetting ( const QString &amp; <i>organization</i>, const QString &amp; <i>application</i>, const QString &amp; <i>group</i>, const QString &amp; <i>key</i>, const QVariant &amp; <i>value</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Set a QSettings settings <i>value</i> on the test system located in the settings file for the given <i>organization</i> and <i>application</i>, as passed to a QSettings constructor. The value set will be in settings group <i>group</i>, key <i>key</i>.</p>
+<p>See also <a href="qsystemtest.html#getSetting">getSetting</a>() and QSettings.</p>
+<h3 class="fn"><a name="setVisibleResponseTime"></a>void QSystemTest::setVisibleResponseTime ( int <i>time</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Sets the Visual Response Time to <i>time</i>.</p>
+<p>See also <a href="qsystemtest.html#visibleResponseTime">visibleResponseTime</a>() and <a href="qsystemtest.html#waitForTitle">waitForTitle</a>().</p>
+<h3 class="fn"><a name="signature"></a>QString QSystemTest::signature ( const QString &amp; <i>labelText</i>, int <i>offset</i> = 0 )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns the signature of the widget that is associated with <i>labelText</i>.</p>
+<p>If <i>offset</i> is a number != 0 the query will return the n'th next or previous widget (excluding labels). The widgets are ordered from top to bottom, left to right. A positive offset indicates a widget to the right or below, a negative offset indicates a widget to the left or above the label.</p>
+<p>This function can be used for situations where a field doesn't have a label associated with it.</p>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a>, <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>, and QObject::inherits().</p>
+<h3 class="fn"><a name="skip"></a>void QSystemTest::skip ( const QString &amp; <i>message</i>, <a href="qsystemtest.html#SkipMode-enum">SkipMode</a> <i>mode</i> )&nbsp;&nbsp;<tt> [virtual slot]</tt></h3>
+<p>Cause a test to skip with the given <i>message</i> and <i>mode</i>.</p>
+<h3 class="fn"><a name="startApplication"></a>void QSystemTest::startApplication ( const QString &amp; <i>application</i>, const QStringList &amp; <i>arguments</i> = QStringList(), int <i>timeout</i> = 5000, <a href="qsystemtest.html#StartApplicationFlag-enum">QSystemTest::StartApplicationFlags</a> <i>flags</i> = QSystemTest::WaitForFocus )&nbsp;&nbsp;<tt> [virtual slot]</tt></h3>
+<p>Start the specified <i>application</i>.</p>
+<p><i>application</i> is the combined path and arguments of a program to launch. The application must connect to the test framework within <i>timeout</i> ms or the test fails.</p>
+<p><i>flags</i> specifies additional behaviour.</p>
+<p>See also <a href="qtuitest-manual.html#application-management">Application Management</a>.</p>
+<h3 class="fn"><a name="strict"></a>void QSystemTest::strict ( bool <i>on</i> = true )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Switches the 'strict syntax' checking mode for the System test to <i>on</i>.</p>
+<p>In strict mode the following commands are no longer allowed and will cause an immediate failure:</p>
+<p><i>keyClick()</i> <i>keyPress()</i> <i>keyRelease()</i> <i>keyClickHold()</i></p>
+<p>Strict mode also verifies that every 'Title' change is covered by a call to <a href="qsystemtest.html#waitForTitle">waitForTitle</a>(): any action that results in a Dialog to be shown (with a different title) will cause a test failure unless a <a href="qsystemtest.html#waitForTitle">waitForTitle</a>() is called on the next line of the test script.</p>
+<h3 class="fn"><a name="tabBar"></a>void QSystemTest::tabBar ( int <i>index</i> = 0 )</h3>
+<p>Returns the signature of the tabbar widget. If multiple tabbars exist, <i>index</i> can be used to distinguish between them (sorted in order of position from top left of screen).</p>
+<p>Example:</p>
+<pre> select( &quot;Personal&quot;, tabBar() ); <span class="comment">// select the tab with text 'Personal' from the tab bar.</span>
+ print( tabBar() ); <span class="comment">// to print the signature of the tabbar widget.</span></pre>
+<p>The test will fail if no visible tabbar is found.</p>
+<h3 class="fn"><a name="translate"></a>QString QSystemTest::translate ( const QString &amp; <i>context</i>, const QString &amp; <i>text</i>, const QString &amp; <i>comment</i> = QString(), int <i>n</i> = 0 )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns the translation for <i>text</i>, from the application's installed translation files. <i>context</i> is typically a class name. If no translation is found, the <i>text</i> is returned unchanged.</p>
+<p><i>comment</i> is a disambiguating comment, for when the same sourceText is used in different roles within the same context. By default, it is null. <i>n</i> is used in conjunction with <tt>%n</tt> to support plural forms. See QObject::tr() for details.</p>
+<p>When developing test cases that use translations, it will be necessary to refer to the translator message files (<tt>.ts</tt> files), either directly or through Qt Linguist, to determine which translations are available, and the appropriate <i>context</i> to use.</p>
+<p>In some cases, translated phrases will contain argument placeholders (<tt>%1</tt>, etc) which will need to be expanded with the correct values.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Label translation</span>
+ print( translate(&quot;QFileDialog&quot;, &quot;File &amp;name:&quot;) );
+
+<span class="comment"> // Replace argument placeholders</span>
+ compare( message, translate(&quot;QHttp&quot;, &quot;Host %1 not found&quot;).replace(&quot;%1&quot;, hostname) );</pre>
+<p>See also QCoreApplication::translate() and <a href="qsystemtest.html#getLocale">getLocale</a>().</p>
+<h3 class="fn"><a name="userName"></a>QString QSystemTest::userName ()&nbsp;&nbsp;<tt> [static slot]</tt></h3>
+<p>Returns the username that is running the test on the desktop machine.</p>
+<h3 class="fn"><a name="verify"></a>void QSystemTest::verify ( <a href="qsystemtest.html#Boolean-typedef">Boolean</a> <i>condition</i>, String <i>message</i> = null )</h3>
+<p>Verifies that <i>condition</i> is true. If <i>condition</i> is not true, the current test fails. If <i>message</i> is given, it will be appended to the failure message.</p>
+<p>Example:</p>
+<pre> select(&quot;Frank&quot;, &quot;Contacts&quot;);
+ waitForTitle(&quot;Details: Frank&quot;);
+ var details = getText();
+<span class="comment"> // Verify that Frank's phone number is shown somewhere</span>
+ verify( details.contains(&quot;12345&quot;) );
+<span class="comment"> // Same, but with more details in error message</span>
+ verify( details.contains(&quot;12345&quot;), &quot;Frank's phone number is missing!&quot; );</pre>
+<h3 class="fn"><a name="verifyImage"></a>void QSystemTest::verifyImage ( const QString &amp; <i>expectedName</i>, const QString &amp; <i>queryPath</i> = QString(), const QString &amp; <i>comment</i> = QString(), const QStringList &amp; <i>maskedWidgets</i> = QStringList() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Grabs a snapshot of the widget specified by <i>queryPath</i>, and compares it against the reference snapshot <i>expectedName</i>.</p>
+<p>New snapshots are gathered by running the test in <a href="qtuitest-manual.html#learn-mode">learn mode</a>, and are stored in the <tt>testdata</tt> subdirectory of the directory containing the test script. When learn mode is used, a failed image comparison will result in a tester being presented with a manual verification dialog.</p>
+<p>If there is a mismatch between the images, the current test fails.</p>
+<p>When in learn mode, if <i>comment</i> is provided it will be shown to the user to help in determining whether or not the pixmap should be accepted.</p>
+<p><i>maskedWidgets</i> is a list of query paths specifying widgets to be excluded from the snapshot. This allows constantly changing widgets to be hidden from view while the snapshot is taken.</p>
+<p>Example:</p>
+<pre> verifyImage( &quot;task_completed&quot;, &quot;&quot;, &quot;Verify that the current task is shown with a green tick indicating completion&quot; );</pre>
+<p>See also <a href="qsystemtest.html#saveScreen">saveScreen</a>().</p>
+<h3 class="fn"><a name="visibleResponseTime"></a>int QSystemTest::visibleResponseTime ()&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Returns the currently set Visual Response Time. This time is used in <a href="qtuitest.html">QtUiTest</a> to decide whether the User Interface is responsive to user events. For instance, after selecting &quot;New Event&quot; from the options menu a user expects a dialog in which a new event can be entered. If Qt Extended does not respond in some visible way within the visual response time, the test will fail.</p>
+<p>By default the visual response time is set to 4 seconds, i.e&#x2e; any UI that doesn't respond to events within this time is considered at fault.</p>
+<p>The visibleResponseTime is also used as the default value for some queries such as <a href="qsystemtest.html#waitForTitle">waitForTitle</a>().</p>
+<p>See also <a href="qsystemtest.html#setVisibleResponseTime">setVisibleResponseTime</a>() and <a href="qsystemtest.html#waitForTitle">waitForTitle</a>().</p>
+<h3 class="fn"><a name="wait"></a>void QSystemTest::wait ( int <i>msecs</i> )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Wait for <i>msecs</i> milliseconds, while still processing events from the event loop.</p>
+<h3 class="fn"><a name="waitExpectedMessageBox"></a>bool QSystemTest::waitExpectedMessageBox ( uint <i>timeout</i>, bool <i>waitForAll</i> = true, const QString &amp; <i>title</i> = QString(), const QString &amp; <i>text</i> = QString() )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Waits for expected message boxes to occur up until a maximum of <i>timeout</i> ms. Returns true if the expected message box occurs during or before this function.</p>
+<p>It is an error to call this function for a message box which has not been passed to <a href="qsystemtest.html#expectMessageBox">expectMessageBox</a>() or <a href="qsystemtest.html#addExpectedMessageBox">addExpectedMessageBox</a>().</p>
+<p>If <i>waitForAll</i> is true (the default) ALL messageBoxes will need to be shown before the wait terminates, or else it is sufficient if any of the expected message boxes has been shown.</p>
+<p>When a <i>title</i> and <i>text</i> are specified the function will wait until that specific message box has been shown. Note that specifying a <i>title</i> and <i>text</i> only makes sense when <i>waitForAll</i> is set to false.</p>
+<p>See also <a href="qsystemtest.html#addExpectedMessageBox">addExpectedMessageBox</a>(), <a href="qsystemtest.html#clearExpectedMessageBox">clearExpectedMessageBox</a>(), <a href="qsystemtest.html#clearExpectedMessageBoxes">clearExpectedMessageBoxes</a>(), and <a href="qsystemtest.html#expectMessageBox">expectMessageBox</a>().</p>
+<h3 class="fn"><a name="waitFor"></a>void QSystemTest::waitFor ( <a href="qsystemtest.html#Number-typedef">Number</a> <i>timeout</i> = 10000, <a href="qsystemtest.html#Number-typedef">Number</a> <i>intervals</i> = 20, String <i>message</i> = null )</h3>
+<p>Denotes the start of a block of code which should be repeatedly executed until it returns true. If the block of code doesn't return true within <i>timeout</i> milliseconds, the current test fails with the given <i>message</i>.</p>
+<p><i>intervals</i> is the maximum amount of times the block of code should be executed; i.e&#x2e;, the code will be executed every <i>timeout</i> / <i>intervals</i> milliseconds.</p>
+<p>Example:</p>
+<pre> waitFor() {
+ return getList().length &gt; 0;
+ }</pre>
+<h3 class="fn"><a name="waitForTitle"></a>void QSystemTest::waitForTitle ( const QString &amp; <i>title</i>, int <i>timeout</i> = 0 )&nbsp;&nbsp;<tt> [slot]</tt></h3>
+<p>Waits for the current title to change to <i>title</i> The test fails if the current title hasn't changed to <i>title</i> within <i>timeout</i> ms.</p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-activatewidget-members.html b/doc/html/qtuitest-activatewidget-members.html
new file mode 100644
index 0000000..69e9556
--- /dev/null
+++ b/doc/html/qtuitest-activatewidget-members.html
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>List of All Members for ActivateWidget</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">List of All Members for ActivateWidget</h1>
+<p>This is the complete list of members for <a href="qtuitest-activatewidget.html">QtUiTest::ActivateWidget</a>, including inherited members.</p>
+<ul>
+<li><div class="fn"><b><a href="qtuitest-activatewidget.html#activate">activate</a></b> () : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-activatewidget.html#activated">activated</a></b> ()</div></li>
+</ul>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-activatewidget.html b/doc/html/qtuitest-activatewidget.html
new file mode 100644
index 0000000..4d6f658
--- /dev/null
+++ b/doc/html/qtuitest-activatewidget.html
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>ActivateWidget Class Reference</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">ActivateWidget Class Reference<br /><span class="small-subtitle">(QtUiTest::ActivateWidget)<br />[QtUiTestModule]</span>
+</h1>
+<p>The ActivateWidget class provides an abstract base class for all test widgets which can conceptually be &quot;activated&quot; by a user. <a href="#details">More...</a></p>
+<pre> #include &lt;<a href="qtuitest.html">QtUiTest</a>&gt;</pre><p><b>This class is under development and is subject to change.</b></p>
+<ul>
+<li><a href="qtuitest-activatewidget-members.html">List of all members, including inherited members</a></li>
+</ul>
+<hr />
+<a name="public-functions"></a>
+<h2>Public Functions</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-activatewidget.html#activate">activate</a></b> () = 0</td></tr>
+</table>
+<hr />
+<a name="signals"></a>
+<h2>Signals</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-activatewidget.html#activated">activated</a></b> ()</td></tr>
+</table>
+<a name="details"></a>
+<hr />
+<h2>Detailed Description</h2>
+<p>The ActivateWidget class provides an abstract base class for all test widgets which can conceptually be &quot;activated&quot; by a user.</p>
+<p>&quot;Activation&quot; occurs when user input causes an action, possibly non-reversible, on a widget which exists solely for the purpose of causing that action.</p>
+<p>Examples of widgets suitable for this interface include QAbstractButton.</p>
+<hr />
+<h2>Member Function Documentation</h2>
+<h3 class="fn"><a name="activate"></a>bool ActivateWidget::activate ()&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Simulate the user input necessary to activate this widget.</p>
+<p>Returns true if this widget was successfully activated.</p>
+<p>For example, a button would reimplement this function to simulate a click on itself, or to navigate to itself and hit the &quot;Select&quot; key.</p>
+<h3 class="fn"><a name="activated"></a>void ActivateWidget::activated ()&nbsp;&nbsp;<tt> [signal]</tt></h3>
+<p>This signal is emitted when this widget is activated.</p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-checkitemwidget-members.html b/doc/html/qtuitest-checkitemwidget-members.html
new file mode 100644
index 0000000..3d80600
--- /dev/null
+++ b/doc/html/qtuitest-checkitemwidget-members.html
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>List of All Members for CheckItemWidget</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">List of All Members for CheckItemWidget</h1>
+<p>This is the complete list of members for <a href="qtuitest-checkitemwidget.html">QtUiTest::CheckItemWidget</a>, including inherited members.</p>
+<ul>
+<li><div class="fn"><b><a href="qtuitest-checkitemwidget.html#isCheckable">isCheckable</a></b> ( const QString &amp; ) : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-checkitemwidget.html#isChecked">isChecked</a></b> ( const QString &amp; ) const : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-checkitemwidget.html#setChecked">setChecked</a></b> ( const QString &amp;, bool ) : bool</div></li>
+</ul>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-checkitemwidget.html b/doc/html/qtuitest-checkitemwidget.html
new file mode 100644
index 0000000..9f98b2d
--- /dev/null
+++ b/doc/html/qtuitest-checkitemwidget.html
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>CheckItemWidget Class Reference</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">CheckItemWidget Class Reference<br /><span class="small-subtitle">(QtUiTest::CheckItemWidget)<br />[QtUiTestModule]</span>
+</h1>
+<p>The CheckItemWidget class provides an abstract base class for all test widgets which include items that support 'checked' and 'unchecked' states. <a href="#details">More...</a></p>
+<pre> #include &lt;<a href="qtuitest.html">QtUiTest</a>&gt;</pre><p><b>This class is under development and is subject to change.</b></p>
+<ul>
+<li><a href="qtuitest-checkitemwidget-members.html">List of all members, including inherited members</a></li>
+</ul>
+<hr />
+<a name="public-functions"></a>
+<h2>Public Functions</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-checkitemwidget.html#isCheckable">isCheckable</a></b> ( const QString &amp; <i>item</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-checkitemwidget.html#isChecked">isChecked</a></b> ( const QString &amp; ) const = 0</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-checkitemwidget.html#setChecked">setChecked</a></b> ( const QString &amp; <i>item</i>, bool <i>state</i> ) = 0</td></tr>
+</table>
+<a name="details"></a>
+<hr />
+<h2>Detailed Description</h2>
+<p>The CheckItemWidget class provides an abstract base class for all test widgets which include items that support 'checked' and 'unchecked' states.</p>
+<p>Examples of widgets suitable for this interface include QMenu.</p>
+<hr />
+<h2>Member Function Documentation</h2>
+<h3 class="fn"><a name="isCheckable"></a>bool CheckItemWidget::isCheckable ( const QString &amp; <i>item</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns true if <i>item</i> can be checked (has a selectable on/off state).</p>
+<h3 class="fn"><a name="isChecked"></a>bool CheckItemWidget::isChecked ( const QString &amp; ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<h3 class="fn"><a name="setChecked"></a>bool CheckItemWidget::setChecked ( const QString &amp; <i>item</i>, bool <i>state</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Set the check state of the <i>item</i>. Returns false if the check state cannot be set.</p>
+<p>See also <a href="qtuitest-checkitemwidget.html#isChecked">isChecked</a>().</p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-checkwidget-members.html b/doc/html/qtuitest-checkwidget-members.html
new file mode 100644
index 0000000..740fd06
--- /dev/null
+++ b/doc/html/qtuitest-checkwidget-members.html
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>List of All Members for CheckWidget</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">List of All Members for CheckWidget</h1>
+<p>This is the complete list of members for <a href="qtuitest-checkwidget.html">QtUiTest::CheckWidget</a>, including inherited members.</p>
+<ul>
+<li><div class="fn"><b><a href="qtuitest-checkwidget.html#checkState">checkState</a></b> () const : Qt::CheckState</div></li>
+<li><div class="fn"><b><a href="qtuitest-checkwidget.html#isTristate">isTristate</a></b> () const : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-checkwidget.html#setCheckState">setCheckState</a></b> ( Qt::CheckState ) : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-checkwidget.html#stateChanged">stateChanged</a></b> ( int )</div></li>
+</ul>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-checkwidget.html b/doc/html/qtuitest-checkwidget.html
new file mode 100644
index 0000000..410b4c7
--- /dev/null
+++ b/doc/html/qtuitest-checkwidget.html
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>CheckWidget Class Reference</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">CheckWidget Class Reference<br /><span class="small-subtitle">(QtUiTest::CheckWidget)<br />[QtUiTestModule]</span>
+</h1>
+<p>The CheckWidget class provides an abstract base class for all test widgets which support 'checked' and 'unchecked' states. <a href="#details">More...</a></p>
+<pre> #include &lt;<a href="qtuitest.html">QtUiTest</a>&gt;</pre><p><b>This class is under development and is subject to change.</b></p>
+<ul>
+<li><a href="qtuitest-checkwidget-members.html">List of all members, including inherited members</a></li>
+</ul>
+<hr />
+<a name="public-functions"></a>
+<h2>Public Functions</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">virtual Qt::CheckState </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-checkwidget.html#checkState">checkState</a></b> () const = 0</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-checkwidget.html#isTristate">isTristate</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-checkwidget.html#setCheckState">setCheckState</a></b> ( Qt::CheckState <i>state</i> )</td></tr>
+</table>
+<hr />
+<a name="signals"></a>
+<h2>Signals</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-checkwidget.html#stateChanged">stateChanged</a></b> ( int <i>state</i> )</td></tr>
+</table>
+<a name="details"></a>
+<hr />
+<h2>Detailed Description</h2>
+<p>The CheckWidget class provides an abstract base class for all test widgets which support 'checked' and 'unchecked' states.</p>
+<p>QtUiTest::CheckWidget exposes the current check state of widgets which can be checked or unchecked.</p>
+<p>Examples of widgets suitable for this interface include QCheckBox and QAbstractButton.</p>
+<hr />
+<h2>Member Function Documentation</h2>
+<h3 class="fn"><a name="checkState"></a>Qt::CheckState CheckWidget::checkState () const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Returns the current check state of this widget.</p>
+<p>See also QCheckBox::checkState() and <a href="qtuitest-checkwidget.html#setCheckState">setCheckState</a>().</p>
+<h3 class="fn"><a name="isTristate"></a>bool CheckWidget::isTristate () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns true if this widget has three possible states, i.e&#x2e; the widget can be in state Qt::PartiallyChecked.</p>
+<p>The base implementation returns false.</p>
+<p>See also QCheckBox::isTristate().</p>
+<h3 class="fn"><a name="setCheckState"></a>bool CheckWidget::setCheckState ( Qt::CheckState <i>state</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Simulates the user input necessary to set the current check state to <i>state</i>, returning true on success.</p>
+<p>The default implementation does nothing and returns false.</p>
+<p>See also QCheckBox::setCheckState() and <a href="qtuitest-checkwidget.html#checkState">checkState</a>().</p>
+<h3 class="fn"><a name="stateChanged"></a>void CheckWidget::stateChanged ( int <i>state</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
+<p>This signal is emitted when the check state of this widget changes to <i>state</i>. <i>state</i> is compatible with Qt::CheckState.</p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-indexedwidget-members.html b/doc/html/qtuitest-indexedwidget-members.html
new file mode 100644
index 0000000..5cf2e32
--- /dev/null
+++ b/doc/html/qtuitest-indexedwidget-members.html
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>List of All Members for IndexedWidget</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">List of All Members for IndexedWidget</h1>
+<p>This is the complete list of members for <a href="qtuitest-indexedwidget.html">QtUiTest::IndexedWidget</a>, including inherited members.</p>
+<ul>
+<li><div class="fn"><b><a href="qtuitest-indexedwidget.html#selectIndex">selectIndex</a></b> ( const QVariantList &amp; ) : bool</div></li>
+</ul>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-indexedwidget.html b/doc/html/qtuitest-indexedwidget.html
new file mode 100644
index 0000000..5b0d716
--- /dev/null
+++ b/doc/html/qtuitest-indexedwidget.html
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>IndexedWidget Class Reference</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">IndexedWidget Class Reference<br /><span class="small-subtitle">(QtUiTest::IndexedWidget)<br />[QtUiTestModule]</span>
+</h1>
+<p>The IndexedWidget class provides an abstract base class for all test widgets which allow the user to select items based on index. <a href="#details">More...</a></p>
+<pre> #include &lt;<a href="qtuitest.html">QtUiTest</a>&gt;</pre><p><b>This class is under development and is subject to change.</b></p>
+<ul>
+<li><a href="qtuitest-indexedwidget-members.html">List of all members, including inherited members</a></li>
+</ul>
+<hr />
+<a name="public-functions"></a>
+<h2>Public Functions</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-indexedwidget.html#selectIndex">selectIndex</a></b> ( const QVariantList &amp; <i>index</i> )</td></tr>
+</table>
+<a name="details"></a>
+<hr />
+<h2>Detailed Description</h2>
+<p>The IndexedWidget class provides an abstract base class for all test widgets which allow the user to select items based on index.</p>
+<p>Examples of widgets suitable for this interface include QAbstractItemView.</p>
+<p>See also <a href="qtuitest-listwidget.html">QtUiTest::ListWidget</a> and <a href="qtuitest-selectwidget.html">QtUiTest::SelectWidget</a>.</p>
+<hr />
+<h2>Member Function Documentation</h2>
+<h3 class="fn"><a name="selectIndex"></a>bool IndexedWidget::selectIndex ( const QVariantList &amp; <i>index</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Selects the item with the specified <i>index</i> from an item view. The index should be specified in QtScript as an array, in the form [parentRow, parentColumn, ..&#x2e;, row, column].</p>
+<p>This function can be used in situations where <a href="qsystemtest.html#select">select()</a> would be inappropriate, typically in larger, more complex item views or those containing items with duplicate names.</p>
+<pre><span class="comment"> // Select row 3, column 5 from tableView</span>
+ selectIndex([3, 5], tableView);
+
+<span class="comment"> // Select row 2, column 4 beneath parent item at row 1, column 0 from treeView</span>
+ selectIndex([1, 0, 2, 4], treeView);</pre>
+<p>See also select().</p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-inputwidget-members.html b/doc/html/qtuitest-inputwidget-members.html
new file mode 100644
index 0000000..636a8d4
--- /dev/null
+++ b/doc/html/qtuitest-inputwidget-members.html
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>List of All Members for InputWidget</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">List of All Members for InputWidget</h1>
+<p>This is the complete list of members for <a href="qtuitest-inputwidget.html">QtUiTest::InputWidget</a>, including inherited members.</p>
+<ul>
+<li><div class="fn"><b><a href="qtuitest-inputwidget.html#canEnter">canEnter</a></b> ( const QVariant &amp; ) const : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-inputwidget.html#enter">enter</a></b> ( const QVariant &amp;, bool ) : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-inputwidget.html#entered">entered</a></b> ( const QVariant &amp; )</div></li>
+</ul>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-inputwidget.html b/doc/html/qtuitest-inputwidget.html
new file mode 100644
index 0000000..e4aab40
--- /dev/null
+++ b/doc/html/qtuitest-inputwidget.html
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>InputWidget Class Reference</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">InputWidget Class Reference<br /><span class="small-subtitle">(QtUiTest::InputWidget)<br />[QtUiTestModule]</span>
+</h1>
+<p>The InputWidget class provides an abstract base class for all test widgets which allow the user to input text. <a href="#details">More...</a></p>
+<pre> #include &lt;<a href="qtuitest.html">QtUiTest</a>&gt;</pre><p><b>This class is under development and is subject to change.</b></p>
+<p>Inherited by </p>
+<ul>
+<li><a href="qtuitest-inputwidget-members.html">List of all members, including inherited members</a></li>
+</ul>
+<hr />
+<a name="public-functions"></a>
+<h2>Public Functions</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-inputwidget.html#canEnter">canEnter</a></b> ( const QVariant &amp; <i>item</i> ) const = 0</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-inputwidget.html#enter">enter</a></b> ( const QVariant &amp; <i>item</i>, bool <i>noCommit</i> ) = 0</td></tr>
+</table>
+<hr />
+<a name="signals"></a>
+<h2>Signals</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-inputwidget.html#entered">entered</a></b> ( const QVariant &amp; <i>item</i> )</td></tr>
+</table>
+<a name="details"></a>
+<hr />
+<h2>Detailed Description</h2>
+<p>The InputWidget class provides an abstract base class for all test widgets which allow the user to input text.</p>
+<p>QtUiTest::InputWidget encapsulates a widget in which a user may enter and remove text. This is closely related to <a href="qtuitest-textwidget.html">QtUiTest::TextWidget</a>, which provides an interface for retrieving text from a widget. Any widgets which contain user-editable text will typically implement both QtUiTest::InputWidget and <a href="qtuitest-textwidget.html">QtUiTest::TextWidget</a>.</p>
+<p>Examples of widgets suitable for this interface include QLineEdit and QTextEdit.</p>
+<p>See also <a href="qtuitest-textwidget.html">QtUiTest::TextWidget</a>.</p>
+<hr />
+<h2>Member Function Documentation</h2>
+<h3 class="fn"><a name="canEnter"></a>bool InputWidget::canEnter ( const QVariant &amp; <i>item</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Returns true if <i>item</i> can possibly be entered into this widget.</p>
+<p>For example, for a QLineEdit, QLineEdit::validator() would be used to ensure that item.toString() constitutes valid input for this line edit.</p>
+<h3 class="fn"><a name="enter"></a>bool InputWidget::enter ( const QVariant &amp; <i>item</i>, bool <i>noCommit</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Simulates the user input necessary to enter <i>item</i> into this widget. Returns true on success.</p>
+<p><i>item</i> can potentially be any type representable in a QVariant. Most widgets will only be interested in text, in which case item.toString() can be called to retrieve a string. Examples of widgets which may handle types other than text are QDateEdit and QTimeEdit, which may handle dates and times.</p>
+<p>If <i>noCommit</i> is true, no attempt is made to commit the input (for example, by clicking the Select key). Normally this value will be false, which will result in the input being committed. This value is not applicable to all widget types.</p>
+<p>If <a href="qtuitest-inputwidget.html#canEnter">canEnter</a>() returns true and this function returns false, an error has occurred and this widget is left in an undefined state.</p>
+<h3 class="fn"><a name="entered"></a>void InputWidget::entered ( const QVariant &amp; <i>item</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
+<p>This signal is emitted when <i>item</i> is entered into the widget by the user.</p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-labelwidget-members.html b/doc/html/qtuitest-labelwidget-members.html
new file mode 100644
index 0000000..2bb92c1
--- /dev/null
+++ b/doc/html/qtuitest-labelwidget-members.html
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>List of All Members for LabelWidget</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">List of All Members for LabelWidget</h1>
+<p>This is the complete list of members for <a href="qtuitest-labelwidget.html">QtUiTest::LabelWidget</a>, including inherited members.</p>
+<ul>
+<li><div class="fn"><b><a href="qtuitest-labelwidget.html#buddy">buddy</a></b> () const : QObject *</div></li>
+<li><div class="fn"><b><a href="qtuitest-labelwidget.html#labelText">labelText</a></b> () const : QString</div></li>
+</ul>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-labelwidget.html b/doc/html/qtuitest-labelwidget.html
new file mode 100644
index 0000000..e5956c8
--- /dev/null
+++ b/doc/html/qtuitest-labelwidget.html
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>LabelWidget Class Reference</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">LabelWidget Class Reference<br /><span class="small-subtitle">(QtUiTest::LabelWidget)<br />[QtUiTestModule]</span>
+</h1>
+<p>The LabelWidget class provides an abstract base class for all test widgets which are conceptually labels. <a href="#details">More...</a></p>
+<pre> #include &lt;<a href="qtuitest.html">QtUiTest</a>&gt;</pre><p><b>This class is under development and is subject to change.</b></p>
+<ul>
+<li><a href="qtuitest-labelwidget-members.html">List of all members, including inherited members</a></li>
+</ul>
+<hr />
+<a name="public-functions"></a>
+<h2>Public Functions</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">virtual QObject * </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-labelwidget.html#buddy">buddy</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QString </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-labelwidget.html#labelText">labelText</a></b> () const = 0</td></tr>
+</table>
+<a name="details"></a>
+<hr />
+<h2>Detailed Description</h2>
+<p>The LabelWidget class provides an abstract base class for all test widgets which are conceptually labels.</p>
+<p>Some widgets may act as labels for themselves while also providing other functionality. For example, a button widget labels itself and is also an <a href="qtuitest-activatewidget.html">ActivateWidget</a>.</p>
+<p>Examples of widgets suitable for this interface include QLabel.</p>
+<hr />
+<h2>Member Function Documentation</h2>
+<h3 class="fn"><a name="buddy"></a>QObject * LabelWidget::buddy () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns the label's buddy widget, or 0 if this widget has no buddy. The buddy-label relationship is used by <a href="qtuitest.html">QtUiTest</a> as part of query path resolution.</p>
+<p>The returned object may be an actual QWidget, or may be a wrapping test widget. Therefore, the only safe way to use the returned value of this function is to cast it to the desired <a href="qtuitest.html">QtUiTest</a> interface using <a href="qtuitest.html">qtuitest_cast</a>.</p>
+<p>See also QLabel::buddy(), <a href="qtuitest-manual.html#query-paths">Query Paths</a>, and <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>.</p>
+<h3 class="fn"><a name="labelText"></a>QString LabelWidget::labelText () const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Returns the text displayed on this label.</p>
+<p>Most label widgets will also implement <a href="qtuitest-textwidget.html">QtUiTest::TextWidget</a>. Most commonly, labelText() returns the same value as <a href="qtuitest-textwidget.html#text">QtUiTest::TextWidget::text</a>().</p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-listwidget-members.html b/doc/html/qtuitest-listwidget-members.html
new file mode 100644
index 0000000..1097cd8
--- /dev/null
+++ b/doc/html/qtuitest-listwidget-members.html
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>List of All Members for ListWidget</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">List of All Members for ListWidget</h1>
+<p>This is the complete list of members for <a href="qtuitest-listwidget.html">QtUiTest::ListWidget</a>, including inherited members.</p>
+<ul>
+<li><div class="fn"><b><a href="qtuitest-listwidget.html#ensureVisible">ensureVisible</a></b> ( const QString &amp; ) : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-listwidget.html#list">list</a></b> () const : QStringList</div></li>
+<li><div class="fn"><b><a href="qtuitest-listwidget.html#visualRect">visualRect</a></b> ( const QString &amp; ) const : QRect</div></li>
+</ul>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-listwidget.html b/doc/html/qtuitest-listwidget.html
new file mode 100644
index 0000000..576e3bb
--- /dev/null
+++ b/doc/html/qtuitest-listwidget.html
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>ListWidget Class Reference</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">ListWidget Class Reference<br /><span class="small-subtitle">(QtUiTest::ListWidget)<br />[QtUiTestModule]</span>
+</h1>
+<p>The ListWidget class provides an abstract base class for all test widgets which display a list of items to the user. <a href="#details">More...</a></p>
+<pre> #include &lt;<a href="qtuitest.html">QtUiTest</a>&gt;</pre><p><b>This class is under development and is subject to change.</b></p>
+<ul>
+<li><a href="qtuitest-listwidget-members.html">List of all members, including inherited members</a></li>
+</ul>
+<hr />
+<a name="public-functions"></a>
+<h2>Public Functions</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-listwidget.html#ensureVisible">ensureVisible</a></b> ( const QString &amp; <i>item</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QStringList </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-listwidget.html#list">list</a></b> () const = 0</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QRect </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-listwidget.html#visualRect">visualRect</a></b> ( const QString &amp; <i>item</i> ) const = 0</td></tr>
+</table>
+<a name="details"></a>
+<hr />
+<h2>Detailed Description</h2>
+<p>The ListWidget class provides an abstract base class for all test widgets which display a list of items to the user.</p>
+<p>QtUiTest::ListWidget allows a widget which is conceptually a list to be enumerated. This is closely related to <a href="qtuitest-selectwidget.html">QtUiTest::SelectWidget</a>, which may be implemented to allow a user to select an item from a list.</p>
+<p>Examples of widgets suitable for this interface include QAbstractItemView, QComboBox and QMenu.</p>
+<p>See also <a href="qtuitest-selectwidget.html">QtUiTest::SelectWidget</a>.</p>
+<hr />
+<h2>Member Function Documentation</h2>
+<h3 class="fn"><a name="ensureVisible"></a>bool ListWidget::ensureVisible ( const QString &amp; <i>item</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Simulates the user input necessary to navigate this widget until <i>item</i> is currently visible and return true on success.</p>
+<p>For example, in a QAbstractItemView with vertical scrollbars, if <i>item</i> exists further down the list than currently shown, this function might simulate 'Down' key clicks until it becomes visible.</p>
+<p>The base implementation does nothing and returns true.</p>
+<h3 class="fn"><a name="list"></a>QStringList ListWidget::list () const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Returns a list containing a text representation of each item in this list widget.</p>
+<h3 class="fn"><a name="visualRect"></a>QRect ListWidget::visualRect ( const QString &amp; <i>item</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Returns the bounding rect of <i>item</i>, in widget coordinates. If <i>item</i> isn't currently shown in this widget, returns a null rect.</p>
+<p>See also QAbstractItemView::visualRect().</p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-manual.html b/doc/html/qtuitest-manual.html
new file mode 100644
index 0000000..946f903
--- /dev/null
+++ b/doc/html/qtuitest-manual.html
@@ -0,0 +1,290 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../doc/src/qtuitest_manual.qdoc -->
+<head>
+ <title>QtUiTest Manual</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">QtUiTest Manual<br /><span class="subtitle"></span>
+</h1>
+<p>The <a href="qtuitest.html">QtUiTest</a> framework is a tool for automatic and semi-automatic User Interface/System level testing of Qt based applications and libraries. <a href="qtuitest.html">QtUiTest</a> provides functionality commonly found in system test frameworks but with a focus on maintainable cross-platform tests.</p>
+<p>Contents: <ul><li><a href="#introduction">Introduction</a></li>
+<li><a href="#the-scripting-language">The Scripting Language</a></li>
+<ul><li><a href="#language-design-philosophy">Language design philosophy</a></li>
+</ul>
+<li><a href="#using-qtuitest">Using QtUiTest</a></li>
+<ul><li><a href="#creating-a-test">Creating a Test</a></li>
+<ul><li><a href="#writing-a-manual-system-test">Writing a Manual System Test</a></li>
+</ul>
+<li><a href="#running-a-test">Running a Test</a></li>
+<ul><li><a href="#running-tests-in-a-continuous-integration-system">Running tests in a Continuous Integration System</a></li>
+</ul>
+<li><a href="#qtuitest-tutorial">QtUiTest Tutorial</a></li>
+</ul>
+<li><a href="#qtuitest-api-overview">QtUiTest API Overview</a></li>
+<ul><li><a href="#system-architecture">System Architecture</a></li>
+<li><a href="#query-paths">Query Paths</a></li>
+<ul><li><a href="#labels">Labels</a></li>
+<li><a href="#signatures">Signatures</a></li>
+<li><a href="#querying-widgets-by-property">Querying Widgets By Property</a></li>
+</ul>
+<li><a href="#learn-mode">Learn Mode</a></li>
+<li><a href="#application-management">Application Management</a></li>
+<li><a href="#file-management">File Management</a></li>
+<li><a href="#querying-objects">Querying Objects</a></li>
+<li><a href="#text-entry-and-navigation">Text Entry and Navigation</a></li>
+<li><a href="#key-simulation">Key Simulation</a></li>
+<li><a href="#mouse-touchscreen-simulation">Mouse / Touchscreen Simulation</a></li>
+<li><a href="#other">Other</a></li>
+</ul>
+<li><a href="#extending-qtuitest-for-custom-widgets">Extending QtUiTest for Custom Widgets</a></li>
+<li><a href="#qtuitest-api-reference">QtUiTest API Reference</a></li>
+</ul>
+</p>
+<a name="introduction"></a>
+<h2>Introduction</h2>
+<p><a href="qtuitest.html">QtUiTest</a> is, by design, quite similar to the QTestLib API that is used for Unit level testing. In contrast to QTestLib however, <a href="qtuitest.html">QtUiTest</a> based tests are written in QtScript. Please refer to the QTestLib Manual if you are looking for a Unit test framework.</p>
+<p><a href="qtuitest.html">QtUiTest</a> is a scripting test language plus some basic test execution tools and as such does not provide a complete Integrated Development Environment (IDE) to write and execute tests. Tests can be written with any standard editor or development IDE. Tests can be executed from the command line or in continuous integration test systems.</p>
+<a name="the-scripting-language"></a>
+<h2>The Scripting Language</h2>
+<a name="language-design-philosophy"></a>
+<h3>Language design philosophy</h3>
+<p><a href="qtuitest.html">QtUiTest</a> aims to provide a test scripting language that is:</p>
+<ul>
+<li>simple, reliable and easy to learn,</li>
+<li>resilient to UI changes,</li>
+<li>transparent to device changes (i.e&#x2e; a touchscreen and keyboard based device should run the same test),</li>
+<li>suitable for performance testing.</li>
+</ul>
+<p><a href="qtuitest.html">QtUiTest</a> scripts are written from a User perspective. When a User uses a GUI application all he/she does is apply a few concepts that form the basis of using a GUI application. For instance, a button can be clicked on and then 'the text on the button' will happen.</p>
+<p>It is irrelevant to the user that the actual UI implementation uses a button. The UI could just as well have been an html page with a hyperlink in it with a similar text as on the button. In both cases, the user will 'select' the text to initiate a certain action from the application. So, today the implementation can be a button, tomorrow it can be a hyperlink, the day after tomorrow it can be something that hasn't been invented yet: the principle remains the same.</p>
+<p>So conceptually a user does not 'click' keys, but rather uses the concept of a button to 'select' an action or hits keys on a real or virtual keyboard to 'enter' text. The user wants something to happen and has an understanding of what needs to be done to &quot;get there&quot;.</p>
+<p>On a new system a user first needs to learn the User Manual. The more the system behaves in a way the user already knows, and the more the system provides functionality in a way the user can predict, the more &quot;Intuitive&quot; and &quot;Usable&quot; the system is experienced by the user.</p>
+<p>System testing is, in our view, very much related to these fundamental issues and just like a real user, <a href="qtuitest.html">QtUiTest</a> understands the UI concepts that form the foundation of a UI application and uses a simple syntax to enable the tester to describe it's Use Cases.</p>
+<p>Next to being able to write tests in a language that is as close as possible to the user experience it is also important to write maintainable code. Automating tests is well known to be major investment, and tests being broken for every small UI change, or tests that need to be modified for each slightly different device (or Operating System) are a major problem. <a href="qtuitest.html">QtUiTest</a> is designed in such a way that the script will result in good readable and understandable code which reduces the need for additional documentation, as well as tests that are platform agnostic.</p>
+<ul>
+<li>The four most important commands are <a href="qsystemtest.html#select">select()</a>, <a href="qsystemtest.html#enter">enter()</a>, <a href="qsystemtest.html#compare">compare()</a> and <a href="qsystemtest.html#verify">verify()</a>.</li>
+<li>Every command is making verification steps along the way. For instance, <a href="qsystemtest.html#enter">enter()</a> will perform a verification at the end to ensure that the text has been entered correctly.</li>
+<li>There is no need to explicitly code key clicks or mouse clicks. The usage of key/mouse clicks typically results in low level code that is difficult to understand and should only be used in exceptional cases.</li>
+<li>The test can be executed equally well with a keyboard based and/or a mouse/touchscreen based system.</li>
+<li>There is usually no need for explicit synchronisation steps such as a <a href="qsystemtest.html#wait">wait()</a>: <a href="qtuitest.html">QtUiTest</a> understands that certain actions may result in a background task and will wait automatically.</li>
+<li><a href="qtuitest.html">QtUiTest</a> uses the Labels that are visible on the screen to find the editable 'buddy fields'.</li>
+<li><a href="qtuitest.html">QtUiTest</a> is forgiving to UI changes. For instance, the user &quot;Name&quot; field may start as a simple line edit, then may become a full text edit, and finally become a combobox but all this time the test will pass without as much as a single complaint: as long as a field labeled &quot;Name&quot; exists and a text can be successfully entered into a buddy field the test is a success from user perspective.</li>
+<li>Test Data and Test Logic are separated.</li>
+</ul>
+<p><a href="#introduction">Back to QtUiTest Manual</a></p>
+<a name="using-qtuitest"></a>
+<h2>Using QtUiTest</h2>
+<a name="creating-a-test"></a>
+<h3>Creating a Test</h3>
+<p>Each System Test is stored in its own file ending with the <tt>.js</tt> extension.</p>
+<p>Within the test script, a <tt>testcase</tt> object is created containing several test functions. Within each test function, the <a href="#qtuitest-api-reference">QtUiTest API</a> scripting commands may be used, as well as standard commands provided by QtScript.</p>
+<p>Helper functions and global variables can be written outside of the testcase object.</p>
+<p>For example:</p>
+<pre> testcase = {
+ testFunction1: function() {
+ startApplication(&quot;Dog Walker&quot;);
+ select(&quot;Walk the dog...&quot;, optionsMenu());
+ compare( getText(), &quot;Dog was walked.&quot; );
+ },
+
+ testFunction2: function() {
+ var i = 1;
+ helper(i);
+ }
+ }
+
+ function helper(num) {
+ verify( num &gt; 0 );
+ ...
+ }</pre>
+<p>The project files for System tests are usually very simple, for example:</p>
+<pre> CONFIG+=systemtest
+ SOURCES+=sys_mytest.js</pre>
+<p>Adding &quot;systemtest&quot; to CONFIG enables the use of the &quot;make test&quot; command.</p>
+<p><a href="#introduction">Back to QtUiTest Manual</a></p>
+<a name="writing-a-manual-system-test"></a>
+<h4>Writing a Manual System Test</h4>
+<p>Writing a Manual System test is typically the first step in many test automation efforts. It is far better to document and run through the steps manually to check that an idea is executable (and repeatable) before time is invested in automating all steps.</p>
+<p>The downside about Manual tests is that the test is usually 'somewhere else', i.e&#x2e; in a text document or spreadsheet that isn't necessarily saved in the same version control system as the source code it tests, or in a format that can be easily merged by the version control system.</p>
+<p><a href="qtuitest.html">QtUiTest</a> integrates the Manual test process into the Automation process and makes it possible to seamlessly transition from a full Manual to a Semi-Automatic to a Full-Automatic test. All work is done in the same text file, so the intermediate steps are all recorded in the version control system for easy retrieval, merging and tracking.</p>
+<p>A Manual test is written by using the prompt() command:</p>
+<pre> my_manual_test: function()
+ {
+ prompt( &quot;* Do something\n&quot;+
+ &quot;* Do something else\n&quot;+
+ &quot;* Verify that the result is as expected&quot;);
+ }</pre>
+<p>When a System test is executed it can be a combination of fully automated and semi-automated test functions. The automated tests simply execute without user intervention and result in a PASS/FAIL/etc. A Manual test will be executed until a prompt is detected at which time a Dialog is shown on the Desktop (host) machine containing the specified prompt text. In the dialog, the stars (*) will be replaced with &quot;1:&quot;, &quot;2:&quot;, etc to indicate the steps that need to be taken in sequence. The advantage of using stars (*) in the code is that lines can be inserted/removed without having to renumber the remaining steps until the end of the prompt.</p>
+<p>The Dialog will also contain &quot;Pass&quot; and &quot;Fail&quot; buttons as well as a &quot;Record&quot; button that puts the test system into recording mode. The Pass and Fail buttons obviously must be used to indicate the result of the manual step.</p>
+<p>It is perfectly fine, and to be expected, that prompts() will be combined with automated steps. For instance, one could launch an application and then select a few menu options before arriving at the section of the test that requires manual intervention.</p>
+<p>For instance:</p>
+<pre> startApplication(&quot;Dog Walker&quot;);
+ select(&quot;Walk the dog...&quot;);
+ prompt( &quot;* Verify that the dog is having a good time&quot;);</pre>
+<p><a href="#introduction">Back to QtUiTest Manual</a></p>
+<a name="running-a-test"></a>
+<h3>Running a Test</h3>
+<p>System tests can usually be run using the command &quot;make test&quot;. Alternatively, the <a href="qtuitest.html">QtUiTest</a> Script Execution engine (qtuitestrunner) can be called directly:</p>
+<pre> qtuitestrunner &lt;scriptname&gt; &lt;options&gt;</pre>
+<p>These commands should be run on the desktop machine (host environment).</p>
+<a name="running-tests-in-a-continuous-integration-system"></a>
+<h4>Running tests in a Continuous Integration System</h4>
+<p><a href="qtuitest.html">QtUiTest</a> tests can be executed from the command line of a desktop (Host) machine and as such are perfectly suited to be executed in Continuous Integration Test Systems. The output format of the test, the testresults, can be printed to the screen or saved into a file in a number of formats (such as XML) to allow easy post processing by test-reporting and defect-tracking systems.</p>
+<p><a href="#introduction">Back to QtUiTest Manual</a></p>
+<a name="qtuitest-tutorial"></a>
+<h3>QtUiTest Tutorial</h3>
+<p>Please refer to the <a href="qtuitest-tutorial.html">QtUiTest Tutorial</a> for a detailed example about writing <a href="qtuitest.html">QtUiTest</a> test cases.</p>
+<p><a href="#introduction">Back to QtUiTest Manual</a></p>
+<a name="qtuitest-api-overview"></a>
+<h2>QtUiTest API Overview</h2>
+<p>To write a System Test, create a new file containing a test script, which defines a &quot;testcase&quot; object with one or more test functions.</p>
+<p>For example:</p>
+<pre> testcase = {
+ testFunction1: function() {
+ ...
+ },
+ testFunction2: function() {
+ ...
+ }
+ }</pre>
+<p>The testfunctions can be written with a combination of standard QtScript and special <a href="qtuitest.html">QtUiTest</a> commands, which are grouped below.</p>
+<ul>
+<li><a href="#system-architecture">System Architecture</a> - briefly describes the architecture of <a href="qtuitest.html">QtUiTest</a>.</li>
+<li><a href="#query-paths">Query Paths</a> - specifying widgets and objects to access.</li>
+<li><a href="#querying-objects">Querying Objects</a> - getting information from widgets or objects.</li>
+<li><a href="#learn-mode">Learn Mode</a> - dynamically generating test data.</li>
+<li><a href="#application-management">Application Management</a> - starting and stopping applications.</li>
+<li><a href="#file-management">File Management</a> - accessing files on the test system.</li>
+<li>Time Management - functionality to manage the system time on the device.</li>
+<li><a href="#key-simulation">Key Simulation</a> - simulating entering text, selection of items from the menus or lists, and generation of arbitrary key events.</li>
+<li><a href="#mouse-touchscreen-simulation">Mouse / Touchscreen Simulation</a> - simulating user interaction via a mouse or touchscreen.</li>
+<li><a href="#other">Other</a> - some miscellaneous functionality.</li>
+</ul>
+<a name="system-architecture"></a>
+<h3>System Architecture</h3>
+<p>The <a href="qtuitest.html">QtUiTest</a> framework is designed around a script execution engine (qtuitestrunner) that is executed on the desktop (host machine) and a set of <a href="qtuitest.html">QtUiTest</a> plugins that are loaded by the System Under Test (SUT). The plugins are running in the SUT process space, i.e&#x2e; may be running on a device, and communicate with the System Test script execution engine via a socket based communication protocol.</p>
+<p>Each test command is sent as a query to the SUT, and the script runner will be blocked until a reply is received from the SUT.</p>
+<p><a href="#introduction">Back to QtUiTest Manual</a></p>
+<a name="query-paths"></a>
+<h3>Query Paths</h3>
+<p>Most <a href="qtuitest.html">QtUiTest</a> functions use 'query paths' to identify the object on which the query needs to be performed. A query path is a string value, and is one of the following:</p>
+<ul>
+<li>a Label</li>
+<li>a Signature</li>
+</ul>
+<p><a href="#introduction">Back to QtUiTest Manual</a></p>
+<a name="labels"></a>
+<h4>Labels</h4>
+<p>A <b>Label</b> is a (usually static) text description that is associated with an editable field. In some cases, a widget is self-labelling (for example, the text property of a QPushButton), but often the label is seperate widget (usually a QLabel). The Label and Edit widgets form a &quot;buddy pair&quot;. This relationship can be hardcoded in the application, but this is not mandatory.</p>
+<p>For labels that have no buddy widget set, <a href="qtuitest.html">QtUiTest</a> resolves the buddy relationships based on relative positions of the label and edit widgets on screen. By default, for Left-to-Right languages, labels are expected to be to the left of their corresponding edit widgets (and to the right for Right-to-Left languages). However, this can be changed by using the setLabelOrientation() function.</p>
+<p>For example, the code below will enter the text &quot;dog walker&quot; in a text field next to a Label with text &quot;Occupation&quot;.</p>
+<pre> enter( &quot;dog walker&quot;, &quot;Occupation&quot; );</pre>
+<p>In words the example says: &quot;enter the text 'dog walker' into a field labeled 'Occupation'.</p>
+<p>A special case of a Label is an empty string. This will resolve to the widget that currently has focus, or (for touchscreen devices) the first field in the dialog. Note that for tests that should run both on keyboard and touchscreen devices it may be risky to rely on this feature. Always explicitly specifying a Label is the most safe and portable thing to do.</p>
+<p>Using a Label to identify a field is the preferred mechanism for identifying fields. It is reliable, easy to write, easy to understand and easy to debug.</p>
+<p><a href="#introduction">Back to QtUiTest Manual</a></p>
+<a name="signatures"></a>
+<h4>Signatures</h4>
+<p>In some cases it is not possible to use a label to uniquely identify a widget. In these cases it is necessary to use a <b>Signature</b> to identify the widget.</p>
+<p>A Signature is a string that uniquely identifies an object. Signatures are generated by the system at run-time; the signature of a widget will be different each time a test is run, so it is not possible to hard-code a signature value in a test case.</p>
+<p>The signature() function can be used to return the signature of an object based on its position relative to another widget.</p>
+<pre> enter( &quot;dog walker&quot;, signature(&quot;Label&quot;,1));</pre>
+<p>In this case, the signature() function returns the first editable field to the right of or below the field associated with label &quot;Label&quot;.</p>
+<a name="querying-widgets-by-property"></a>
+<h4>Querying Widgets By Property</h4>
+<p>Widgets can also be specified using the findByProperty() function. This finds all widgets that match the specified property values, sorted by position (top left to bottom right). The values returned are returned as a QStringList of signatures. In addition to the properties supported by the widget, &quot;className&quot; and &quot;inherits&quot; are also supported. The &quot;className&quot; matches if the specified value matches the class name of the object; &quot;inherits&quot; matches if the class of the object inherits the specified class name.</p>
+<p>For example:</p>
+<pre> var toolButtons = findByProperty( { className: &quot;QToolButton&quot; } );
+ ...
+ select (toolButtons[3]);
+ var addNewPage = findByProperty( { tooltip: &quot;Add new page&quot; } );</pre>
+<p>Multiple property value may be specified, for example:</p>
+<pre> var password = findByProperty( { className: &quot;QLineEdit&quot;, echoMode: 2 } );</pre>
+<p>Using findByProperty requires some knowledge of the inner workings of the application under test, and as such breaks some of the principles of black-box testing. It is recommended that, where possible, logic using findByProperty should be wrapped in a utility function, which can be called by the test case.</p>
+<p><a href="#introduction">Back to QtUiTest Manual</a></p>
+<a name="learn-mode"></a>
+<h3>Learn Mode</h3>
+<p>Some testcases require the existence of non-volatile test data, such as screen snapshots. To simplify the process of data gathering, the test system supports the concept of a learn mode. When a test is run in learn mode, certain actions will result in the generation of test data, which will be presented to the user to manually verify once, then stored for use in subsequent test runs. A system test is run in learn mode by supplying the <tt>-learn</tt> or <tt>-learn-all</tt> command line options.</p>
+<p>The system test framework will store generated test data in the <tt>testdata</tt> subdirectory of the directory containing the test script.</p>
+<p>NOTE: It is up to the tester to ensure that new learned elements are added to a version control system.</p>
+<p><a href="#introduction">Back to QtUiTest Manual</a></p>
+<a name="application-management"></a>
+<h3>Application Management</h3>
+<ul>
+<li><a href="qsystemtest.html#startApplication">startApplication()</a> - start an application.</li>
+</ul>
+<p><a href="#introduction">Back to QtUiTest Manual</a></p>
+<a name="file-management"></a>
+<h3>File Management</h3>
+<p>It is possible to access files on the System Under Test (even if this is another device) from within a system test.</p>
+<ul>
+<li><a href="qsystemtest.html#putFile">putFile()</a>, <a href="qsystemtest.html#putData">putData()</a> - copy data to the test system.</li>
+<li><a href="qsystemtest.html#deletePath">deletePath()</a> - delete files from the test system.</li>
+<li><a href="qsystemtest.html#getDirectoryEntries">getDirectoryEntries()</a> - read the contents of a directory on the test system.</li>
+</ul>
+<p><a href="#introduction">Back to QtUiTest Manual</a></p>
+<a name="querying-objects"></a>
+<h3>Querying Objects</h3>
+<p>The system test framework provides powerful methods of obtaining information on particular objects and widgets in the system.</p>
+<ul>
+<li><a href="qsystemtest.html#isVisible">isVisible()</a>, <a href="qsystemtest.html#isChecked">isChecked()</a>, <a href="qsystemtest.html#isEnabled">isEnabled()</a> - retrieve simple information from widgets.</li>
+<li><a href="qsystemtest.html#getText">getText()</a>, <a href="qsystemtest.html#getSelectedText">getSelectedText()</a> - retrieve a textual representation of widgets.</li>
+<li><a href="qsystemtest.html#getProperty">getProperty()</a>, <a href="qsystemtest.html#setProperty">setProperty()</a>, <a href="qsystemtest.html#invokeMethod">invokeMethod()</a> - access Qt properties, signals and slots on any QObject.</li>
+</ul>
+<p><a href="#introduction">Back to QtUiTest Manual</a></p>
+<a name="text-entry-and-navigation"></a>
+<h3>Text Entry and Navigation</h3>
+<p>The system test framework provides several ways of entering text into widgets and for navigating through applications.</p>
+<ul>
+<li><a href="qsystemtest.html#enter">enter()</a> - navigate to a widget and enter any text.</li>
+<li><a href="qsystemtest.html#select">select()</a> - choose a particular item from a list, combo box, menu or navigate to a particular widget or tab.</li>
+</ul>
+<p>These functions are input method independant and will have the same syntax for both Keyboard and Mouse/Touchscreen based devices and are therefore the preferred commands to use in tests.</p>
+<p><a href="#introduction">Back to QtUiTest Manual</a></p>
+<a name="key-simulation"></a>
+<h3>Key Simulation</h3>
+<p>The system test framework provides several ways of generating arbitrary key events.</p>
+<ul>
+<li><a href="qsystemtest.html#keyPress">keyPress()</a>, <a href="qsystemtest.html#keyRelease">keyRelease()</a>, <a href="qsystemtest.html#keyRelease">keyRelease()</a>, <a href="qsystemtest.html#keyClickHold">keyClickHold()</a> - press/release/click/hold any key.</li>
+</ul>
+<p>Note that Key simulation should be used in exceptional cases only since it makes the test specific for keyboard based devices. Other functions such as select() are the preferred mechanism to write tests because these will work both for Keyboard and Mouse/Touchscreen based devices.</p>
+<p><a href="#introduction">Back to QtUiTest Manual</a></p>
+<a name="mouse-touchscreen-simulation"></a>
+<h3>Mouse / Touchscreen Simulation</h3>
+<p>The system test framework provides methods to simulate input from a mouse or touchscreen.</p>
+<ul>
+<li><a href="qsystemtest.html#mousePress">mousePress()</a>, <a href="qsystemtest.html#mouseRelease">mouseRelease()</a>, <a href="qsystemtest.html#mouseClick">mouseClick()</a>, <a href="qsystemtest.html#mouseClickHold">mouseClickHold()</a> - press/release/click with mouse or touchscreen.</li>
+</ul>
+<p>Note that Mouse simulation should be used in exceptional cases only since it makes the test specific for mouse/touchscreen based devices. Other functions such as select() are the preferred mechanism to write tests because these will work both for Keyboard and Mouse/Touchscreen based devices.</p>
+<p><a href="#introduction">Back to QtUiTest Manual</a></p>
+<a name="other"></a>
+<h3>Other</h3>
+<p>Some functionality does not fall into the aforementioned categories:</p>
+<ul>
+<li><a href="qsystemtest.html#setSetting">setSetting()</a>, <a href="qsystemtest.html#getSetting">getSetting()</a> - access any settings stored within QSettings objects.</li>
+</ul>
+<p><a href="#introduction">Back to QtUiTest Manual</a></p>
+<a name="extending-qtuitest-for-custom-widgets"></a>
+<h2>Extending QtUiTest for Custom Widgets</h2>
+<p><a href="qtuitest.html">QtUiTest</a>'s high-level commands require knowledge of the widgets they interact with. For example, <a href="qsystemtest.html#select">select()</a> must know how to select items from both a combobox and a list view.</p>
+<p>When testing an application which uses custom widgets, some additional steps may be required in order to use high-level <a href="qtuitest.html">QtUiTest</a> commands. The logic for interacting with custom widgets must be implemented either in the application under test or in a plugin.</p>
+<p>See <a href="qtuitest-plugins.html">Creating a QtUiTest Test Widget</a> for more details.</p>
+<p><a href="#introduction">Back to QtUiTest Manual</a></p>
+<a name="qtuitest-api-reference"></a>
+<h2>QtUiTest API Reference</h2>
+<p>For a complete description of the <a href="qtuitest.html">QtUiTest</a> API please refer to <a href="qsystemtest.html">QSystemTest API</a>.</p>
+<p><a href="#introduction">Back to QtUiTest Manual</a></p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-plugins.html b/doc/html/qtuitest-plugins.html
new file mode 100644
index 0000000..0626397
--- /dev/null
+++ b/doc/html/qtuitest-plugins.html
@@ -0,0 +1,219 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../doc/src/qtuitest_plugins.qdoc -->
+<head>
+ <title>Creating a QtUiTest Test Widget</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">Creating a QtUiTest Test Widget<br /><span class="subtitle"></span>
+</h1>
+<ul><li><a href="#introduction">Introduction</a></li>
+<li><a href="#when-a-test-widget-is-required">When a Test Widget is Required</a></li>
+<li><a href="#choosing-the-right-interfaces">Choosing the Right Interfaces</a></li>
+<li><a href="#implementing-the-test-widget">Implementing the Test Widget</a></li>
+<ul><li><a href="#plugin-method">Plugin method</a></li>
+<ul><li><a href="#test-widget-class">Test widget class</a></li>
+<li><a href="#test-widget-factory">Test widget factory</a></li>
+</ul>
+<li><a href="#multiple-inheritance-method">Multiple inheritance method</a></li>
+</ul>
+</ul>
+<a name="introduction"></a>
+<h2>Introduction</h2>
+<p><a href="qtuitest.html">QtUiTest</a> provides support for simulating high-level user interface interactions. Conceptually these take the form of, for example, <i>Select 'Dog' from the widget labelled 'Animal'</i>, or <i>Enter 'Bob' into the widget labelled 'Name'</i>.</p>
+<p>Crucially, testcases do not need to specify the exact type of each widget or how to interact with it. Instead the logic for interacting with different types of widgets resides on the system under test, either alongside the implementation of each widget or in a plugin. Each class of widget which <a href="qtuitest.html">QtUiTest</a> can interact with has a corresponding wrapper class, referred to as a test widget.</p>
+<p>This document explains when a test widget must be created and how it is implemented.</p>
+<a name="when-a-test-widget-is-required"></a>
+<h2>When a Test Widget is Required</h2>
+<p><a href="qtuitest.html">QtUiTest</a> includes support for most Qt widgets. When a new type of widget is introduced, a test widget may be required.</p>
+<p>In these cases, a test widget will almost certainly have to be implemented:</p>
+<ul>
+<li>A custom widget implements painting and interaction by overriding functions such as paintEvent() and keyPressEvent().</li>
+<li>The behavior of a major user interface element has been customized (for example, a device profile is used which has a device-specific way of accepting incoming phone calls).</li>
+</ul>
+<p>In these cases, a test widget will usually not be required:</p>
+<ul>
+<li>A custom widget acts primarily as a container for standard widgets. In this case, <a href="qtuitest.html">QtUiTest</a> can interact with the contained widgets as normal.</li>
+<li>A custom widget subclasses a standard widget and correctly reimplements virtual functions. For example, a subclass of QAbstractItemView which performs custom painting with a custom model will work with no additional effort if visualRect() is implemented correctly (for mouse interaction), standard item view key event handling is used and the item model accurately reports its data.</li>
+</ul>
+<p>As an example, consider a testcase for creating a contact in the addressbook application. At one point in the testcase, we wish to set the contact's title to Doctor:</p>
+<p><tt>select(&quot;Dr&quot;, &quot;Title&quot;);</tt></p>
+<p>This requires that the widget referred to by &quot;Title&quot; implements the <a href="qtuitest-selectwidget.html">SelectWidget</a> interface. If this is not the case, the testcase fails with a failure message like the following:</p>
+<p><tt>FAIL! : sys_addressbook::creating_a_contact() ERROR: Title (QComboBox(0x80b2768)) is not a SelectWidget.</tt></p>
+<p>This error message indicates that the &quot;Title&quot; widget, which is a QComboBox, does not have any corresponding test widget which implements the <a href="qtuitest-selectwidget.html">SelectWidget</a> interface, and therefore can't have items selected from it.</p>
+<p>Note that not all errors arising from missing test widgets will be of this form.</p>
+<a name="choosing-the-right-interfaces"></a>
+<h2>Choosing the Right Interfaces</h2>
+<p>Test widgets must implement one or more of a standard set of interfaces belonging to the <a href="qtuitest.html">QtUiTest</a> namespace.</p>
+<p>Test widget interfaces map to the conceptual purpose of a widget from a user's perspective. The available interfaces are listed below:</p>
+<p><table class="generic" align="center" cellpadding="2" cellspacing="1" border="0">
+<thead><tr valign="top" class="qt-style"><th>Interface</th><th>Applies to</th><th>Examples</th></tr></thead>
+<tr valign="top" class="odd"><td><a href="qtuitest-widget.html">Widget</a></td><td>All 2D user interface elements.</td><td>QWidget</td></tr>
+<tr valign="top" class="even"><td><a href="qtuitest-activatewidget.html">ActivateWidget</a></td><td>Widgets which are activated to trigger some action.</td><td>QAbstractButton</td></tr>
+<tr valign="top" class="odd"><td><a href="qtuitest-checkwidget.html">CheckWidget</a></td><td>Widgets which can be checked and unchecked.</td><td>QCheckBox, QRadioButton</td></tr>
+<tr valign="top" class="even"><td><a href="qtuitest-textwidget.html">TextWidget</a></td><td>Widgets which display text.</td><td>QLineEdit, QTextEdit, QMenu, QAbstractItemView, QLabel, many others</td></tr>
+<tr valign="top" class="odd"><td><a href="qtuitest-inputwidget.html">InputWidget</a></td><td>Widgets which can accept text input.</td><td>QLineEdit, QTextEdit</td></tr>
+<tr valign="top" class="even"><td><a href="qtuitest-listwidget.html">ListWidget</a></td><td>Widgets which display a list of items.</td><td>QAbstractItemView, QMenu</td></tr>
+<tr valign="top" class="odd"><td><a href="qtuitest-selectwidget.html">SelectWidget</a></td><td>Widgets which allow an item to be selected from a list.</td><td>QAbstractItemView, QMenu</td></tr>
+</table></p>
+<p>Each test widget should implement all interfaces applicable to the wrapped widget. Test widgets can subclass other test widgets and reuse already-implemented interfaces. For example, the test widget for QCheckBox could inherit from the test widget for QAbstractButton to avoid having to reimplementing the <a href="qtuitest-widget.html">Widget</a>, <a href="qtuitest-textwidget.html">TextWidget</a> and <a href="qtuitest-activatewidget.html">ActivateWidget</a> interfaces again.</p>
+<p>Some test widget interfaces are strongly related and are likely to be implemented in pairs. Almost all widgets which accept text input also display the entered text, so any test widget which implements <a href="qtuitest-inputwidget.html">InputWidget</a> will usually implement <a href="qtuitest-textwidget.html">TextWidget</a>. Almost all widgets which can be selected from also display the selectable items, so any test widget which implements <a href="qtuitest-selectwidget.html">SelectWidget</a> will usually implement <a href="qtuitest-listwidget.html">ListWidget</a>.</p>
+<a name="implementing-the-test-widget"></a>
+<h2>Implementing the Test Widget</h2>
+<p>To make a new test widget visible to <a href="qtuitest.html">QtUiTest</a>, there are two separate approaches which can be taken, each with their own advantages.</p>
+<a name="plugin-method"></a>
+<h3>Plugin method</h3>
+<p>The plugin method involves adding the test widget code into a plugin which is then loaded by <a href="qtuitest.html">QtUiTest</a> at runtime. This is the most suitable method to use in most cases and the only method used for the test widgets shipped with <a href="qtuitest.html">QtUiTest</a>.</p>
+<p>Advantages to the plugin method compared to the multiple inheritance method include:</p>
+<ul>
+<li>The code for the test widget is cleanly separated from the wrapped widget and hence easy to omit from a release build without the need for <tt>#ifdef</tt>s or similar measures.</li>
+<li>It is easier to reuse test widget code because test widgets aren't directly tied to wrapped widgets.</li>
+<li>It is possible to customize the process of <a href="qtuitest-widgetfactory.html#find">finding</a> and <a href="qtuitest-widgetfactory.html#create">creating</a> test widgets.</li>
+<li>Typical multiple inheritance difficulties are avoided, such as the test widget interface API shadowing the API of the wrapped widget.</li>
+</ul>
+<a name="test-widget-class"></a>
+<h4>Test widget class</h4>
+<p>Each test widget class needs to inherit from QObject and the relevant test widget interfaces.</p>
+<p>In practice, it is common for a test widget class hierarchy to be written which closely mirrors the wrapped widget class hierarchy. This makes it possible to avoid rewriting the code for common interfaces such as <a href="qtuitest-widget.html">QtUiTest::Widget</a> many times.</p>
+<p>It is possible to subclass the test widgets shipped with <a href="qtuitest.html">QtUiTest</a>, although they are not guaranteed to remain source or binary compatible across releases. The convention used in the reference plugins to generate a test widget class name is to take the wrapped widget class name, drop any leading Q, and prefix Test. For example, the test widget wrappers for QWidget and QAbstractItemView are named TestWidget and TestAbstractItemView respectively.</p>
+<p>Using the plugin approach, while subclassing from TestWidget to avoid reimplementing the <a href="qtuitest-widget.html">QtUiTest::Widget</a> interface, would result in a class declaration like the following:</p>
+<pre> #include &lt;testwidget.h&gt;
+ class TestCustomComboBox : public TestWidget, public QtUiTest::ListWidget,
+ public QtUiTest::SelectWidget, public QtUiTest::TextWidget
+ {
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::ListWidget
+ QtUiTest::SelectWidget
+ QtUiTest::TextWidget)
+
+ public:
+ TestCustomComboBox(CustomComboBox* wrapped);
+ virtual ~TestCustomComboBox();
+
+ <span class="comment">// QtUiTest::ListWidget members</span>
+ virtual QStringList list() const;
+ virtual QRect visualRect(const QString&amp;) const;
+
+ <span class="comment">// QtUiTest::SelectWidget members</span>
+ virtual bool canSelect(QString const&amp;) const;
+ virtual bool select(QString const&amp;);
+
+ <span class="comment">// QtUiTest::TextWidget members</span>
+ virtual QString text() const;
+ virtual QString selectedText() const;
+
+ private:
+ CustomComboBox* m_wrapped;
+ };</pre>
+<p>Implementing the test widget is as simple as retrieving the necessary information from the wrapped widget. Test widgets can create and use other test widgets at runtime when necessary, as shown in the <tt>list()</tt> function below.</p>
+<pre> TestCustomComboBox::TestCustomComboBox(CustomComboBox* wrapped)
+ : m_wrapped(wrapped)
+ {}
+
+ QStringList TestCustomComboBox::list() const
+ { return qtuitest_cast&lt;QtUiTest::ListWidget*&gt;(m_wrapped-&gt;view())-&gt;list(); }
+
+ QString TestCustomComboBox::text() const
+ { return list().join(&quot;\n&quot;); }
+
+ QString TestCustomComboBox::selectedText() const
+ { return m_wrapped-&gt;currentText(); }</pre>
+<p>Memory management is handled automatically; there will be a maximum of one TestCustomComboBox instance created for any CustomComboBox and it will be destroyed when the underlying CustomComboBox is destroyed.</p>
+<a name="test-widget-factory"></a>
+<h4>Test widget factory</h4>
+<p>When using the plugin approach it is also necessary to implement a factory class. This serves as the entry point to the plugin and handles the logic for creating test widgets.</p>
+<p>The test widget factory must subclass <a href="qtuitest-widgetfactory.html">QtUiTest::WidgetFactory</a> and implement the <a href="qtuitest-widgetfactory.html#create">create()</a> function to create test widgets and the <a href="qtuitest-widgetfactory.html#keys">keys()</a> function to report which widget classes can be wrapped.</p>
+<pre> class TestWidgetsFactory : public QObject, public QtUiTest::WidgetFactory
+ {
+ Q_OBJECT
+ Q_INTERFACES(QtUiTest::WidgetFactory)
+
+ public:
+ TestWidgetsFactory();
+
+ virtual QObject* create(QObject*);
+ virtual QStringList keys() const;
+ };</pre>
+<p>The <a href="qtuitest-widgetfactory.html#create">create()</a> function is called when a new test widget is to be created. Our example widget factory handles CustomComboBox widgets and nothing else.</p>
+<pre> QObject* TestWidgetsFactory::create(QObject* wrapped)
+ {
+ if ((CustomComboBox* ccb = qobject_cast&lt;CustomComboBox*&gt;(wrapped))) {
+ return new TestCustomComboBox(ccb);
+ }
+ return 0;
+ }</pre>
+<p>The <a href="qtuitest-widgetfactory.html#keys">keys()</a> function must report which classes can be handled by this factory. Any object passed into the <a href="qtuitest-widgetfactory.html#create">create()</a> function is guaranteed to be one of the classes returned by <a href="qtuitest-widgetfactory.html#keys">keys()</a>. Classes are handled from most to least specific; when creating a test widget for CustomComboBox, a factory which handles CustomComboBox has higher priority over a factory which handles QWidget. If two or more factories handle the same class, it is undefined which factory will be asked to create the test widget.</p>
+<p>Our example factory can only handle CustomComboBox widgets so it returns that class name only.</p>
+<pre> QStringList TestWidgetsFactory::keys() const
+ {
+ return QStringList() &lt;&lt; &quot;CustomComboBox&quot;;
+ }</pre>
+<p>Finally, the plugin needs to be exported using the standard Qt plugin mechanism:</p>
+<pre> #include &lt;qplugin.h&gt;
+ Q_EXPORT_PLUGIN2(customtestwidgets, TestWidgetsFactory)</pre>
+<p>In the project's <tt>qbuild.pro</tt>, the <tt>PLUGIN_TYPE</tt> must be set to <tt>qtuitest_widgets</tt>.</p>
+<a name="multiple-inheritance-method"></a>
+<h3>Multiple inheritance method</h3>
+<p>The multiple inheritance approach requires the widget being wrapped to implement the test widget interfaces itself.</p>
+<p>Advantages to the multiple inheritance method compared to the plugin method include:</p>
+<ul>
+<li>The code for the test widget is in the same file as the wrapped widget and hence is more likely to be maintained if the widget is modified.</li>
+<li>The test widget has access to the internal structures of the wrapped widget.</li>
+<li>There is no need to write a <a href="qtuitest-widgetfactory.html">WidgetFactory</a> class to handle creation of test widgets.</li>
+</ul>
+<p>For example, implementing a custom combobox class along with all of the associated test widget interfaces would result in a class declaration like:</p>
+<pre> class CustomComboBox : public QComboBox, public QtUiTest::Widget,
+ public QtUiTest::ListWidget, public QtUiTest::SelectWidget,
+ public QtUiTest::TextWidget
+ {
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::Widget
+ QtUiTest::ListWidget
+ QtUiTest::SelectWidget
+ QtUiTest::TextWidget)
+
+ public:
+ CustomComboBox(QWidget* parent = 0);
+ ...
+
+ <span class="comment">// CustomComboBox members</span>
+ void addCustomItem(const QVariant&amp; item);
+ void addCustomItems(const QVariantList&amp; items);
+ ...
+
+ <span class="comment">// QtUiTest::Widget members</span>
+ virtual const QRect&amp; geometry() const;
+ virtual QRect rect() const;
+ ...
+
+ <span class="comment">// QtUiTest::ListWidget members</span>
+ virtual QStringList list() const;
+ virtual QRect visualRect(const QString&amp;) const;
+ ...
+
+ <span class="comment">// etc...</span>
+ };</pre>
+<p>Implementing the test widget is as simple as returning the necessary information. Test widgets can create and use other test widgets at runtime when necessary, as shown in the <tt>list()</tt> function below.</p>
+<pre> QStringList CustomComboBox::list() const
+ { return qtuitest_cast&lt;QtUiTest::ListWidget*&gt;(view())-&gt;list(); }
+
+ QString CustomComboBox::text() const
+ { return list().join(&quot;\n&quot;); }
+
+ QString CustomComboBox::selectedText() const
+ { return currentText(); }</pre>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-selectwidget-members.html b/doc/html/qtuitest-selectwidget-members.html
new file mode 100644
index 0000000..31f1458
--- /dev/null
+++ b/doc/html/qtuitest-selectwidget-members.html
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>List of All Members for SelectWidget</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">List of All Members for SelectWidget</h1>
+<p>This is the complete list of members for <a href="qtuitest-selectwidget.html">QtUiTest::SelectWidget</a>, including inherited members.</p>
+<ul>
+<li><div class="fn"><b><a href="qtuitest-selectwidget.html#canSelect">canSelect</a></b> ( const QString &amp; ) const : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-selectwidget.html#canSelectMulti">canSelectMulti</a></b> ( const QStringList &amp; ) const : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-selectwidget.html#isMultiSelection">isMultiSelection</a></b> () const : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-selectwidget.html#select">select</a></b> ( const QString &amp; ) : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-selectwidget.html#selectMulti">selectMulti</a></b> ( const QStringList &amp; ) : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-selectwidget.html#selected">selected</a></b> ( const QString &amp; )</div></li>
+</ul>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-selectwidget.html b/doc/html/qtuitest-selectwidget.html
new file mode 100644
index 0000000..ed8fecd
--- /dev/null
+++ b/doc/html/qtuitest-selectwidget.html
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>SelectWidget Class Reference</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">SelectWidget Class Reference<br /><span class="small-subtitle">(QtUiTest::SelectWidget)<br />[QtUiTestModule]</span>
+</h1>
+<p>The SelectWidget class provides an abstract base class for all test widgets which allow the user to select from a range of items. <a href="#details">More...</a></p>
+<pre> #include &lt;<a href="qtuitest.html">QtUiTest</a>&gt;</pre><p><b>This class is under development and is subject to change.</b></p>
+<ul>
+<li><a href="qtuitest-selectwidget-members.html">List of all members, including inherited members</a></li>
+</ul>
+<hr />
+<a name="public-functions"></a>
+<h2>Public Functions</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-selectwidget.html#canSelect">canSelect</a></b> ( const QString &amp; <i>item</i> ) const = 0</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-selectwidget.html#canSelectMulti">canSelectMulti</a></b> ( const QStringList &amp; <i>items</i> ) const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-selectwidget.html#isMultiSelection">isMultiSelection</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-selectwidget.html#select">select</a></b> ( const QString &amp; <i>item</i> ) = 0</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-selectwidget.html#selectMulti">selectMulti</a></b> ( const QStringList &amp; <i>items</i> )</td></tr>
+</table>
+<hr />
+<a name="signals"></a>
+<h2>Signals</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-selectwidget.html#selected">selected</a></b> ( const QString &amp; <i>item</i> )</td></tr>
+</table>
+<a name="details"></a>
+<hr />
+<h2>Detailed Description</h2>
+<p>The SelectWidget class provides an abstract base class for all test widgets which allow the user to select from a range of items.</p>
+<p>QtUiTest::SelectWidget encapsulates a widget which provides the user with a choice from a (possibly unlimited) range. This is closely related to <a href="qtuitest-listwidget.html">QtUiTest::ListWidget</a>, which may be implemented to allow a user to enumerate all items from a list.</p>
+<p>Examples of widgets suitable for this interface include QAbstractItemView, QComboBox and QMenu.</p>
+<p>See also <a href="qtuitest-listwidget.html">QtUiTest::ListWidget</a>.</p>
+<hr />
+<h2>Member Function Documentation</h2>
+<h3 class="fn"><a name="canSelect"></a>bool SelectWidget::canSelect ( const QString &amp; <i>item</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Returns true if <i>item</i> can possibly be selected from this widget.</p>
+<h3 class="fn"><a name="canSelectMulti"></a>bool SelectWidget::canSelectMulti ( const QStringList &amp; <i>items</i> ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns true if all of the given <i>items</i> can be selected from this widget at the same time.</p>
+<p>The base implementation returns true if <a href="qtuitest-selectwidget.html#isMultiSelection">isMultiSelection</a>() returns true and <a href="qtuitest-selectwidget.html#canSelect">canSelect</a>() returns true for every item in <i>items</i>.</p>
+<h3 class="fn"><a name="isMultiSelection"></a>bool SelectWidget::isMultiSelection () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns true if this widget supports the selection of multiple items at the same time.</p>
+<p>The base implementation returns false.</p>
+<h3 class="fn"><a name="select"></a>bool SelectWidget::select ( const QString &amp; <i>item</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Simulates the user input necessary to select <i>item</i> from this widget.</p>
+<p>Returns true if <i>item</i> was successfully selected.</p>
+<p>If <a href="qtuitest-selectwidget.html#canSelect">canSelect</a>() returns true and this function returns false, an error has occurred and this widget's state is undefined.</p>
+<h3 class="fn"><a name="selectMulti"></a>bool SelectWidget::selectMulti ( const QStringList &amp; <i>items</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Simulates the user input necessary to select all <i>items</i> from this widget at the same time.</p>
+<p>Returns true if <i>items</i> were all successfully selected.</p>
+<p>If <a href="qtuitest-selectwidget.html#canSelectMulti">canSelectMulti</a>() returns true and this function returns false, an error has occurred and this widget's state is undefined.</p>
+<p>The base implementation calls <a href="qtuitest-selectwidget.html#canSelectMulti">canSelectMulti</a>() to check if <i>items</i> can be selected, then calls <a href="qtuitest-selectwidget.html#select">select</a>() on each item in <i>items</i>.</p>
+<h3 class="fn"><a name="selected"></a>void SelectWidget::selected ( const QString &amp; <i>item</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
+<p>This signal is emitted when <i>item</i> is selected from this widget.</p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-testwidget-members.html b/doc/html/qtuitest-testwidget-members.html
new file mode 100644
index 0000000..a9db194
--- /dev/null
+++ b/doc/html/qtuitest-testwidget-members.html
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>List of All Members for TestWidget</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">List of All Members for TestWidget</h1>
+<p>This is the complete list of members for <a href="qtuitest-testwidget.html">QtUiTest::TestWidget</a>, including inherited members.</p>
+<p><table class="propsummary" width="100%" border="0" cellpadding="0" cellspacing="0">
+<tr><td width="45%" valign="top"><ul>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#TestWidget">TestWidget</a></b> ( QObject * )</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#canEnter">canEnter</a></b> ( QVariant const &amp; ) const : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#canWrap">canWrap</a></b> ( QObject * ) : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#center">center</a></b> () const : QPoint</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#children">children</a></b> () const : const QObjectList &amp;</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#childrenVisibleRegion">childrenVisibleRegion</a></b> () const : QRegion</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#ensureVisiblePoint">ensureVisiblePoint</a></b> ( const QPoint &amp; ) : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#ensureVisibleRegion">ensureVisibleRegion</a></b> ( QRegion const &amp; ) : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#enter">enter</a></b> ( QVariant const &amp;, bool ) : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-inputwidget.html#entered">entered</a></b> ( const QVariant &amp; )</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#eventFilter">eventFilter</a></b> ( QObject *, QEvent * ) : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#focusOutEvent">focusOutEvent</a></b> ()</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#focusPolicy">focusPolicy</a></b> () const : Qt::FocusPolicy</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#focusProxy">focusProxy</a></b> () const : QObject *</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#geometry">geometry</a></b> () const : const QRect &amp;</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#gotFocus">gotFocus</a></b> ()</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#grabPixmap">grabPixmap</a></b> ( QPixmap &amp; ) const : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#hasEditFocus">hasEditFocus</a></b> () const : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#hasFocus">hasFocus</a></b> () const : bool</div></li>
+</ul></td><td valign="top"><ul>
+<li><div class="fn"><b><a href="qtuitest-widget.html#height">height</a></b> () const : int</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#ignoreBuddy">ignoreBuddy</a></b> () const : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#ignoreScan">ignoreScan</a></b> () const : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#inherits">inherits</a></b> ( QtUiTest::WidgetType ) const : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#isVisible">isVisible</a></b> () const : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#labelText">labelText</a></b> ( QString const &amp; ) : QString</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#mapFromGlobal">mapFromGlobal</a></b> ( QPoint const &amp; ) const : QPoint</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#mapToGlobal">mapToGlobal</a></b> ( QPoint const &amp; ) const : QPoint</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#parent">parent</a></b> () const : QObject *</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#printable">printable</a></b> ( QString const &amp; ) : QString</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#rect">rect</a></b> () const : QRect</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#setEditFocus">setEditFocus</a></b> ( bool ) : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#setFocus">setFocus</a></b> () : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#visibleRegion">visibleRegion</a></b> () const : QRegion</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#width">width</a></b> () const : int</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#windowFlags">windowFlags</a></b> () const : Qt::WindowFlags</div></li>
+<li><div class="fn"><b><a href="qtuitest-testwidget.html#windowTitle">windowTitle</a></b> () const : QString</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#x">x</a></b> () const : int</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#y">y</a></b> () const : int</div></li>
+</ul>
+</td></tr>
+</table></p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-testwidget.html b/doc/html/qtuitest-testwidget.html
new file mode 100644
index 0000000..3af776a
--- /dev/null
+++ b/doc/html/qtuitest-testwidget.html
@@ -0,0 +1,111 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>TestWidget Class Reference</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">TestWidget Class Reference<br /><span class="small-subtitle">(QtUiTest::TestWidget)<br /></span>
+</h1>
+<p>Inherits <a href="qtuitest-widget.html">QtUiTest::Widget</a> and <a href="qtuitest-inputwidget.html">QtUiTest::InputWidget</a>.</p>
+<ul>
+<li><a href="qtuitest-testwidget-members.html">List of all members, including inherited members</a></li>
+</ul>
+<hr />
+<a name="public-functions"></a>
+<h2>Public Functions</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#TestWidget">TestWidget</a></b> ( QObject * )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#canEnter">canEnter</a></b> ( QVariant const &amp; ) const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#ensureVisibleRegion">ensureVisibleRegion</a></b> ( QRegion const &amp; )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#enter">enter</a></b> ( QVariant const &amp;, bool )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QPoint </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#mapFromGlobal">mapFromGlobal</a></b> ( QPoint const &amp; ) const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QPoint </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#mapToGlobal">mapToGlobal</a></b> ( QPoint const &amp; ) const</td></tr>
+</table>
+<hr />
+<a name="reimplemented-public-functions"></a>
+<h2>Reimplemented Public Functions</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">virtual const QObjectList &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#children">children</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#focusOutEvent">focusOutEvent</a></b> ()</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual Qt::FocusPolicy </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#focusPolicy">focusPolicy</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QObject * </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#focusProxy">focusProxy</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual const QRect &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#geometry">geometry</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#grabPixmap">grabPixmap</a></b> ( QPixmap &amp; <i>pixmap</i> ) const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#hasFocus">hasFocus</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#isVisible">isVisible</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QObject * </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#parent">parent</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QRect </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#rect">rect</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#setEditFocus">setEditFocus</a></b> ( bool )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QRegion </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#visibleRegion">visibleRegion</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual Qt::WindowFlags </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#windowFlags">windowFlags</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QString </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#windowTitle">windowTitle</a></b> () const</td></tr>
+</table>
+<ul>
+<li><div bar="2" class="fn"></div>29 public functions inherited from <a href="qtuitest-widget.html#public-functions">QtUiTest::Widget</a></li>
+<li><div bar="2" class="fn"></div>2 public functions inherited from <a href="qtuitest-inputwidget.html#public-functions">QtUiTest::InputWidget</a></li>
+</ul>
+<hr />
+<a name="signals"></a>
+<h2>Signals</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#gotFocus">gotFocus</a></b> ()</td></tr>
+</table>
+<ul>
+<li><div bar="2" class="fn"></div>1 signal inherited from <a href="qtuitest-widget.html#signals">QtUiTest::Widget</a></li>
+<li><div bar="2" class="fn"></div>1 signal inherited from <a href="qtuitest-inputwidget.html#signals">QtUiTest::InputWidget</a></li>
+</ul>
+<hr />
+<a name="static-public-members"></a>
+<h2>Static Public Members</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#canWrap">canWrap</a></b> ( QObject * )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#labelText">labelText</a></b> ( QString const &amp; )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#printable">printable</a></b> ( QString const &amp; )</td></tr>
+</table>
+<hr />
+<a name="protected-functions"></a>
+<h2>Protected Functions</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html#eventFilter">eventFilter</a></b> ( QObject *, QEvent * )</td></tr>
+</table>
+<a name="details"></a>
+<hr />
+<h2>Member Function Documentation</h2>
+<h3 class="fn"><a name="TestWidget"></a>TestWidget::TestWidget ( QObject * )</h3>
+<h3 class="fn"><a name="canEnter"></a>bool TestWidget::canEnter ( QVariant const &amp; ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<h3 class="fn"><a name="canWrap"></a>bool TestWidget::canWrap ( QObject * )&nbsp;&nbsp;<tt> [static]</tt></h3>
+<h3 class="fn"><a name="children"></a>const QObjectList &amp; TestWidget::children () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<h3 class="fn"><a name="ensureVisibleRegion"></a>bool TestWidget::ensureVisibleRegion ( QRegion const &amp; )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<h3 class="fn"><a name="enter"></a>bool TestWidget::enter ( QVariant const &amp;, bool )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<h3 class="fn"><a name="eventFilter"></a>bool TestWidget::eventFilter ( QObject *, QEvent * )&nbsp;&nbsp;<tt> [protected]</tt></h3>
+<h3 class="fn"><a name="focusOutEvent"></a>void TestWidget::focusOutEvent ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<h3 class="fn"><a name="focusPolicy"></a>Qt::FocusPolicy TestWidget::focusPolicy () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<h3 class="fn"><a name="focusProxy"></a>QObject * TestWidget::focusProxy () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<h3 class="fn"><a name="geometry"></a>const QRect &amp; TestWidget::geometry () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<h3 class="fn"><a name="gotFocus"></a>void TestWidget::gotFocus ()&nbsp;&nbsp;<tt> [signal]</tt></h3>
+<h3 class="fn"><a name="grabPixmap"></a>bool TestWidget::grabPixmap ( QPixmap &amp; <i>pixmap</i> ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<h3 class="fn"><a name="hasFocus"></a>bool TestWidget::hasFocus () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<h3 class="fn"><a name="isVisible"></a>bool TestWidget::isVisible () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<h3 class="fn"><a name="labelText"></a>QString TestWidget::labelText ( QString const &amp; )&nbsp;&nbsp;<tt> [static]</tt></h3>
+<h3 class="fn"><a name="mapFromGlobal"></a>QPoint TestWidget::mapFromGlobal ( QPoint const &amp; ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<h3 class="fn"><a name="mapToGlobal"></a>QPoint TestWidget::mapToGlobal ( QPoint const &amp; ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<h3 class="fn"><a name="parent"></a>QObject * TestWidget::parent () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<h3 class="fn"><a name="printable"></a>QString TestWidget::printable ( QString const &amp; )&nbsp;&nbsp;<tt> [static]</tt></h3>
+<h3 class="fn"><a name="rect"></a>QRect TestWidget::rect () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<h3 class="fn"><a name="setEditFocus"></a>bool TestWidget::setEditFocus ( bool )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<h3 class="fn"><a name="visibleRegion"></a>QRegion TestWidget::visibleRegion () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<h3 class="fn"><a name="windowFlags"></a>Qt::WindowFlags TestWidget::windowFlags () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<h3 class="fn"><a name="windowTitle"></a>QString TestWidget::windowTitle () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-textwidget-members.html b/doc/html/qtuitest-textwidget-members.html
new file mode 100644
index 0000000..71811c3
--- /dev/null
+++ b/doc/html/qtuitest-textwidget-members.html
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>List of All Members for TextWidget</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">List of All Members for TextWidget</h1>
+<p>This is the complete list of members for <a href="qtuitest-textwidget.html">QtUiTest::TextWidget</a>, including inherited members.</p>
+<ul>
+<li><div class="fn"><b><a href="qtuitest-textwidget.html#selectedText">selectedText</a></b> () const : QString</div></li>
+<li><div class="fn"><b><a href="qtuitest-textwidget.html#selectedValue">selectedValue</a></b> () const : QVariant</div></li>
+<li><div class="fn"><b><a href="qtuitest-textwidget.html#text">text</a></b> () const : QString</div></li>
+<li><div class="fn"><b><a href="qtuitest-textwidget.html#value">value</a></b> () const : QVariant</div></li>
+</ul>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-textwidget.html b/doc/html/qtuitest-textwidget.html
new file mode 100644
index 0000000..745cf90
--- /dev/null
+++ b/doc/html/qtuitest-textwidget.html
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>TextWidget Class Reference</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">TextWidget Class Reference<br /><span class="small-subtitle">(QtUiTest::TextWidget)<br />[QtUiTestModule]</span>
+</h1>
+<p>The TextWidget class provides an abstract base class for all test widgets which display text to the user. <a href="#details">More...</a></p>
+<pre> #include &lt;<a href="qtuitest.html">QtUiTest</a>&gt;</pre><p><b>This class is under development and is subject to change.</b></p>
+<ul>
+<li><a href="qtuitest-textwidget-members.html">List of all members, including inherited members</a></li>
+</ul>
+<hr />
+<a name="public-functions"></a>
+<h2>Public Functions</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">virtual QString </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-textwidget.html#selectedText">selectedText</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QVariant </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-textwidget.html#selectedValue">selectedValue</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QString </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-textwidget.html#text">text</a></b> () const = 0</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QVariant </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-textwidget.html#value">value</a></b> () const</td></tr>
+</table>
+<a name="details"></a>
+<hr />
+<h2>Detailed Description</h2>
+<p>The TextWidget class provides an abstract base class for all test widgets which display text to the user.</p>
+<p>The QtUiTest::TextWidget interface should be implemented on any widget which shows any text at all. This is the primary interface <a href="qtuitest.html">QtUiTest</a> uses to determine text-&gt;widget mappings, and it is used to implement <a href="qsystemtest.html#getText">getText()</a>, a heavily used verification mechanism.</p>
+<p>This interface is closely related to <a href="qtuitest-inputwidget.html">QtUiTest::InputWidget</a>, which provides an interface for entering text into a widget. Any widgets which contain user-editable text will typically implement both <a href="qtuitest-inputwidget.html">QtUiTest::InputWidget</a> and QtUiTest::TextWidget.</p>
+<p>Examples of widgets suitable for this interface include QLabel, QAbstractButton, QLineEdit, QTextEdit and many more.</p>
+<p>See also <a href="qtuitest-inputwidget.html">QtUiTest::InputWidget</a>.</p>
+<hr />
+<h2>Member Function Documentation</h2>
+<h3 class="fn"><a name="selectedText"></a>QString TextWidget::selectedText () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns the text in this widget which is currently selected / highlighted. If the widget does not support the concept of selected text, this function should return the same as <a href="qtuitest-textwidget.html#text">text</a>().</p>
+<p>The base implementation calls <a href="qtuitest-textwidget.html#text">text</a>().</p>
+<p>See also QLineEdit::selectedText().</p>
+<h3 class="fn"><a name="selectedValue"></a>QVariant TextWidget::selectedValue () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns the value in this widget which is currently selected / highlighted. If the widget does not support the concept of a selected value, this function should return the same as <a href="qtuitest-textwidget.html#value">value</a>().</p>
+<p>The base implementation calls <a href="qtuitest-textwidget.html#selectedText">selectedText</a>().</p>
+<h3 class="fn"><a name="text"></a>QString TextWidget::text () const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Returns all of the text this widget is currently presenting to the user.</p>
+<h3 class="fn"><a name="value"></a>QVariant TextWidget::value () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns the value this widget is currently presenting to the user.</p>
+<p>The returned value will be of whatever type is most appropriate for this widget. For example, a QLineEdit would return a literal copy of its text (giving the same result as the <a href="qtuitest-textwidget.html#text">text</a>() function), while a QTimeEdit may return a QTime.</p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-tutorial.html b/doc/html/qtuitest-tutorial.html
new file mode 100644
index 0000000..ddee10a
--- /dev/null
+++ b/doc/html/qtuitest-tutorial.html
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../doc/src/qtuitest_tutorial.qdoc -->
+<head>
+ <title>QtUiTest Tutorial</title>
+ <link rel="contents" href="qtuitest-manual.html" />
+ <link rel="next" href="qtuitest-tutorial1.html" />
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><p>
+[<a href="qtuitest-manual.html">QtUiTest Manual</a>]
+[Next: <a href="qtuitest-tutorial1.html">Chapter 1</a>]
+</p>
+<h1 class="title">QtUiTest Tutorial<br /><span class="subtitle"></span>
+</h1>
+<p>This tutorial gives a short introduction on the creation of System Tests using the <a href="qtuitest.html">QtUiTest</a> framework. It is divided into the following chapters:</p>
+<ol type="1">
+<li><a href="qtuitest-tutorial1.html">Writing a System Test</a></li>
+<li><a href="qtuitest-tutorial2.html">Input, Output and Widget Navigation</a></li>
+<li><a href="qtuitest-tutorial3.html">Data Driven Testing</a></li>
+<li><a href="qtuitest-tutorial4.html">Putting It All Together</a></li>
+</ol>
+<p>
+[<a href="qtuitest-manual.html">QtUiTest Manual</a>]
+[Next: <a href="qtuitest-tutorial1.html">Chapter 1</a>]
+</p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-tutorial1.html b/doc/html/qtuitest-tutorial1.html
new file mode 100644
index 0000000..f81a822
--- /dev/null
+++ b/doc/html/qtuitest-tutorial1.html
@@ -0,0 +1,177 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../doc/src/qtuitest_tutorial.qdoc -->
+<head>
+ <title>Chapter 1: Writing a System Test</title>
+ <link rel="contents" href="qtuitest-tutorial.html" />
+ <link rel="next" href="qtuitest-tutorial2.html" />
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><p>
+[<a href="qtuitest-tutorial.html">Contents</a>]
+[Next: <a href="qtuitest-tutorial2.html">Chapter 2</a>]
+</p>
+<h1 class="title">Chapter 1: Writing a System Test<br /><span class="subtitle"></span>
+</h1>
+<p>In this first chapter we will demonstrate how to write a simple system test, and how to execute it.</p>
+<a name="setting-up-the-environment"></a>
+<h2>Setting up the environment</h2>
+<p>Tests are saved in directories, one directory per test. As a convention we keep the name of the directory the same as the test name although this isn't a requirement. Tests are further stored in a 'tests' directory immediately under the application or library that is being tested. So let's create our first test directory, and we'll be writing a test for the addressbook application.</p>
+<pre> cd src/applications/addressbook
+ mkdir -p tests/sys_demo</pre>
+<p>Note that we write and save tests in the <tt>source</tt> tree, and we can execute them from the source as well as the build tree.</p>
+<p>The <tt>tests</tt> subdirectories have a special meaning when used in combination with QBuild, the Qt Extended build system. Anything below <tt>tests</tt> is ignored from a normal build. In other words, all code is compiled when 'configure &amp;&amp; qbuild &amp;&amp; qbuild image' is executed except for the testcases beneath <tt>tests</tt>.</p>
+<p>To run a testcase we do a <tt>qbuild test</tt> but more about that a little later.</p>
+<a name="writing-the-test"></a>
+<h2>Writing the Test</h2>
+<p>New system tests are defined by creating a new QtScript file (named ending with .js by convention), containing a <tt>testcase</tt> object with one or more test functions: So cd into <tt>tests/my_demo</tt> and create a file named <tt>sys_demo.js</tt> with the following content:</p>
+<pre> testcase = {
+ testFunction1: function() {
+ print( &quot;Hello World&quot; );
+ },
+ testFunction2: function() {
+ print( &quot;Testfunction 2&quot; );
+ }
+ }</pre>
+<p>The example above shows the creation of a testcase object containing two test functions, <tt>testFunction1</tt> and <tt>testFunction2</tt>. Obviously not much exciting is going to happen when we run this test. But we'll get to that a little later.</p>
+<p>The second bit that needs to be done is tell the build system about our new project. For this we need to create a project file named <tt>qbuild.pro</tt>. The contents of the file is as follows:</p>
+<pre> CONFIG+=systemtest
+ TARGET=sys_demo
+ SOURCES+=sys_demo.js</pre>
+<a name="running-the-test-for-the-first-time"></a>
+<h3>Running the test for the first time</h3>
+<p>Now that we have created a little test it's about time to run it for which we use QBuild again. <tt>qbuild</tt> is a binary that is created when <tt>configure</tt> is ran on the Qt Extended source tree and will end up in the bin directory of the build tree. Whenever we want to run tests, or re-compile parts of Qt Extended for that matter, it is important to call the qbuild binary from the build tree. The simplest mechanism to make that happen is to add the bin directory to our PATH variable:</p>
+<pre> export PATH=~/build/qtopia/demo/bin:$PATH</pre>
+<p>(assuming that <tt>~/build/qtopia/demo</tt> is where the code has been build.</p>
+<p>Once the PATH is set correctly we can simply run the test as follows:</p>
+<pre> cd &lt;your_src_location&gt;/src/applications/addressbook/tests/sys_demo
+ qbuild test</pre>
+<p>The test will be built and executed and results in something like this:</p>
+<pre> 1 echo '#!/bin/sh' &gt; &lt;your_build_dir&gt;/src/applications/addressbook/tests/sys_demo/sys_demo
+ 2 echo 'exec &lt;your_build_dir&gt;/bin/qtuitestrunner &lt;your_src_location&gt;/src/applications/addressbook/tests/sys_demo/sys_demo.js &quot;$@&quot;' &gt;&gt; &lt;your_build_dir&gt;/src/applications/addressbook/tests/sys_demo/sys_demo
+ 3 chmod 755 &lt;your_build_dir&gt;/src/applications/addressbook/tests/sys_demo/sys_demo
+ 4 export QPEHOME=$(mktemp -d /tmp/qtopia_maketest_XXXXXX); &lt;your_build_dir&gt;/src/applications/addressbook/tests/sys_demo/sys_demo $ARGS; rm -rf $QPEHOME
+ 5 ********* Start testing of sys_demo *********
+ 6 Config: Using QTest library 4.4.2, Qt 4.4.2
+ 7 PASS : sys_demo::initTestCase()
+ 8 QDEBUG : sys_demo::testFunction1() Hello World
+ 9 PASS : sys_demo::testFunction1()
+ 10 QDEBUG : sys_demo::testFunction2() Testfunction 2
+ 11 PASS : sys_demo::testFunction2()
+ 12 PASS : sys_demo::cleanupTestCase()
+ 13 Totals: 4 passed, 0 failed, 0 skipped
+ 14 ********* Finished testing of sys_demo *********</pre>
+<p>In the above snippet line numbers have been added for clarity. Lines 1-4 are a bit of magic to create a subdirectory for the test in the build tree, and to create an 'executable' for the test. Once the executable is created, it is executed and the results are printed to stdout (or to a file if we use extra command line parameters).</p>
+<p>Line 5-14 are the result of the test being execute. Line 5 simply marks the start of the test. Line 6 shows the version numbers of Qt and Qtest that are used. Line 7 is the result of a special function named <tt>initTestCase</tt>. Note that we haven't written an initTestCase yet, so this function is empty (and shouldn't fail). Once the test is initialized (with initTestCase) the testrunner will start executing all testfunctions, in principle in the order in which they are discovered in the file. Line 8 is the result of the print statement we did in testFunction1. Note also that the output clearly marks this information as being a part of <tt>sys_demo::testFunction1</tt>. Line 9 is the final test result for testFunction1. Since we did nothing else but a print statement it PASSes the test. Line 10 and 11 show the results for testFunction2. Line 12 shows the result for the counterpart to initTestCase: after all testfunctions have been executed the system takes a moment to clean up any garbage that has been created during test execution. Just like it's init counterpart is cleanupTestCase <tt>always</tt> called, and called only once, at the end of a test. Since we haven't actually defined anything yet the cleanup is empty and we'd expect it to PASS. Line 13 shows the accumulated totals for the test and Line 14 finally marks the end of the test.</p>
+<p>In this example we have called <tt>qbuild test</tt> from the source tree, but we could have done the same, and with the same result from the build tree. This is because we're calling qbuild which knows everything about the actual configuration we're testing, as well as where to find it.</p>
+<a name="special-functions"></a>
+<h3>Special functions</h3>
+<p>As with QTestLib unit tests, special reserved functions include the four init/cleanup functions. These behave identically to their unit test counterparts but will be explained here for completeness.</p>
+<p><table class="generic" width="80%" align="center" cellpadding="2" cellspacing="1" border="0">
+<thead><tr valign="top" class="qt-style"><th>function</th><th>description</th></tr></thead>
+<tr valign="top" class="odd"><td>initTestCase</td><td>called once immediately after the test is started. If initTestCase fails, which could happen if you add verification steps in the function, no test will be executed. In normal circumstances, each test will be executed after initTestCase is finished.</td></tr>
+<tr valign="top" class="even"><td>init</td><td>called immediately <tt>before</tt> a test function is executed. If a test function has multiple test data sets (to be discussed later) then <tt>init()</tt> will also be called multiple times. When init() fails, the test function will be skipped.</td></tr>
+<tr valign="top" class="odd"><td>cleanup</td><td>called immediately after a test function has finished executing. cleanup() is guaranteed to be called, even if the test function has failed, i.e&#x2e; you still get a chance to cleanup the environment after a failure.</td></tr>
+<tr valign="top" class="even"><td>cleanupTestCase</td><td>called once after the last test function has been executed.</td></tr>
+</table></p>
+<p>Let's re-write our testcase a bit, but this time we use the special functions.</p>
+<pre> testcase = {
+ initTestCase: function() {
+ print( &quot;Init complete test&quot; );
+ },
+ cleanupTestCase: function() {
+ print( &quot;Cleanup complete test&quot; );
+ },
+ init: function() {
+ print( &quot;Init test function&quot; );
+ },
+ cleanup: function() {
+ print( &quot;Cleanup test function&quot; );
+ },
+ testFunction1: function() {
+ print( &quot;Hello World&quot; );
+ },
+ testFunction2: function() {
+ print( &quot;Testfunction 2&quot; );
+ }
+ }</pre>
+<p>When we run <tt>qbuild test</tt> again we get the following output:</p>
+<pre> ********* Start testing of sys_demo *********
+ Config: Using QTest library 4.4.2, Qt 4.4.2
+ QDEBUG : sys_demo::initTestCase() Init complete test
+ PASS : sys_demo::initTestCase()
+ QDEBUG : sys_demo::testFunction1() Init test function
+ QDEBUG : sys_demo::testFunction1() Hello World
+ QDEBUG : sys_demo::testFunction1() Cleanup test function
+ PASS : sys_demo::testFunction1()
+ QDEBUG : sys_demo::testFunction2() Init test function
+ QDEBUG : sys_demo::testFunction2() Testfunction 2
+ QDEBUG : sys_demo::testFunction2() Cleanup test function
+ PASS : sys_demo::testFunction2()
+ QDEBUG : sys_demo::cleanupTestCase() Cleanup complete test
+ PASS : sys_demo::cleanupTestCase()
+ Totals: 4 passed, 0 failed, 0 skipped
+ ********* Finished testing of sys_demo *********</pre>
+<a name="interacting-with-the-system-under-test"></a>
+<h3>Interacting with the System Under Test</h3>
+<p>System tests do not have direct access to the code under test. Instead, the system testrunner connects to Qt Extended, and sends and receives information via a communication protocol. This effectively controls access to the tested system, reducing the impact of tests on results and emulating standard user behaviour.</p>
+<p>Suppose we wish to create a simple test which launches an application; we first need to ensure that Qt Extended has finished loading successfully, since we can't be sure of the state of the system we have connected to. This is accomplished by using the waitForQtopiaStart() function in initTestCase():</p>
+<pre> initTestCase: function()
+ {
+ waitForQtopiaStart();
+ }</pre>
+<p>Since <tt>initTestCase()</tt> is called before any test functions are executed, this will pause test execution until it receives confirmation that Qt Extended has started. Now we're ready to start the application:</p>
+<pre> testFunction1: function()
+ {
+ startApplication( &quot;Contacts&quot; );
+ }</pre>
+<p>The <a href="qsystemtest.html#startApplication">startApplication()</a> method will attempt to start the specified application (in this case, Contacts). If the specified application cannot be started, <tt>testFunction</tt> will generate a test failure and abort the test.</p>
+<p>Once the application has started, we can begin testing. While it is possible to execute as many actions in a test function as desired, the recommendation is to dedicate each test function to a single use case. The test function should then attempt to realistically simulate each step of the use case, and verify that the expected result occurs. For example, assume we need to test creating a new contact; a simple test function could look like this:</p>
+<pre> creating_a_contact: function()
+ {
+ <span class="comment">// Start the application</span>
+ startApplication( &quot;Contacts&quot; );
+
+ <span class="comment">// Open the options menu and choose &quot;New contact&quot;</span>
+ select( &quot;New contact&quot;, optionsMenu() );
+
+ <span class="comment">// Enter some details in the &quot;Name&quot; and &quot;Emails&quot; fields</span>
+ enter( &quot;Frank Grimes&quot;, &quot;Name&quot; );
+ enter( &quot;frank@example.com&quot;, &quot;Emails&quot; );
+
+ <span class="comment">// Select 'Back' from the softkey menu to commit changes</span>
+ select( &quot;Back&quot;, softMenu() );
+
+ <span class="comment">// We should now be at the contacts list.</span>
+ <span class="comment">// Verify that we can select the contact we just created.</span>
+ select( &quot;Frank Grimes&quot; );
+
+ <span class="comment">// We should now be viewing the contact.</span>
+ <span class="comment">// Move to &quot;Details&quot; tab.</span>
+ select( &quot;Details&quot;, tabBar() );
+
+ <span class="comment">// Now verify that the details screen contains</span>
+ <span class="comment">// the expected details.</span>
+ var text = getText();
+ verify( text.contains(&quot;Frank Grimes&quot;) );
+ verify( text.contains(&quot;frank@example.com&quot;) );
+ }</pre>
+<p>This test function will start Contacts, navigate through several screens, input data, and verify that the data was successfully saved as a new contact. It is important to note that this test has not explicitly simulated any key or mouse events (although this can be done). This means that the same test can be used as-is on both a keyboard and touchscreen device. This is possible because the implementation of select() and enter() know how to select items and enter data on both keyboard and touchscreen devices.</p>
+<p>The next chapter gives more detail on how navigation works.</p>
+<p>
+[<a href="qtuitest-tutorial.html">Contents</a>]
+[Next: <a href="qtuitest-tutorial2.html">Chapter 2</a>]
+</p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-tutorial2.html b/doc/html/qtuitest-tutorial2.html
new file mode 100644
index 0000000..1b0ea5e
--- /dev/null
+++ b/doc/html/qtuitest-tutorial2.html
@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../doc/src/qtuitest_tutorial.qdoc -->
+<head>
+ <title>Chapter 2: Input, Output and Widget Navigation</title>
+ <link rel="prev" href="qtuitest-tutorial1.html" />
+ <link rel="contents" href="qtuitest-tutorial.html" />
+ <link rel="next" href="qtuitest-tutorial3.html" />
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><p>
+[Previous: <a href="qtuitest-tutorial1.html">Chapter 1</a>]
+[<a href="qtuitest-tutorial.html">Contents</a>]
+[Next: <a href="qtuitest-tutorial3.html">Chapter 3</a>]
+</p>
+<h1 class="title">Chapter 2: Input, Output and Widget Navigation<br /><span class="subtitle"></span>
+</h1>
+<p>System tests generally consist of a series of actions and verification that the expected behaviour took place. When testing a Qt Extended application, this usually takes the form of simulating the input of specific text and verifying that the application subsequently displays the correct text. Testing necessarily includes navigating through forms and menus, activating buttons and comboboxes, and similar tasks. <a href="qtuitest.html">QtUiTest</a> makes this very easy by supplying simple yet powerful navigation and input/output methods.</p>
+<a name="basic-input"></a>
+<h2>Basic Input</h2>
+<p>Using QtUitest, it is possible to simulate individual keyclicks, perhaps the most simple form of user interaction that can be simulated.</p>
+<pre> mytestcase = {
+ mytestfunction: function() {
+ keyClick(Qt.Key_A);
+ keyClick(Qt.Key_B);
+ keyClick(Qt.Key_C);
+ }
+ }</pre>
+<p>In the above example, the calls to <a href="qsystemtest.html#keyClick">keyClick()</a> simulate a few individual key clicks, exactly as if the user had physically pressed keys on the device.</p>
+<p>However, there are several disadvantages to this approach. Firstly, it is extremely verbose. Secondly, it means that the test will only work on a keypad device. To avoid these problems, the <a href="qsystemtest.html#enter">enter()</a> function is provided:</p>
+<pre> mytestcase = {
+ mytestfunction: function() {
+ enter(&quot;abc&quot;);
+ }
+ }</pre>
+<p>On a keypad device, the above example has the same affect as the previous example, but is more concise. However, this test now has the additional advantage that it can work on a touchscreen device, as <a href="qsystemtest.html#enter">enter()</a> knows how to simulate the necessary touchscreen events to input the given text.</p>
+<a name="input-into-specific-widgets"></a>
+<h2>Input Into Specific Widgets</h2>
+<p>In both of the examples above, input would be delivered to whichever widget is currently focused. In practice, what we often wish to do is enter text into a series of widgets displayed to the user.</p>
+<p>For example, consider the following screen for entering the details of a new contact.</p>
+<p align="center"><font color="red">[Missing image fields_example.png]</font></p><p>It would be possible to enter text in each field on this screen by using <tt>enter()</tt> and <tt>keyClick(Qt.Key_Down)</tt>. However, the test would easily break if the order of fields were changed, or if fields were added or removed, and the test would not work on a touchscreen device.</p>
+<p>To solve this problem, <tt>enter()</tt> (and many other functions in <a href="qtuitest.html">QtUiTest</a>) take an optional <i>Query Path</i> parameter, which specifies which widget to operate on. The most common usage of query paths takes the form &quot;LabelText&quot;, which refers to any widget which can receive input and is named or labeled &quot;LabelText&quot;.</p>
+<p>Entering text into a few fields on the screen featured above is achieved by the following example:</p>
+<pre> mytestfunction: function() {
+ enter(&quot;Yoyo Corporation&quot;, &quot;Company&quot;);
+ enter(&quot;Yoyo Engineer&quot;, &quot;Title&quot;);
+ enter(&quot;x51 YOYO&quot;, &quot;Phone&quot;);
+ }</pre>
+<p>In the above example, if any of the specified fields are moved, the test will continue to work as expected. If any of the specified fields are removed, renamed, or no longer visible, the test will fail with a message indicating it cannot find the specified field.</p>
+<a name="selecting-items-from-lists-and-menus-and-activating-buttons"></a>
+<h2>Selecting Items from Lists and Menus, and Activating Buttons</h2>
+<p>Often, a user will be presented with a list of items or a context menu. <a href="qtuitest.html">QtUiTest</a> provides a simple way to navigate to and select items in any list- or menu-like widget. The <a href="qsystemtest.html#select">select()</a> function will select an item from a list, combo box, menu or tab widget by looking at the display text for each item. It can also be used to activate a button with the given text.</p>
+<pre> mytestfunction: function() {
+ <span class="comment">// Select &quot;Show contacts&quot; from the options (context) menu.</span>
+ select(&quot;Show contacts&quot;, optionsMenu());
+
+ <span class="comment">// Select &quot;Bob&quot; in the currently shown list.</span>
+ select(&quot;Bob&quot;);
+
+ <span class="comment">// Activate the &quot;Edit&quot; button to edit Bob's details.</span>
+ select(&quot;Edit&quot;);
+
+ <span class="comment">// Fill in the &quot;Gender&quot; field (a combo box) for Bob.</span>
+ select(&quot;Male&quot;, &quot;Gender&quot;);
+ }</pre>
+<p>select() allows a test to be reused by keypad and touchscreen devices. For instance, consider select(&quot;Edit&quot;) from the above example. On a touchscreen device, this will simply result in a click being simulated at the co-ordinates of the Edit button. On a keypad device, keyclicks will be simulated to navigate to and activate the Edit button.</p>
+<a name="output"></a>
+<h2>Output</h2>
+<p>Built-in Qt and Qt Extended widgets can be queried for their currently displayed text. The <a href="qsystemtest.html#getText">getText()</a> function is the most common way of doing this.</p>
+<pre> mytestfunction: function() {
+ enter(&quot;Yoyo Corporation&quot;, &quot;Company&quot;);
+ compare( getText(&quot;Company&quot;), &quot;Yoyo Corporation&quot; );
+ }</pre>
+<p>The above example simply enters &quot;Yoyo Corporation&quot; into the &quot;Company&quot; field, then verifies that the field actually contains the text &quot;Yoyo Corporation&quot;. Note that it is not necessary to explicitly call compare immediately after the enter command: it would have failed if the enter text had failed.</p>
+<p>The next chapter explains how to make use of data driven testing.</p>
+<p>
+[Previous: <a href="qtuitest-tutorial1.html">Chapter 1</a>]
+[<a href="qtuitest-tutorial.html">Contents</a>]
+[Next: <a href="qtuitest-tutorial3.html">Chapter 3</a>]
+</p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-tutorial3.html b/doc/html/qtuitest-tutorial3.html
new file mode 100644
index 0000000..880ee61
--- /dev/null
+++ b/doc/html/qtuitest-tutorial3.html
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../doc/src/qtuitest_tutorial.qdoc -->
+<head>
+ <title>Chapter 3: Data driven testing</title>
+ <link rel="prev" href="qtuitest-tutorial2.html" />
+ <link rel="contents" href="qtuitest-tutorial.html" />
+ <link rel="next" href="qtuitest-tutorial4.html" />
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><p>
+[Previous: <a href="qtuitest-tutorial2.html">Chapter 2</a>]
+[<a href="qtuitest-tutorial.html">Contents</a>]
+[Next: <a href="qtuitest-tutorial4.html">Chapter 4</a>]
+</p>
+<h1 class="title">Chapter 3: Data driven testing<br /><span class="subtitle"></span>
+</h1>
+<p>The first page of this tutorial gave an example of testing creation of a contact:</p>
+<pre> creating_a_contact: function()
+ {
+ <span class="comment">// Start the application</span>
+ startApplication( &quot;Contacts&quot; );
+
+ <span class="comment">// Open the options menu and choose &quot;New contact&quot;</span>
+ select( &quot;New contact&quot;, optionsMenu() );
+
+ <span class="comment">// Enter some details in the &quot;Name&quot; and &quot;Emails&quot; fields</span>
+ enter( &quot;Frank Grimes&quot;, &quot;Name&quot; );
+ enter( &quot;frank@example.com&quot;, &quot;Emails&quot; );
+
+ <span class="comment">// Select 'Back' from the softkey menu to commit changes</span>
+ select( &quot;Back&quot;, softMenu() );
+
+ <span class="comment">// We should now be at the contacts list.</span>
+ <span class="comment">// Verify that we can select the contact we just created.</span>
+ select( &quot;Frank Grimes&quot; );
+
+ <span class="comment">// We should now be viewing the contact.</span>
+ <span class="comment">// Move to &quot;Details&quot; tab.</span>
+ select( &quot;Details&quot;, tabBar() );
+
+ <span class="comment">// Now verify that the details screen contains</span>
+ <span class="comment">// the expected details.</span>
+ var text = getText();
+ verify( text.contains(&quot;Frank Grimes&quot;) );
+ verify( text.contains(&quot;frank@example.com&quot;) );
+ }</pre>
+<p>One problem with this test function is that only one set of values is tested. If we want to test additional values, the best way to do it is with <a href="qtuitest.html">QtUiTest</a>'s built-in support for data driven testing.</p>
+<p>We create a new object, named the same as our testfunction with '_data' appended, and we make the object consist of a series of arrays:</p>
+<pre> creating_a_contact_data: {
+ simple: [ &quot;Frank Grimes&quot;, &quot;frank@example.com&quot;, &quot;+61 0321 FRANK&quot; ],
+ no_email: [ &quot;Bob Jones&quot;, undefined, &quot;+61 0321 BOB&quot; ],
+ with_middlename: [ &quot;Jane Middlename Doe&quot;, &quot;jmd@example.com&quot;, undefined ]
+ }</pre>
+<p><tt>testcase.creating_a_contact_data</tt> is a table of test data with rows <tt>simple</tt>, <tt>no_email</tt> and <tt>with_middlename</tt>. Each row has 3 columns, and these are passed to the <tt>creating_a_contact</tt> test function as the arguments <tt>name</tt>, <tt>email</tt>, <tt>homephone</tt> in the example below:</p>
+<pre> creating_a_contact: function(name, email, homephone)
+ {
+ <span class="comment">// Start the application</span>
+ startApplication( &quot;Contacts&quot; );
+
+ <span class="comment">// Open the options menu and choose &quot;New contact&quot;</span>
+ select( &quot;New contact&quot;, optionsMenu() );
+
+ <span class="comment">// Enter details</span>
+ enter( name, &quot;Name&quot; );
+ enter( email, &quot;Emails&quot; );
+ enter( homephone, &quot;Home Phone&quot; );
+
+ <span class="comment">// Select 'Back' from the softkey menu to commit changes</span>
+ select( &quot;Back&quot;, softMenu() );
+
+ <span class="comment">// We should now be at the contacts list.</span>
+ <span class="comment">// Verify that we can select the contact we just created.</span>
+ select( name );
+
+ <span class="comment">// We should now be viewing the contact.</span>
+ <span class="comment">// Move to &quot;Details&quot; tab.</span>
+ select( &quot;Details&quot;, tabBar() );
+
+ <span class="comment">// Now verify that the details screen contains</span>
+ <span class="comment">// the expected details.</span>
+ var text = getText();
+ if (name != undefined) verify( text.contains(name) );
+ if (email != undefined) verify( text.contains(email) );
+ if (homephone != undefined) verify( text.contains(homephone) );
+ }</pre>
+<p>This test is now much more extensible. New test cases can simply be added as new rows to the testdata table and will automatically be tested without needing to add further logic to the test function.</p>
+<p>
+[Previous: <a href="qtuitest-tutorial2.html">Chapter 2</a>]
+[<a href="qtuitest-tutorial.html">Contents</a>]
+[Next: <a href="qtuitest-tutorial4.html">Chapter 4</a>]
+</p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-tutorial4.html b/doc/html/qtuitest-tutorial4.html
new file mode 100644
index 0000000..f85c69e
--- /dev/null
+++ b/doc/html/qtuitest-tutorial4.html
@@ -0,0 +1,106 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../doc/src/qtuitest_tutorial.qdoc -->
+<head>
+ <title>Chapter 4: Putting It All Together</title>
+ <link rel="prev" href="qtuitest-tutorial3.html" />
+ <link rel="contents" href="qtuitest-tutorial.html" />
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><p>
+[Previous: <a href="qtuitest-tutorial3.html">Chapter 3</a>]
+[<a href="qtuitest-tutorial.html">Contents</a>]
+</p>
+<h1 class="title">Chapter 4: Putting It All Together<br /><span class="subtitle"></span>
+</h1>
+<p>Using the simple building blocks of textual input and output and navigation functions, with the data driven testing approach, a full testcase can be written for creating a new contact. Note that the functions for creating and verifying a contact have been moved out into helper functions; this allows them to be reused for subsequent tests. This is very useful for cases where, for instance, one test's precondition might be that a contact has been successfully created.</p>
+<pre> testcase = {
+ initTestCase: function() {
+ <span class="comment">// Start &quot;Contacts&quot; when the testcase starts.</span>
+ startApplication( &quot;Contacts&quot; );
+ },
+
+ creating_a_contact: function(name, emails, company, jobTitle, businessPhone) {
+ create_contact(name, emails, company, jobTitle, businessPhone);
+ verify_contact(name, emails, company, jobTitle, businessPhone);
+ },
+
+ creating_a_contact_data: {
+ simple: [ &quot;Billy Jones&quot;, &quot;billy@example.com&quot;, &quot;Hotdog Inc.&quot;, &quot;Hotdog Engineer&quot;, &quot;12345&quot; ],
+ letters_in_phone: [ &quot;Joan Example&quot;, &quot;joan@example.com&quot;, &quot;Example Inc.&quot;, &quot;Exemplary Engineer&quot;, &quot;555 EXA&quot; ],
+ three_names: [ &quot;Jon John Johnson&quot;, &quot;jjj@example.com&quot;, &quot;Sillynames Inc.&quot;, &quot;Dog Walker&quot;, &quot;12345&quot; ],
+ no_job: [ &quot;William Doe&quot;, &quot;bill@example.net&quot;, undefined, undefined, undefined ]
+ }
+ }
+
+<span class="comment"> // Create a contact with the given details.</span>
+ function create_contact(name, emails, company, jobTitle, businessPhone) {
+ <span class="comment">// Verify that we're on the home screen of the &quot;Contacts&quot; app.</span>
+ waitForTitle( &quot;Contacts&quot; );
+
+ <span class="comment">// Select &quot;New contact&quot; from context menu.</span>
+ select( &quot;New contact&quot;, optionsMenu() );
+
+ <span class="comment">// Navigate to the &quot;Contact&quot; tab.</span>
+ <span class="comment">// This is the default tab, but with this code we ensure the</span>
+ <span class="comment">// test will work if it becomes no longer the default.</span>
+ select( &quot;Contact&quot;, tabBar() );
+
+ <span class="comment">// Fill in fields on the &quot;Contact&quot; tab.</span>
+ <span class="comment">// enter() returns immediately if we try to enter an undefined</span>
+ <span class="comment">// value.</span>
+ enter( name, &quot;Name&quot; );
+ enter( emails, &quot;Emails&quot; );
+
+ <span class="comment">// Navigate to the &quot;Business&quot; tab.</span>
+ select( &quot;Business&quot;, tabBar() );
+
+ <span class="comment">// Fill in fields on the &quot;Business&quot; tab.</span>
+ enter( company, &quot;Company&quot; );
+ enter( jobTitle, &quot;Title&quot; );
+ enter( businessPhone, &quot;Phone&quot; );
+
+ <span class="comment">// Press the Back key to commit the new contact</span>
+ select( &quot;Back&quot;, softMenu() );
+ }
+
+<span class="comment"> // Verify that a contact with the given details exists.</span>
+ function verify_contact(name, emails, company, jobTitle, businessPhone) {
+ <span class="comment">// Verify that we're on the contacts list.</span>
+ waitForTitle( &quot;Contacts&quot; );
+
+ <span class="comment">// Select the contact with the given name.</span>
+ select( name );
+
+ <span class="comment">// Navigate to the &quot;Details&quot; tab and get the displayed text.</span>
+ select( &quot;Details&quot;, tabBar() );
+ var details = getText();
+
+ <span class="comment">// Now verify that the details contains all of the non-null information</span>
+ <span class="comment">// for the contact.</span>
+ if (name != undefined) verify( details.contains(name) );
+ if (emails != undefined) verify( details.contains(emails) );
+ if (company != undefined) verify( details.contains(company) );
+ if (jobTitle != undefined) verify( details.contains(jobTitle) );
+ if (businessPhone != undefined) verify( details.contains(businessPhone) );
+ }</pre>
+<p>The above test has been written to be reasonably permissive; it will succeed as long as the text shown by the contacts application contains all of the information for the created contact, and it does not test things such as the formatting of the given text, and does not test every single field. However, this test is well insulated against minor changes to the tested application GUI.</p>
+<p><a href="qtuitest.html">QtUiTest</a> allows the tester to decide how strict a test should be. If pixel-perfect accuracy is required for output, a test can be written to test every screen with <a href="qsystemtest.html#verifyImage">verifyImage()</a>. In contrast, a high-level text-based approach as shown above can result in effective tests which remain correct even when significant UI changes occur.</p>
+<p>There are many other methods available for use; for further information, refer to the <a href="qsystemtest.html">QSystemTest</a> documentation.</p>
+<p>
+[Previous: <a href="qtuitest-tutorial3.html">Chapter 3</a>]
+[<a href="qtuitest-tutorial.html">Contents</a>]
+</p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-widget-members.html b/doc/html/qtuitest-widget-members.html
new file mode 100644
index 0000000..56b1fab
--- /dev/null
+++ b/doc/html/qtuitest-widget-members.html
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>List of All Members for Widget</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">List of All Members for Widget</h1>
+<p>This is the complete list of members for <a href="qtuitest-widget.html">QtUiTest::Widget</a>, including inherited members.</p>
+<p><table class="propsummary" width="100%" border="0" cellpadding="0" cellspacing="0">
+<tr><td width="45%" valign="top"><ul>
+<li><div class="fn"><b><a href="qtuitest-widget.html#center">center</a></b> () const : QPoint</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#children">children</a></b> () const : const QObjectList &amp;</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#childrenVisibleRegion">childrenVisibleRegion</a></b> () const : QRegion</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#ensureVisiblePoint">ensureVisiblePoint</a></b> ( const QPoint &amp; ) : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#ensureVisibleRegion">ensureVisibleRegion</a></b> ( const QRegion &amp; ) : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#focusOutEvent">focusOutEvent</a></b> ()</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#focusPolicy">focusPolicy</a></b> () const : Qt::FocusPolicy</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#focusProxy">focusProxy</a></b> () const : QObject *</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#geometry">geometry</a></b> () const : const QRect &amp;</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#gotFocus">gotFocus</a></b> ()</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#grabPixmap">grabPixmap</a></b> ( QPixmap &amp; ) const : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#hasEditFocus">hasEditFocus</a></b> () const : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#hasFocus">hasFocus</a></b> () const : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#height">height</a></b> () const : int</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#ignoreBuddy">ignoreBuddy</a></b> () const : bool</div></li>
+</ul></td><td valign="top"><ul>
+<li><div class="fn"><b><a href="qtuitest-widget.html#ignoreScan">ignoreScan</a></b> () const : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#inherits">inherits</a></b> ( QtUiTest::WidgetType ) const : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#isVisible">isVisible</a></b> () const : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#mapFromGlobal">mapFromGlobal</a></b> ( const QPoint &amp; ) const : QPoint</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#mapToGlobal">mapToGlobal</a></b> ( const QPoint &amp; ) const : QPoint</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#parent">parent</a></b> () const : QObject *</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#rect">rect</a></b> () const : QRect</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#setEditFocus">setEditFocus</a></b> ( bool ) : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#setFocus">setFocus</a></b> () : bool</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#visibleRegion">visibleRegion</a></b> () const : QRegion</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#width">width</a></b> () const : int</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#windowFlags">windowFlags</a></b> () const : Qt::WindowFlags</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#windowTitle">windowTitle</a></b> () const : QString</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#x">x</a></b> () const : int</div></li>
+<li><div class="fn"><b><a href="qtuitest-widget.html#y">y</a></b> () const : int</div></li>
+</ul>
+</td></tr>
+</table></p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-widget.html b/doc/html/qtuitest-widget.html
new file mode 100644
index 0000000..7775380
--- /dev/null
+++ b/doc/html/qtuitest-widget.html
@@ -0,0 +1,200 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>Widget Class Reference</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">Widget Class Reference<br /><span class="small-subtitle">(QtUiTest::Widget)<br />[QtUiTestModule]</span>
+</h1>
+<p>The Widget class provides an abstract base class for all test widgets. <a href="#details">More...</a></p>
+<pre> #include &lt;<a href="qtuitest.html">QtUiTest</a>&gt;</pre><p><b>This class is under development and is subject to change.</b></p>
+<p>Inherited by </p>
+<ul>
+<li><a href="qtuitest-widget-members.html">List of all members, including inherited members</a></li>
+</ul>
+<hr />
+<a name="public-functions"></a>
+<h2>Public Functions</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">virtual QPoint </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#center">center</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual const QObjectList &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#children">children</a></b> () const = 0</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QRegion </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#childrenVisibleRegion">childrenVisibleRegion</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#ensureVisiblePoint">ensureVisiblePoint</a></b> ( const QPoint &amp; <i>point</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#ensureVisibleRegion">ensureVisibleRegion</a></b> ( const QRegion &amp; <i>region</i> ) = 0</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#focusOutEvent">focusOutEvent</a></b> ()</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual Qt::FocusPolicy </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#focusPolicy">focusPolicy</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QObject * </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#focusProxy">focusProxy</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual const QRect &amp; </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#geometry">geometry</a></b> () const = 0</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#grabPixmap">grabPixmap</a></b> ( QPixmap &amp; <i>pixmap</i> ) const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#hasEditFocus">hasEditFocus</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#hasFocus">hasFocus</a></b> () const = 0</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#height">height</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#ignoreBuddy">ignoreBuddy</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#ignoreScan">ignoreScan</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#inherits">inherits</a></b> ( QtUiTest::WidgetType <i>type</i> ) const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#isVisible">isVisible</a></b> () const = 0</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QPoint </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#mapFromGlobal">mapFromGlobal</a></b> ( const QPoint &amp; <i>pos</i> ) const = 0</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QPoint </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#mapToGlobal">mapToGlobal</a></b> ( const QPoint &amp; <i>pos</i> ) const = 0</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QObject * </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#parent">parent</a></b> () const = 0</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QRect </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#rect">rect</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#setEditFocus">setEditFocus</a></b> ( bool <i>enable</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#setFocus">setFocus</a></b> ()</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QRegion </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#visibleRegion">visibleRegion</a></b> () const = 0</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#width">width</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual Qt::WindowFlags </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#windowFlags">windowFlags</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QString </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#windowTitle">windowTitle</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#x">x</a></b> () const</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual int </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#y">y</a></b> () const</td></tr>
+</table>
+<hr />
+<a name="signals"></a>
+<h2>Signals</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html#gotFocus">gotFocus</a></b> ()</td></tr>
+</table>
+<a name="details"></a>
+<hr />
+<h2>Detailed Description</h2>
+<p>The Widget class provides an abstract base class for all test widgets.</p>
+<p>QtUiTest::Widget contains functionality which maps closely to QWidget. It encapsulates important information and functionality related to two-dimensional GUI elements.</p>
+<p>All Qt Extended test widgets should implement the QtUiTest::Widget interface, using multiple inheritance to implement other <a href="qtuitest.html">QtUiTest</a> interfaces where suitable.</p>
+<hr />
+<h2>Member Function Documentation</h2>
+<h3 class="fn"><a name="center"></a>QPoint Widget::center () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns the center point of the widget. The base implementation returns <a href="qtuitest-widget.html#geometry">geometry</a>().center().</p>
+<p>See also <a href="qtuitest-widget.html#geometry">QtUiTest::Widget::geometry</a>().</p>
+<h3 class="fn"><a name="children"></a>const QObjectList &amp; Widget::children () const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Returns all children of this widget.</p>
+<p>The returned objects may be actual QWidget instances, or may be wrapping test widgets. Therefore, the only safe way to use the returned objects are to cast them to the desired <a href="qtuitest.html">QtUiTest</a> interface using <a href="qtuitest.html">qtuitest_cast</a>.</p>
+<p>Reimplementing this function allows widgets which are conceptually widgets but are not QObject subclasses to be wrapped. This can be achieved by returning a list of test widgets which do not necessarily have underlying QWidget instances.</p>
+<p>See also QObject::children() and <a href="qtuitest-widget.html#parent">parent</a>().</p>
+<h3 class="fn"><a name="childrenVisibleRegion"></a>QRegion Widget::childrenVisibleRegion () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns the currently on-screen, unobscured region of all child widgets of this widget, in widget coordinates. This does not include the visible region of this widget.</p>
+<p>The base implementation calculates the visible region by calling <a href="qtuitest-widget.html#visibleRegion">visibleRegion</a>() and childrenVisibleRegion() on all <a href="qtuitest-widget.html#children">children</a>().</p>
+<p>See also QWidget::visibleRegion(), <a href="qtuitest-widget.html#children">children</a>(), and <a href="qtuitest-widget.html#visibleRegion">visibleRegion</a>().</p>
+<h3 class="fn"><a name="ensureVisiblePoint"></a>bool Widget::ensureVisiblePoint ( const QPoint &amp; <i>point</i> )</h3>
+<p>Simulate whatever user input is necessary to ensure that <i>point</i> (in local coordinates) is on-screen and unobscured.</p>
+<p>This convenience function calls <a href="qtuitest-widget.html#ensureVisibleRegion">ensureVisibleRegion</a>() with a region containing only <i>point</i>.</p>
+<p>Returns true if <i>point</i> was successfully made visible.</p>
+<p>See also <a href="qtuitest-widget.html#visibleRegion">visibleRegion</a>() and <a href="qtuitest-widget.html#ensureVisibleRegion">ensureVisibleRegion</a>().</p>
+<h3 class="fn"><a name="ensureVisibleRegion"></a>bool Widget::ensureVisibleRegion ( const QRegion &amp; <i>region</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Simulate whatever user input is necessary to ensure that <i>region</i> (in local coordinates) is on-screen and unobscured.</p>
+<p>Returns true if <i>region</i> was successfully made visible.</p>
+<p>See also <a href="qtuitest-widget.html#visibleRegion">visibleRegion</a>().</p>
+<h3 class="fn"><a name="focusOutEvent"></a>void Widget::focusOutEvent ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>This function is called when this widget is about to lose keyboard focus. The base implementation does nothing.</p>
+<p>This function should be reimplemented to put this widget in a state where subsequent up/down key clicks will result in non-destructive navigation between widgets.</p>
+<p>For example, if this function is called on a combo box which currently has a list popped up, it should dismiss the list so that subsequent key clicks will navigate between widgets rather than navigating within the list.</p>
+<pre> void MyComboBox::focusOutEvent() {
+ <span class="comment">// Assuming q is a QComboBox...</span>
+ <span class="comment">// If the list is currently popped up...</span>
+ if (q-&gt;view()-&gt;isVisible()) {
+ <span class="comment">// Press the Select key to commit the currently highlighted</span>
+ <span class="comment">// item and ensure we are ready to navigate by keys.</span>
+ QtUiTest::keyClick(Qt::Key_Select);
+ }
+ }</pre>
+<p>See also QWidget::focusOutEvent(), <a href="qtuitest-widget.html#setFocus">setFocus</a>(), and <a href="qtuitest-widget.html#hasFocus">hasFocus</a>().</p>
+<h3 class="fn"><a name="focusPolicy"></a>Qt::FocusPolicy Widget::focusPolicy () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns the focus policy of this widget.</p>
+<p>The default implementation returns Qt::NoFocus, indicating that the widget does not accept focus.</p>
+<p>See also QWidget::focusPolicy().</p>
+<h3 class="fn"><a name="focusProxy"></a>QObject * Widget::focusProxy () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns the focus proxy of this widget, or 0 if this widget has no focus proxy. A widget may &quot;have focus&quot;, but have a child widget that actually handles the focus.</p>
+<p>The returned object may be an actual QWidget, or may be a wrapping test widget. Therefore, the only safe way to use the returned value of this function is to cast it to the desired <a href="qtuitest.html">QtUiTest</a> interface using <a href="qtuitest.html">qtuitest_cast</a>.</p>
+<p>See also QWidget::focusProxy().</p>
+<h3 class="fn"><a name="geometry"></a>const QRect &amp; Widget::geometry () const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Returns the geometry of this widget in parent coordinates.</p>
+<p>See also QWidget::geometry().</p>
+<h3 class="fn"><a name="gotFocus"></a>void Widget::gotFocus ()&nbsp;&nbsp;<tt> [signal]</tt></h3>
+<p>This signal is emitted when this widget gains focus by any means.</p>
+<p>See also QApplication::focusChanged().</p>
+<h3 class="fn"><a name="grabPixmap"></a>bool Widget::grabPixmap ( QPixmap &amp; <i>pixmap</i> ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Sets <i>pixmap</i> to image of the widget. Returns true on success.</p>
+<p>The base implementation always returns false.</p>
+<h3 class="fn"><a name="hasEditFocus"></a>bool Widget::hasEditFocus () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns true if this widget currently has edit focus.</p>
+<p>The concept of edit focus only exists in Qt Embedded. This function must be implemented on Qt Embedded. On other platforms, the base implementation will return the same as <a href="qtuitest-widget.html#hasFocus">hasFocus</a>().</p>
+<p>See also QWidget::hasEditFocus() and <a href="qtuitest-widget.html#setEditFocus">setEditFocus</a>().</p>
+<h3 class="fn"><a name="hasFocus"></a>bool Widget::hasFocus () const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Returns true if this widget currently has keyboard focus.</p>
+<p>See also QWidget::hasFocus().</p>
+<h3 class="fn"><a name="height"></a>int Widget::height () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns the height of the widget.</p>
+<p>See also <a href="qtuitest-widget.html#geometry">geometry</a>().</p>
+<h3 class="fn"><a name="ignoreBuddy"></a>bool Widget::ignoreBuddy () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns true if this widget should not considered a possible buddy for a label when resolving query paths.</p>
+<p>Note that if the widget is returned as a buddy by QtUiTest::Label::buddy() then this value will be ignored.</p>
+<p>The base implementation always returns false.</p>
+<p>See also QtUiTest::Label::buddy(), <a href="qtuitest-manual.html#query-paths">Query Paths</a>, and <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>.</p>
+<h3 class="fn"><a name="ignoreScan"></a>bool Widget::ignoreScan () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns true if this widget should be ignored by <a href="qtuitest.html">QtUiTest</a>. If a widget is ignored, any child widgets will still be processed.</p>
+<p>The base implementation always returns false.</p>
+<p>See also <a href="qtuitest-manual.html#query-paths">Query Paths</a> and <a href="qtuitest-manual.html#querying-objects">Querying Objects</a>.</p>
+<h3 class="fn"><a name="inherits"></a>bool Widget::inherits ( <a href="qtuitest.html#WidgetType-enum">QtUiTest::WidgetType</a> <i>type</i> ) const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns true if this widget is of the given <i>type</i>.</p>
+<p>The base implementation always returns false.</p>
+<h3 class="fn"><a name="isVisible"></a>bool Widget::isVisible () const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Returns true if this widget is currently visible.</p>
+<p>In this context, &quot;visible&quot; has the same meaning as in QWidget::isVisible(). Therefore, this function returning <tt>true</tt> is not a guarantee that this widget is currently on screen and unobscured. To test this, <a href="qtuitest-widget.html#visibleRegion">visibleRegion</a>() can be used.</p>
+<p>See also QWidget::isVisible() and <a href="qtuitest-widget.html#visibleRegion">visibleRegion</a>().</p>
+<h3 class="fn"><a name="mapFromGlobal"></a>QPoint Widget::mapFromGlobal ( const QPoint &amp; <i>pos</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Maps <i>pos</i> from global screen coordinates to widget coordinates and returns the result.</p>
+<p>See also QWidget::mapFromGlobal().</p>
+<h3 class="fn"><a name="mapToGlobal"></a>QPoint Widget::mapToGlobal ( const QPoint &amp; <i>pos</i> ) const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Maps <i>pos</i> from widget coordinates to global screen coordinates and returns the result.</p>
+<p>See also QWidget::mapToGlobal().</p>
+<h3 class="fn"><a name="parent"></a>QObject * Widget::parent () const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Returns the parent of this widget, or 0 if this widget has no parent.</p>
+<p>The returned object may be an actual QWidget, or may be a wrapping test widget. Therefore, the only safe way to use the returned value of this function is to cast it to the desired <a href="qtuitest.html">QtUiTest</a> interface using <a href="qtuitest.html">qtuitest_cast</a>.</p>
+<p>See also QObject::parent(), QWidget::parentWidget(), and <a href="qtuitest-widget.html#children">children</a>().</p>
+<h3 class="fn"><a name="rect"></a>QRect Widget::rect () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns the bounding rect of this widget in widget coordinates.</p>
+<p>The base implementation returns <a href="qtuitest-widget.html#geometry">geometry</a>(), transformed to widget coordinates.</p>
+<p>See also QWidget::rect().</p>
+<h3 class="fn"><a name="setEditFocus"></a>bool Widget::setEditFocus ( bool <i>enable</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Simulate the user input necessary to <i>enable</i> or disable edit focus for this widget. Enabling edit focus will implicitly call <a href="qtuitest-widget.html#setFocus">setFocus</a>() when necessary.</p>
+<p>The concept of edit focus only exists in Qt Embedded. This function must be implemented when using Qt Embedded. On other platforms, this function will behave the same as <a href="qtuitest-widget.html#setFocus">setFocus</a>() when enable is true, and will have no effect when enable is false.</p>
+<p>Returns true if edit focus was successfully enabled or disabled for this widget, false otherwise.</p>
+<p>See also QWidget::setEditFocus() and <a href="qtuitest-widget.html#hasEditFocus">hasEditFocus</a>().</p>
+<h3 class="fn"><a name="setFocus"></a>bool Widget::setFocus ()&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Simulate the user input necessary to move keyboard focus to this widget.</p>
+<p>The base implementation uses the result of <a href="qtuitest-widget.html#hasFocus">hasFocus</a>() to determine if the widget currently has focus. If in keypad mode, a sequence of Up or Down key presses will be used to move focus until this widget has focus. If in mouse mode, the center of this widget will be clicked once.</p>
+<p>Due to the way this function works in keypad mode, it is very important that <a href="qtuitest-widget.html#focusOutEvent">focusOutEvent</a>() is correctly implemented for all widgets to dismiss any &quot;grab&quot; effects on keyboard focus.</p>
+<p>When reimplementing this function, it is necessary to call <a href="qtuitest-widget.html#focusOutEvent">focusOutEvent</a>() on any widget before taking any action which could cause that widget to lose focus.</p>
+<p>Returns true if focus was successfully given to this widget, false otherwise.</p>
+<p>See also <a href="qtuitest-widget.html#hasFocus">hasFocus</a>(), QWidget::setFocus(), and <a href="qtuitest-widget.html#focusOutEvent">focusOutEvent</a>().</p>
+<h3 class="fn"><a name="visibleRegion"></a>QRegion Widget::visibleRegion () const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Returns the currently on-screen, unobscured region of this widget, in widget coordinates.</p>
+<p>See also QWidget::visibleRegion().</p>
+<h3 class="fn"><a name="width"></a>int Widget::width () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns the width of the widget.</p>
+<p>See also <a href="qtuitest-widget.html#geometry">geometry</a>().</p>
+<h3 class="fn"><a name="windowFlags"></a>Qt::WindowFlags Widget::windowFlags () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns the flags set on this widget.</p>
+<p>The default implementation returns 0, which is equivalent to a plain Qt::Widget with no special flags set.</p>
+<h3 class="fn"><a name="windowTitle"></a>QString Widget::windowTitle () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns the window title (caption).</p>
+<p>The returned string will typically be empty for all widgets other than top-level widgets.</p>
+<p>The default implementation returns an empty string.</p>
+<p>See also QWidget::windowTitle().</p>
+<h3 class="fn"><a name="x"></a>int Widget::x () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns the left of the widget, in global coordinates.</p>
+<p>See also <a href="qtuitest-widget.html#mapToGlobal">mapToGlobal</a>().</p>
+<h3 class="fn"><a name="y"></a>int Widget::y () const&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns the top of the widget, in global coordinates.</p>
+<p>See also <a href="qtuitest-widget.html#mapToGlobal">mapToGlobal</a>().</p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-widgetfactory-members.html b/doc/html/qtuitest-widgetfactory-members.html
new file mode 100644
index 0000000..b9ccd72
--- /dev/null
+++ b/doc/html/qtuitest-widgetfactory-members.html
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>List of All Members for WidgetFactory</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">List of All Members for WidgetFactory</h1>
+<p>This is the complete list of members for <a href="qtuitest-widgetfactory.html">QtUiTest::WidgetFactory</a>, including inherited members.</p>
+<ul>
+<li><div class="fn"><b><a href="qtuitest-widgetfactory.html#create">create</a></b> ( QObject * ) : QObject *</div></li>
+<li><div class="fn"><b><a href="qtuitest-widgetfactory.html#find">find</a></b> ( QtUiTest::WidgetType ) : QObject *</div></li>
+<li><div class="fn"><b><a href="qtuitest-widgetfactory.html#keys">keys</a></b> () const : QStringList</div></li>
+</ul>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest-widgetfactory.html b/doc/html/qtuitest-widgetfactory.html
new file mode 100644
index 0000000..dc74cad
--- /dev/null
+++ b/doc/html/qtuitest-widgetfactory.html
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestwidgetinterface.cpp -->
+<head>
+ <title>WidgetFactory Class Reference</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">WidgetFactory Class Reference<br /><span class="small-subtitle">(QtUiTest::WidgetFactory)<br />[QtUiTestModule]</span>
+</h1>
+<p>The WidgetFactory class provides a factory interface for <a href="qtuitest.html">QtUiTest</a> widget wrapper classes. <a href="#details">More...</a></p>
+<pre> #include &lt;<a href="qtuitest.html">QtUiTest</a>&gt;</pre><p><b>This class is under development and is subject to change.</b></p>
+<ul>
+<li><a href="qtuitest-widgetfactory-members.html">List of all members, including inherited members</a></li>
+</ul>
+<hr />
+<a name="public-functions"></a>
+<h2>Public Functions</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">virtual QObject * </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widgetfactory.html#create">create</a></b> ( QObject * <i>object</i> ) = 0</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QObject * </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widgetfactory.html#find">find</a></b> ( QtUiTest::WidgetType <i>type</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">virtual QStringList </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widgetfactory.html#keys">keys</a></b> () const = 0</td></tr>
+</table>
+<a name="details"></a>
+<hr />
+<h2>Detailed Description</h2>
+<p>The WidgetFactory class provides a factory interface for <a href="qtuitest.html">QtUiTest</a> widget wrapper classes.</p>
+<p>QtUiTest::WidgetFactory is an abstract base class which enables the creation of <a href="qtuitest.html">QtUiTest</a> wrapper objects around Qt/Qt Extended widgets.</p>
+<p>Customizing <a href="qtuitest.html">QtUiTest</a> behaviour for particular widgets is achieved by implementing one or more test widget classes which inherit from one or more <a href="qtuitest.html">QtUiTest</a> widget interfaces, subclassing QtUiTest::WidgetFactory, reimplementing the pure virtual <a href="qtuitest-widgetfactory.html#keys">keys</a>() and <a href="qtuitest-widgetfactory.html#create">create</a>() functions to create instances of the custom test widget classes, and exporting the factory class using the Q_EXPORT_PLUGIN2() macro.</p>
+<hr />
+<h2>Member Function Documentation</h2>
+<h3 class="fn"><a name="create"></a>QObject * WidgetFactory::create ( QObject * <i>object</i> )&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Attempts to create a test widget to wrap <i>object</i>. Returns the created test widget. Returns 0 if this factory does not support wrapping <i>object</i>.</p>
+<p>The returned object is suitable for use with <a href="qtuitest.html">qtuitest_cast</a>.</p>
+<p>This function will only be called for objects which inherit one of the classes returned by <a href="qtuitest-widgetfactory.html#keys">keys</a>().</p>
+<h3 class="fn"><a name="find"></a>QObject * WidgetFactory::find ( <a href="qtuitest.html#WidgetType-enum">QtUiTest::WidgetType</a> <i>type</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
+<p>Returns a widget or test widget of <i>type</i>, or 0 if none can be found.</p>
+<p>Reimplement this function to provide custom behaviour for QtUiTest::findWidget(). For example, if a custom soft menu widget is being used rather than the shipped ContextLabel class, this function must be reimplemented to return a pointer to the custom widget.</p>
+<p>The base implementation always returns 0.</p>
+<h3 class="fn"><a name="keys"></a>QStringList WidgetFactory::keys () const&nbsp;&nbsp;<tt> [pure virtual]</tt></h3>
+<p>Returns the list of C++ class names this factory can generate test widgets for.</p>
+<p>Note that returning a class from this function does not guarantee that the factory will always be able to generate a test widget for that class.</p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest.dcf b/doc/html/qtuitest.dcf
new file mode 100644
index 0000000..b7bfa4f
--- /dev/null
+++ b/doc/html/qtuitest.dcf
@@ -0,0 +1,318 @@
+<!DOCTYPE DCF>
+<DCF ref="index.html" icon="qtuitest.png" imagedir="../../gif" title="QtUiTest Reference Documentation">
+<section ref="classes.html" title="Classes">
+ <section ref="qtuitest-activatewidget.html" title="ActivateWidget Class Reference">
+ <keyword ref="qtuitest-activatewidget.html">ActivateWidget</keyword>
+ <keyword ref="qtuitest-activatewidget.html#activate">activate</keyword>
+ <keyword ref="qtuitest-activatewidget.html#activated">activated</keyword>
+ <section ref="qtuitest-activatewidget-members.html" title="List of all members"/>
+ </section>
+ <section ref="qtuitest-checkitemwidget.html" title="CheckItemWidget Class Reference">
+ <keyword ref="qtuitest-checkitemwidget.html">CheckItemWidget</keyword>
+ <keyword ref="qtuitest-checkitemwidget.html#isCheckable">isCheckable</keyword>
+ <keyword ref="qtuitest-checkitemwidget.html#isChecked">isChecked</keyword>
+ <keyword ref="qtuitest-checkitemwidget.html#setChecked">setChecked</keyword>
+ <section ref="qtuitest-checkitemwidget-members.html" title="List of all members"/>
+ </section>
+ <section ref="qtuitest-checkwidget.html" title="CheckWidget Class Reference">
+ <keyword ref="qtuitest-checkwidget.html">CheckWidget</keyword>
+ <keyword ref="qtuitest-checkwidget.html#checkState">checkState</keyword>
+ <keyword ref="qtuitest-checkwidget.html#isTristate">isTristate</keyword>
+ <keyword ref="qtuitest-checkwidget.html#setCheckState">setCheckState</keyword>
+ <keyword ref="qtuitest-checkwidget.html#stateChanged">stateChanged</keyword>
+ <section ref="qtuitest-checkwidget-members.html" title="List of all members"/>
+ </section>
+ <section ref="qtuitest-indexedwidget.html" title="IndexedWidget Class Reference">
+ <keyword ref="qtuitest-indexedwidget.html">IndexedWidget</keyword>
+ <keyword ref="qtuitest-indexedwidget.html#selectIndex">selectIndex</keyword>
+ <section ref="qtuitest-indexedwidget-members.html" title="List of all members"/>
+ </section>
+ <section ref="qtuitest-inputwidget.html" title="InputWidget Class Reference">
+ <keyword ref="qtuitest-inputwidget.html">InputWidget</keyword>
+ <keyword ref="qtuitest-inputwidget.html#canEnter">canEnter</keyword>
+ <keyword ref="qtuitest-inputwidget.html#enter">enter</keyword>
+ <keyword ref="qtuitest-inputwidget.html#entered">entered</keyword>
+ <section ref="qtuitest-inputwidget-members.html" title="List of all members"/>
+ </section>
+ <section ref="qtuitest-labelwidget.html" title="LabelWidget Class Reference">
+ <keyword ref="qtuitest-labelwidget.html">LabelWidget</keyword>
+ <keyword ref="qtuitest-labelwidget.html#buddy">buddy</keyword>
+ <keyword ref="qtuitest-labelwidget.html#labelText">labelText</keyword>
+ <section ref="qtuitest-labelwidget-members.html" title="List of all members"/>
+ </section>
+ <section ref="qtuitest-listwidget.html" title="ListWidget Class Reference">
+ <keyword ref="qtuitest-listwidget.html">ListWidget</keyword>
+ <keyword ref="qtuitest-listwidget.html#ensureVisible">ensureVisible</keyword>
+ <keyword ref="qtuitest-listwidget.html#list">list</keyword>
+ <keyword ref="qtuitest-listwidget.html#visualRect">visualRect</keyword>
+ <section ref="qtuitest-listwidget-members.html" title="List of all members"/>
+ </section>
+ <section ref="qsystemtest.html" title="QSystemTest Namespace Reference">
+ <keyword ref="qsystemtest.html">QSystemTest</keyword>
+ <keyword ref="qsystemtest.html#Array-typedef">Array</keyword>
+ <keyword ref="qsystemtest.html#Boolean-typedef">Boolean</keyword>
+ <keyword ref="qsystemtest.html#EnterMode-enum">EnterMode</keyword>
+ <keyword ref="qsystemtest.html#EnterMode-enum">QSystemTest::Commit</keyword>
+ <keyword ref="qsystemtest.html#EnterMode-enum">QSystemTest::NoCommit</keyword>
+ <keyword ref="qsystemtest.html#Function-typedef">Function</keyword>
+ <keyword ref="qsystemtest.html#LabelOrientation-enum">LabelOrientation</keyword>
+ <keyword ref="qsystemtest.html#LabelOrientation-enum">QSystemTest::LabelLeft</keyword>
+ <keyword ref="qsystemtest.html#LabelOrientation-enum">QSystemTest::LabelRight</keyword>
+ <keyword ref="qsystemtest.html#LabelOrientation-enum">QSystemTest::LabelBelow</keyword>
+ <keyword ref="qsystemtest.html#LabelOrientation-enum">QSystemTest::LabelAbove</keyword>
+ <keyword ref="qsystemtest.html#Number-typedef">Number</keyword>
+ <keyword ref="qsystemtest.html#QVariantArray-typedef">QVariantArray</keyword>
+ <keyword ref="qsystemtest.html#Role-enum">Role</keyword>
+ <keyword ref="qsystemtest.html#SkipMode-enum">SkipMode</keyword>
+ <keyword ref="qsystemtest.html#SkipMode-enum">QSystemTest::SkipSingle</keyword>
+ <keyword ref="qsystemtest.html#SkipMode-enum">QSystemTest::SkipAll</keyword>
+ <keyword ref="qsystemtest.html#StartApplicationFlag-enum">StartApplicationFlag</keyword>
+ <keyword ref="qsystemtest.html#StartApplicationFlag-enum">StartApplicationFlags</keyword>
+ <keyword ref="qsystemtest.html#StartApplicationFlag-enum">QSystemTest::WaitForFocus</keyword>
+ <keyword ref="qsystemtest.html#StartApplicationFlag-enum">QSystemTest::BackgroundCurrentApplication</keyword>
+ <keyword ref="qsystemtest.html#StartApplicationFlag-enum">QSystemTest::NoFlag</keyword>
+ <keyword ref="qsystemtest.html#StateFlag-enum">StateFlag</keyword>
+ <keyword ref="qsystemtest.html#StateFlag-enum">State</keyword>
+ <keyword ref="qsystemtest.html#StringArray-typedef">StringArray</keyword>
+ <keyword ref="qsystemtest.html#Q_ENUMS">Q_ENUMS</keyword>
+ <keyword ref="qsystemtest.html#activate">activate</keyword>
+ <keyword ref="qsystemtest.html#addExpectedMessageBox">addExpectedMessageBox</keyword>
+ <keyword ref="qsystemtest.html#checkOS">checkOS</keyword>
+ <keyword ref="qsystemtest.html#checkState">checkState</keyword>
+ <keyword ref="qsystemtest.html#clearExpectedMessageBox">clearExpectedMessageBox</keyword>
+ <keyword ref="qsystemtest.html#clearExpectedMessageBoxes">clearExpectedMessageBoxes</keyword>
+ <keyword ref="qsystemtest.html#compare">compare</keyword>
+ <keyword ref="qsystemtest.html#compareImage">compareImage</keyword>
+ <keyword ref="qsystemtest.html#currentApplication">currentApplication</keyword>
+ <keyword ref="qsystemtest.html#currentTitle">currentTitle</keyword>
+ <keyword ref="qsystemtest.html#deletePath">deletePath</keyword>
+ <keyword ref="qsystemtest.html#enter">enter</keyword>
+ <keyword ref="qsystemtest.html#expectApplicationClose">expectApplicationClose</keyword>
+ <keyword ref="qsystemtest.html#expectFail">expectFail</keyword>
+ <keyword ref="qsystemtest.html#expectMessageBox">expectMessageBox</keyword>
+ <keyword ref="qsystemtest.html#fail">fail</keyword>
+ <keyword ref="qsystemtest.html#findByProperty">findByProperty</keyword>
+ <keyword ref="qsystemtest.html#focusWidget">focusWidget</keyword>
+ <keyword ref="qsystemtest.html#getClipboardText">getClipboardText</keyword>
+ <keyword ref="qsystemtest.html#getData">getData</keyword>
+ <keyword ref="qsystemtest.html#getDateTime">getDateTime</keyword>
+ <keyword ref="qsystemtest.html#getDirectoryEntries">getDirectoryEntries</keyword>
+ <keyword ref="qsystemtest.html#getFile">getFile</keyword>
+ <keyword ref="qsystemtest.html#getGeometry">getGeometry</keyword>
+ <keyword ref="qsystemtest.html#getLabels">getLabels</keyword>
+ <keyword ref="qsystemtest.html#getList">getList</keyword>
+ <keyword ref="qsystemtest.html#getLocale">getLocale</keyword>
+ <keyword ref="qsystemtest.html#getProperty">getProperty</keyword>
+ <keyword ref="qsystemtest.html#getSelectedText">getSelectedText</keyword>
+ <keyword ref="qsystemtest.html#getSelectedValue">getSelectedValue</keyword>
+ <keyword ref="qsystemtest.html#getSetting">getSetting</keyword>
+ <keyword ref="qsystemtest.html#getText">getText</keyword>
+ <keyword ref="qsystemtest.html#getValue">getValue</keyword>
+ <keyword ref="qsystemtest.html#getenv">getenv</keyword>
+ <keyword ref="qsystemtest.html#ignoreMessageBoxes">ignoreMessageBoxes</keyword>
+ <keyword ref="qsystemtest.html#invokeMethod">invokeMethod</keyword>
+ <keyword ref="qsystemtest.html#isChecked">isChecked</keyword>
+ <keyword ref="qsystemtest.html#isEnabled">isEnabled</keyword>
+ <keyword ref="qsystemtest.html#isVisible">isVisible</keyword>
+ <keyword ref="qsystemtest.html#keyClick">keyClick</keyword>
+ <keyword ref="qsystemtest.html#keyClickHold">keyClickHold</keyword>
+ <keyword ref="qsystemtest.html#keyPress">keyPress</keyword>
+ <keyword ref="qsystemtest.html#keyRelease">keyRelease</keyword>
+ <keyword ref="qsystemtest.html#labelOrientation">labelOrientation</keyword>
+ <keyword ref="qsystemtest.html#mouseClick">mouseClick</keyword>
+ <keyword ref="qsystemtest.html#mouseClickHold">mouseClickHold</keyword>
+ <keyword ref="qsystemtest.html#mousePreferred">mousePreferred</keyword>
+ <keyword ref="qsystemtest.html#mousePress">mousePress</keyword>
+ <keyword ref="qsystemtest.html#mouseRelease">mouseRelease</keyword>
+ <keyword ref="qsystemtest.html#prompt">prompt</keyword>
+ <keyword ref="qsystemtest.html#putData">putData</keyword>
+ <keyword ref="qsystemtest.html#putFile">putFile</keyword>
+ <keyword ref="qsystemtest.html#readLocalFile">readLocalFile</keyword>
+ <keyword ref="qsystemtest.html#runProcess">runProcess</keyword>
+ <keyword ref="qsystemtest.html#runsOnDevice">runsOnDevice</keyword>
+ <keyword ref="qsystemtest.html#saveScreen">saveScreen</keyword>
+ <keyword ref="qsystemtest.html#select">select</keyword>
+ <keyword ref="qsystemtest.html#selectIndex">selectIndex</keyword>
+ <keyword ref="qsystemtest.html#setCheckState">setCheckState</keyword>
+ <keyword ref="qsystemtest.html#setChecked">setChecked</keyword>
+ <keyword ref="qsystemtest.html#setClipboardText">setClipboardText</keyword>
+ <keyword ref="qsystemtest.html#setLabelOrientation">setLabelOrientation</keyword>
+ <keyword ref="qsystemtest.html#setMousePreferred">setMousePreferred</keyword>
+ <keyword ref="qsystemtest.html#setProperty">setProperty</keyword>
+ <keyword ref="qsystemtest.html#setSetting">setSetting</keyword>
+ <keyword ref="qsystemtest.html#setVisibleResponseTime">setVisibleResponseTime</keyword>
+ <keyword ref="qsystemtest.html#signature">signature</keyword>
+ <keyword ref="qsystemtest.html#skip">skip</keyword>
+ <keyword ref="qsystemtest.html#startApplication">startApplication</keyword>
+ <keyword ref="qsystemtest.html#strict">strict</keyword>
+ <keyword ref="qsystemtest.html#tabBar">tabBar</keyword>
+ <keyword ref="qsystemtest.html#translate">translate</keyword>
+ <keyword ref="qsystemtest.html#userName">userName</keyword>
+ <keyword ref="qsystemtest.html#verify">verify</keyword>
+ <keyword ref="qsystemtest.html#verifyImage">verifyImage</keyword>
+ <keyword ref="qsystemtest.html#visibleResponseTime">visibleResponseTime</keyword>
+ <keyword ref="qsystemtest.html#wait">wait</keyword>
+ <keyword ref="qsystemtest.html#waitExpectedMessageBox">waitExpectedMessageBox</keyword>
+ <keyword ref="qsystemtest.html#waitFor">waitFor</keyword>
+ <keyword ref="qsystemtest.html#waitForTitle">waitForTitle</keyword>
+ </section>
+ <section ref="qtuitest.html" title="QtUiTest Namespace Reference">
+ <keyword ref="qtuitest.html">QtUiTest</keyword>
+ <keyword ref="qtuitest-activatewidget.html">ActivateWidget</keyword>
+ <keyword ref="qtuitest-checkitemwidget.html">CheckItemWidget</keyword>
+ <keyword ref="qtuitest-checkwidget.html">CheckWidget</keyword>
+ <keyword ref="qtuitest-indexedwidget.html">IndexedWidget</keyword>
+ <keyword ref="qtuitest-inputwidget.html">InputWidget</keyword>
+ <keyword ref="qtuitest-labelwidget.html">LabelWidget</keyword>
+ <keyword ref="qtuitest-listwidget.html">ListWidget</keyword>
+ <keyword ref="qtuitest-selectwidget.html">SelectWidget</keyword>
+ <keyword ref="qtuitest-testwidget.html">TestWidget</keyword>
+ <keyword ref="qtuitest-textwidget.html">TextWidget</keyword>
+ <keyword ref="qtuitest-widget.html">Widget</keyword>
+ <keyword ref="qtuitest-widgetfactory.html">WidgetFactory</keyword>
+ <keyword ref="qtuitest.html#InputOption-enum">InputOption</keyword>
+ <keyword ref="qtuitest.html#InputOption-enum">QtUiTest::KeyRepeat</keyword>
+ <keyword ref="qtuitest.html#InputOption-enum">QtUiTest::NoOptions</keyword>
+ <keyword ref="qtuitest.html#InputOption-enum">QtUiTest::DemoMode</keyword>
+ <keyword ref="qtuitest.html#Key-enum">Key</keyword>
+ <keyword ref="qtuitest.html#Key-enum">QtUiTest::Key_ActivateButton</keyword>
+ <keyword ref="qtuitest.html#Key-enum">QtUiTest::Key_Activate</keyword>
+ <keyword ref="qtuitest.html#Key-enum">QtUiTest::Key_Select</keyword>
+ <keyword ref="qtuitest.html#LabelOrientation-enum">LabelOrientation</keyword>
+ <keyword ref="qtuitest.html#WidgetType-enum">WidgetType</keyword>
+ <keyword ref="qtuitest.html#WidgetType-enum">QtUiTest::InputMethod</keyword>
+ <keyword ref="qtuitest.html#WidgetType-enum">QtUiTest::Focus</keyword>
+ <keyword ref="qtuitest.html#WidgetType-enum">QtUiTest::SoftMenu</keyword>
+ <keyword ref="qtuitest.html#WidgetType-enum">QtUiTest::OptionsMenu</keyword>
+ <keyword ref="qtuitest.html#WidgetType-enum">QtUiTest::HomeScreen</keyword>
+ <keyword ref="qtuitest.html#WidgetType-enum">QtUiTest::Launcher</keyword>
+ <keyword ref="qtuitest.html#WidgetType-enum">QtUiTest::TabBar</keyword>
+ <keyword ref="qtuitest.html#qtuitest_cast">qtuitest_cast</keyword>
+ </section>
+ <section ref="qtuitestrecorder.html" title="QtUiTestRecorder Class Reference">
+ <keyword ref="qtuitestrecorder.html">QtUiTestRecorder</keyword>
+ <keyword ref="qtuitestrecorder.html#activated">activated</keyword>
+ <keyword ref="qtuitestrecorder.html#entered">entered</keyword>
+ <keyword ref="qtuitestrecorder.html#gotFocus">gotFocus</keyword>
+ <keyword ref="qtuitestrecorder.html#keyEvent">keyEvent</keyword>
+ <keyword ref="qtuitestrecorder.html#mouseEvent">mouseEvent</keyword>
+ <keyword ref="qtuitestrecorder.html#selected">selected</keyword>
+ <keyword ref="qtuitestrecorder.html#stateChanged">stateChanged</keyword>
+ <section ref="qtuitestrecorder-members.html" title="List of all members"/>
+ </section>
+ <section ref="qtuitest-selectwidget.html" title="SelectWidget Class Reference">
+ <keyword ref="qtuitest-selectwidget.html">SelectWidget</keyword>
+ <keyword ref="qtuitest-selectwidget.html#canSelect">canSelect</keyword>
+ <keyword ref="qtuitest-selectwidget.html#canSelectMulti">canSelectMulti</keyword>
+ <keyword ref="qtuitest-selectwidget.html#isMultiSelection">isMultiSelection</keyword>
+ <keyword ref="qtuitest-selectwidget.html#select">select</keyword>
+ <keyword ref="qtuitest-selectwidget.html#selectMulti">selectMulti</keyword>
+ <keyword ref="qtuitest-selectwidget.html#selected">selected</keyword>
+ <section ref="qtuitest-selectwidget-members.html" title="List of all members"/>
+ </section>
+ <section ref="qtuitest-testwidget.html" title="TestWidget Class Reference">
+ <keyword ref="qtuitest-testwidget.html">TestWidget</keyword>
+ <keyword ref="qtuitest-testwidget.html#canEnter">canEnter</keyword>
+ <keyword ref="qtuitest-testwidget.html#canWrap">canWrap</keyword>
+ <keyword ref="qtuitest-testwidget.html#children">children</keyword>
+ <keyword ref="qtuitest-testwidget.html#ensureVisibleRegion">ensureVisibleRegion</keyword>
+ <keyword ref="qtuitest-testwidget.html#enter">enter</keyword>
+ <keyword ref="qtuitest-testwidget.html#eventFilter">eventFilter</keyword>
+ <keyword ref="qtuitest-testwidget.html#focusOutEvent">focusOutEvent</keyword>
+ <keyword ref="qtuitest-testwidget.html#focusPolicy">focusPolicy</keyword>
+ <keyword ref="qtuitest-testwidget.html#focusProxy">focusProxy</keyword>
+ <keyword ref="qtuitest-testwidget.html#geometry">geometry</keyword>
+ <keyword ref="qtuitest-testwidget.html#gotFocus">gotFocus</keyword>
+ <keyword ref="qtuitest-testwidget.html#grabPixmap">grabPixmap</keyword>
+ <keyword ref="qtuitest-testwidget.html#hasFocus">hasFocus</keyword>
+ <keyword ref="qtuitest-testwidget.html#isVisible">isVisible</keyword>
+ <keyword ref="qtuitest-testwidget.html#labelText">labelText</keyword>
+ <keyword ref="qtuitest-testwidget.html#mapFromGlobal">mapFromGlobal</keyword>
+ <keyword ref="qtuitest-testwidget.html#mapToGlobal">mapToGlobal</keyword>
+ <keyword ref="qtuitest-testwidget.html#parent">parent</keyword>
+ <keyword ref="qtuitest-testwidget.html#printable">printable</keyword>
+ <keyword ref="qtuitest-testwidget.html#rect">rect</keyword>
+ <keyword ref="qtuitest-testwidget.html#setEditFocus">setEditFocus</keyword>
+ <keyword ref="qtuitest-testwidget.html#visibleRegion">visibleRegion</keyword>
+ <keyword ref="qtuitest-testwidget.html#windowFlags">windowFlags</keyword>
+ <keyword ref="qtuitest-testwidget.html#windowTitle">windowTitle</keyword>
+ <section ref="qtuitest-testwidget-members.html" title="List of all members"/>
+ </section>
+ <section ref="qtuitest-textwidget.html" title="TextWidget Class Reference">
+ <keyword ref="qtuitest-textwidget.html">TextWidget</keyword>
+ <keyword ref="qtuitest-textwidget.html#selectedText">selectedText</keyword>
+ <keyword ref="qtuitest-textwidget.html#selectedValue">selectedValue</keyword>
+ <keyword ref="qtuitest-textwidget.html#text">text</keyword>
+ <keyword ref="qtuitest-textwidget.html#value">value</keyword>
+ <section ref="qtuitest-textwidget-members.html" title="List of all members"/>
+ </section>
+ <section ref="qtuitest-widget.html" title="Widget Class Reference">
+ <keyword ref="qtuitest-widget.html">Widget</keyword>
+ <keyword ref="qtuitest-widget.html#center">center</keyword>
+ <keyword ref="qtuitest-widget.html#children">children</keyword>
+ <keyword ref="qtuitest-widget.html#childrenVisibleRegion">childrenVisibleRegion</keyword>
+ <keyword ref="qtuitest-widget.html#ensureVisiblePoint">ensureVisiblePoint</keyword>
+ <keyword ref="qtuitest-widget.html#ensureVisibleRegion">ensureVisibleRegion</keyword>
+ <keyword ref="qtuitest-widget.html#focusOutEvent">focusOutEvent</keyword>
+ <keyword ref="qtuitest-widget.html#focusPolicy">focusPolicy</keyword>
+ <keyword ref="qtuitest-widget.html#focusProxy">focusProxy</keyword>
+ <keyword ref="qtuitest-widget.html#geometry">geometry</keyword>
+ <keyword ref="qtuitest-widget.html#gotFocus">gotFocus</keyword>
+ <keyword ref="qtuitest-widget.html#grabPixmap">grabPixmap</keyword>
+ <keyword ref="qtuitest-widget.html#hasEditFocus">hasEditFocus</keyword>
+ <keyword ref="qtuitest-widget.html#hasFocus">hasFocus</keyword>
+ <keyword ref="qtuitest-widget.html#height">height</keyword>
+ <keyword ref="qtuitest-widget.html#ignoreBuddy">ignoreBuddy</keyword>
+ <keyword ref="qtuitest-widget.html#ignoreScan">ignoreScan</keyword>
+ <keyword ref="qtuitest-widget.html#inherits">inherits</keyword>
+ <keyword ref="qtuitest-widget.html#isVisible">isVisible</keyword>
+ <keyword ref="qtuitest-widget.html#mapFromGlobal">mapFromGlobal</keyword>
+ <keyword ref="qtuitest-widget.html#mapToGlobal">mapToGlobal</keyword>
+ <keyword ref="qtuitest-widget.html#parent">parent</keyword>
+ <keyword ref="qtuitest-widget.html#rect">rect</keyword>
+ <keyword ref="qtuitest-widget.html#setEditFocus">setEditFocus</keyword>
+ <keyword ref="qtuitest-widget.html#setFocus">setFocus</keyword>
+ <keyword ref="qtuitest-widget.html#visibleRegion">visibleRegion</keyword>
+ <keyword ref="qtuitest-widget.html#width">width</keyword>
+ <keyword ref="qtuitest-widget.html#windowFlags">windowFlags</keyword>
+ <keyword ref="qtuitest-widget.html#windowTitle">windowTitle</keyword>
+ <keyword ref="qtuitest-widget.html#x">x</keyword>
+ <keyword ref="qtuitest-widget.html#y">y</keyword>
+ <section ref="qtuitest-widget-members.html" title="List of all members"/>
+ </section>
+ <section ref="qtuitest-widgetfactory.html" title="WidgetFactory Class Reference">
+ <keyword ref="qtuitest-widgetfactory.html">WidgetFactory</keyword>
+ <keyword ref="qtuitest-widgetfactory.html#create">create</keyword>
+ <keyword ref="qtuitest-widgetfactory.html#find">find</keyword>
+ <keyword ref="qtuitest-widgetfactory.html#keys">keys</keyword>
+ <section ref="qtuitest-widgetfactory-members.html" title="List of all members"/>
+ </section>
+</section>
+<section ref="overviews.html" title="Overviews">
+ <section ref="qtuitest-tutorial1.html" title="Chapter 1: Writing a System Test">
+ <keyword ref="qtuitest-tutorial1.html">Chapter 1: Writing a System Test</keyword>
+ </section>
+ <section ref="qtuitest-tutorial2.html" title="Chapter 2: Input, Output and Widget Navigation">
+ <keyword ref="qtuitest-tutorial2.html">Chapter 2: Input, Output and Widget Navigation</keyword>
+ </section>
+ <section ref="qtuitest-tutorial3.html" title="Chapter 3: Data driven testing">
+ <keyword ref="qtuitest-tutorial3.html">Chapter 3: Data driven testing</keyword>
+ </section>
+ <section ref="qtuitest-tutorial4.html" title="Chapter 4: Putting It All Together">
+ <keyword ref="qtuitest-tutorial4.html">Chapter 4: Putting It All Together</keyword>
+ </section>
+ <section ref="qtuitest-plugins.html" title="Creating a QtUiTest Test Widget">
+ <keyword ref="qtuitest-plugins.html">Creating a QtUiTest Test Widget</keyword>
+ </section>
+ <section ref="index.html" title="Qt Reference Documentation">
+ <keyword ref="index.html">Qt Reference Documentation</keyword>
+ </section>
+ <section ref="qtuitest-manual.html" title="QtUiTest Manual">
+ <keyword ref="qtuitest-manual.html">QtUiTest Manual</keyword>
+ </section>
+ <section ref="qtuitest-tutorial.html" title="QtUiTest Tutorial">
+ <keyword ref="qtuitest-tutorial.html">QtUiTest Tutorial</keyword>
+ </section>
+</section>
+<section ref="examples.html" title="Tutorial &amp; Examples"/>
+</DCF>
diff --git a/doc/html/qtuitest.html b/doc/html/qtuitest.html
new file mode 100644
index 0000000..39acc1e
--- /dev/null
+++ b/doc/html/qtuitest.html
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestnamespace.cpp -->
+<head>
+ <title>QtUiTest Namespace Reference</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">QtUiTest Namespace Reference<br /><span class="small-subtitle">[QtUiTestModule]</span>
+</h1>
+<p>The QtUiTest namespace provides the plugin interfaces used for customizing the behaviour of QtUiTest. <a href="#details">More...</a></p>
+<pre> #include &lt;QtUiTest&gt;</pre><p><b>This namespace is under development and is subject to change.</b></p>
+<ul>
+</ul>
+<hr />
+<a name="classes"></a>
+<h2>Classes</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-activatewidget.html">ActivateWidget</a></b>&nbsp;&nbsp;<tt> (preliminary)</tt></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-checkitemwidget.html">CheckItemWidget</a></b>&nbsp;&nbsp;<tt> (preliminary)</tt></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-checkwidget.html">CheckWidget</a></b>&nbsp;&nbsp;<tt> (preliminary)</tt></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-indexedwidget.html">IndexedWidget</a></b>&nbsp;&nbsp;<tt> (preliminary)</tt></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-inputwidget.html">InputWidget</a></b>&nbsp;&nbsp;<tt> (preliminary)</tt></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-labelwidget.html">LabelWidget</a></b>&nbsp;&nbsp;<tt> (preliminary)</tt></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-listwidget.html">ListWidget</a></b>&nbsp;&nbsp;<tt> (preliminary)</tt></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-selectwidget.html">SelectWidget</a></b>&nbsp;&nbsp;<tt> (preliminary)</tt></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-testwidget.html">TestWidget</a></b></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-textwidget.html">TextWidget</a></b>&nbsp;&nbsp;<tt> (preliminary)</tt></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widget.html">Widget</a></b>&nbsp;&nbsp;<tt> (preliminary)</tt></td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">class </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest-widgetfactory.html">WidgetFactory</a></b>&nbsp;&nbsp;<tt> (preliminary)</tt></td></tr>
+</table>
+<hr />
+<a name="types"></a>
+<h2>Types</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest.html#InputOption-enum">InputOption</a></b> { NoOptions, DemoMode, KeyRepeat }</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest.html#Key-enum">Key</a></b> { Key_Activate, Key_ActivateButton, Key_Select }</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest.html#LabelOrientation-enum">LabelOrientation</a></b> { LabelLeft, LabelRight, LabelAbove, LabelBelow }</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest.html#WidgetType-enum">WidgetType</a></b> { Focus, InputMethod, SoftMenu, OptionsMenu, ..., Launcher }</td></tr>
+</table>
+<hr />
+<a name="functions"></a>
+<h2>Functions</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">T </td><td class="memItemRight" valign="bottom"><b><a href="qtuitest.html#qtuitest_cast">qtuitest_cast</a></b> ( const QObject * <i>object</i> )</td></tr>
+</table>
+<a name="details"></a>
+<hr />
+<h2>Detailed Description</h2>
+<p>The QtUiTest namespace provides the plugin interfaces used for customizing the behaviour of QtUiTest.</p>
+<p>When running a <a href="qsystemtest.html">Qt Extended system test</a>, functions such as <a href="qsystemtest.html#select">select()</a> and <a href="qsystemtest.html#getText">getText()</a> are used to perform actions and retrieve information from widgets. This is implemented by wrapping each conceptual widget (which is not necessarily a QWidget) with a test widget class.</p>
+<p>These test widgets each implement one or more of the widget interfaces in the QtUiTest namespace. The interfaces are used to determine what actions can be taken on a particular widget, and how to perform them.</p>
+<p>For example, when the following system test code executes:</p>
+<pre> select(&quot;Dog&quot;, &quot;Favorite Animal&quot;);</pre>
+<p>QtUiTest will first look up the QWidget which is labelled by the text &quot;Favorite Animal&quot;. It will then use qtuitest_cast to cast this widget to a <a href="qtuitest-selectwidget.html">QtUiTest::SelectWidget</a>. If this is successful, it will then call <a href="qtuitest-selectwidget.html#select">select</a>(&quot;Dog&quot;) on the list widget.</p>
+<p>It is possible to customize the behavior of QtUiTest for particular widgets by creating custom test widget classes and a <a href="qtuitest-widgetfactory.html">QtUiTest::WidgetFactory</a> factory class to wrap QObject instances in test widgets.</p>
+<hr />
+<h2>Classes</h2>
+<h3> class <a href="qtuitest-activatewidget.html">ActivateWidget</a></h3><p>The ActivateWidget class provides an abstract base class for all test widgets which can conceptually be &quot;activated&quot; by a user. <a href="qtuitest-activatewidget.html#details">More...</a></p>
+<h3> class <a href="qtuitest-checkitemwidget.html">CheckItemWidget</a></h3><p>The CheckItemWidget class provides an abstract base class for all test widgets which include items that support 'checked' and 'unchecked' states. <a href="qtuitest-checkitemwidget.html#details">More...</a></p>
+<h3> class <a href="qtuitest-checkwidget.html">CheckWidget</a></h3><p>The CheckWidget class provides an abstract base class for all test widgets which support 'checked' and 'unchecked' states. <a href="qtuitest-checkwidget.html#details">More...</a></p>
+<h3> class <a href="qtuitest-indexedwidget.html">IndexedWidget</a></h3><p>The IndexedWidget class provides an abstract base class for all test widgets which allow the user to select items based on index. <a href="qtuitest-indexedwidget.html#details">More...</a></p>
+<h3> class <a href="qtuitest-inputwidget.html">InputWidget</a></h3><p>The InputWidget class provides an abstract base class for all test widgets which allow the user to input text. <a href="qtuitest-inputwidget.html#details">More...</a></p>
+<h3> class <a href="qtuitest-labelwidget.html">LabelWidget</a></h3><p>The LabelWidget class provides an abstract base class for all test widgets which are conceptually labels. <a href="qtuitest-labelwidget.html#details">More...</a></p>
+<h3> class <a href="qtuitest-listwidget.html">ListWidget</a></h3><p>The ListWidget class provides an abstract base class for all test widgets which display a list of items to the user. <a href="qtuitest-listwidget.html#details">More...</a></p>
+<h3> class <a href="qtuitest-selectwidget.html">SelectWidget</a></h3><p>The SelectWidget class provides an abstract base class for all test widgets which allow the user to select from a range of items. <a href="qtuitest-selectwidget.html#details">More...</a></p>
+<h3> class <a href="qtuitest-testwidget.html">TestWidget</a></h3><h3> class <a href="qtuitest-textwidget.html">TextWidget</a></h3><p>The TextWidget class provides an abstract base class for all test widgets which display text to the user. <a href="qtuitest-textwidget.html#details">More...</a></p>
+<h3> class <a href="qtuitest-widget.html">Widget</a></h3><p>The Widget class provides an abstract base class for all test widgets. <a href="qtuitest-widget.html#details">More...</a></p>
+<h3> class <a href="qtuitest-widgetfactory.html">WidgetFactory</a></h3><p>The WidgetFactory class provides a factory interface for <a href="qtuitest.html">QtUiTest</a> widget wrapper classes. <a href="qtuitest-widgetfactory.html#details">More...</a></p>
+<hr />
+<h2>Type Documentation</h2>
+<h3 class="fn"><a name="InputOption-enum"></a>enum QtUiTest::InputOption</h3>
+<p>This enum type specifies the options to be used when simulating key and mouse events.</p>
+<p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%">
+<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
+<tr><td valign="top"><tt>QtUiTest::NoOptions</tt></td><td align="center" valign="top"><tt>0x0</tt></td><td valign="top">no options.</td></tr>
+<tr><td valign="top"><tt>QtUiTest::DemoMode</tt></td><td align="center" valign="top"><tt>0x1</tt></td><td valign="top">when simulating, force artificial delays between key and mouse events, and animate some events.</td></tr>
+<tr><td valign="top"><tt>QtUiTest::KeyRepeat</tt></td><td align="center" valign="top"><tt>0x2</tt></td><td valign="top">when simulating key press events, simulate auto-repeat key press events. The default is to simulate regular key press events.</td></tr>
+</table></p>
+<h3 class="fn"><a name="Key-enum"></a>enum QtUiTest::Key</h3>
+<p>This enum provides mappings for high-level conceptual keys to platform-specific values of Qt::Key.</p>
+<p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%">
+<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
+<tr><td valign="top"><tt>QtUiTest::Key_Activate</tt></td><td align="center" valign="top"><tt>Qt::Key_Enter</tt></td><td valign="top">Key used to activate generic UI elements.</td></tr>
+<tr><td valign="top"><tt>QtUiTest::Key_ActivateButton</tt></td><td align="center" valign="top"><tt>Qt::Key_Space</tt></td><td valign="top">Key used to activate buttons.</td></tr>
+<tr><td valign="top"><tt>QtUiTest::Key_Select</tt></td><td align="center" valign="top"><tt>Qt::Key_Space</tt></td><td valign="top">Key used to select an item from lists.</td></tr>
+</table></p>
+<h3 class="fn"><a name="LabelOrientation-enum"></a>enum QtUiTest::LabelOrientation</h3>
+<h3 class="fn"><a name="WidgetType-enum"></a>enum QtUiTest::WidgetType</h3>
+<p>This enum type specifies different types of widgets which can be retrieved via QtUiTest::findWidget().</p>
+<p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%">
+<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
+<tr><td valign="top"><tt>QtUiTest::Focus</tt></td><td align="center" valign="top"><tt>6</tt></td><td valign="top">The widget which currently has keyboard focus. Note that this need not be located in the current application.</td></tr>
+<tr><td valign="top"><tt>QtUiTest::InputMethod</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">A currently active input method widget.</td></tr>
+<tr><td valign="top"><tt>QtUiTest::SoftMenu</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">A currently displayed soft menu bar.</td></tr>
+<tr><td valign="top"><tt>QtUiTest::OptionsMenu</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">The context/options menu which is currently shown, or would be shown if the user attempted to raise a context menu (typically by pressing Qt::Key_Context1).</td></tr>
+<tr><td valign="top"><tt>QtUiTest::TabBar</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">The tab bar for the currently active tab widget, if one exists. <a href="qtuitest.html">QtUiTest</a> is not designed to handle multiple nested tab widgets.</td></tr>
+<tr><td valign="top"><tt>QtUiTest::HomeScreen</tt></td><td align="center" valign="top"><tt>5</tt></td><td valign="top">The home screen widget.</td></tr>
+<tr><td valign="top"><tt>QtUiTest::Launcher</tt></td><td align="center" valign="top"><tt>4</tt></td><td valign="top">The widget (typically a grid-like menu) in the server process used for launching applications.</td></tr>
+</table></p>
+<hr />
+<h2>Function Documentation</h2>
+<h3 class="fn"><a name="qtuitest_cast"></a>T qtuitest_cast ( const QObject * <i>object</i> )</h3>
+<p>Casts <i>object</i> to the specified Qt Extended test widget interface <tt>T</tt>.</p>
+<p>If <i>object</i> already implements <tt>T</tt>, it is simply casted and returned. Otherwise, <a href="qtuitest.html">QtUiTest</a> will attempt to find or create a test widget to wrap <i>object</i>, using all loaded <a href="qtuitest-widgetfactory.html">QtUiTest::WidgetFactory</a> plugins. If a test widget cannot be created to wrap <i>object</i>, 0 is returned.</p>
+<p>In either case, the returned value must not be deleted by the caller.</p>
+<p>Example:</p>
+<pre><span class="comment"> // Attempt to select the item &quot;Foo&quot; from the given widget</span>
+ bool selectFoo(QWidget *widget) {
+ QtUiTest::SelectWidget* sw
+ = qtuitest_cast&lt;QtUiTest::SelectWidget*&gt;(widget);
+ if (!sw || !sw-&gt;canSelect(&quot;Foo&quot;)) {
+ return false;
+ }
+ return sw-&gt;select(&quot;Foo&quot;);
+ }</pre>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitest.index b/doc/html/qtuitest.index
new file mode 100644
index 0000000..fbbfb69
--- /dev/null
+++ b/doc/html/qtuitest.index
@@ -0,0 +1,801 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE QDOCINDEX>
+<INDEX url="http://doc.trolltech.com/" title="QtUiTest Reference Documentation" version="">
+ <namespace access="public" threadsafety="unspecified" status="commendable" name="" href="" location="" module="">
+ <typedef access="public" threadsafety="unspecified" status="commendable" name="QAlternateStackEntryPoint" href="qalternatestack.html#QAlternateStackEntryPoint-typedef" location="qalternatestack_p.h"/>
+ <namespace access="public" threadsafety="unspecified" status="preliminary" name="QtUiTest" href="qtuitest.html" location="qtuitestwidgetinterface.h" module="">
+ <class access="public" threadsafety="unspecified" status="preliminary" name="WidgetFactory" fullname="QtUiTest::WidgetFactory" href="qtuitest-widgetfactory.html" location="qtuitestwidgetinterface.h" bases="" module="">
+ <function access="public" threadsafety="unspecified" status="commendable" name="create" fullname="QtUiTest::WidgetFactory::create" href="qtuitest-widgetfactory.html#create" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="false" static="false" overload="false" type="QObject *" signature="create(QObject * object)">
+ <parameter left="QObject *" right="" name="object" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="find" fullname="QtUiTest::WidgetFactory::find" href="qtuitest-widgetfactory.html#find" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="false" static="false" overload="false" type="QObject *" signature="find(QtUiTest::WidgetType type)">
+ <parameter left="QtUiTest::WidgetType" right="" name="type" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="keys" fullname="QtUiTest::WidgetFactory::keys" href="qtuitest-widgetfactory.html#keys" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="true" static="false" overload="false" type="QStringList" signature="keys() const"/>
+ </class>
+ <class access="public" threadsafety="unspecified" status="preliminary" name="Widget" fullname="QtUiTest::Widget" href="qtuitest-widget.html" location="qtuitestwidgetinterface.h" bases="" module="">
+ <function access="public" threadsafety="unspecified" status="commendable" name="geometry" fullname="QtUiTest::Widget::geometry" href="qtuitest-widget.html#geometry" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="true" static="false" overload="false" type="const QRect &amp;" signature="geometry() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="rect" fullname="QtUiTest::Widget::rect" href="qtuitest-widget.html#rect" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="QRect" signature="rect() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="x" fullname="QtUiTest::Widget::x" href="qtuitest-widget.html#x" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="int" signature="x() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="y" fullname="QtUiTest::Widget::y" href="qtuitest-widget.html#y" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="int" signature="y() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="width" fullname="QtUiTest::Widget::width" href="qtuitest-widget.html#width" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="int" signature="width() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="height" fullname="QtUiTest::Widget::height" href="qtuitest-widget.html#height" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="int" signature="height() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="isVisible" fullname="QtUiTest::Widget::isVisible" href="qtuitest-widget.html#isVisible" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="true" static="false" overload="false" type="bool" signature="isVisible() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="visibleRegion" fullname="QtUiTest::Widget::visibleRegion" href="qtuitest-widget.html#visibleRegion" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="true" static="false" overload="false" type="QRegion" signature="visibleRegion() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="parent" fullname="QtUiTest::Widget::parent" href="qtuitest-widget.html#parent" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="true" static="false" overload="false" type="QObject *" signature="parent() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="windowTitle" fullname="QtUiTest::Widget::windowTitle" href="qtuitest-widget.html#windowTitle" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="QString" signature="windowTitle() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="children" fullname="QtUiTest::Widget::children" href="qtuitest-widget.html#children" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="true" static="false" overload="false" type="const QObjectList &amp;" signature="children() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="childrenVisibleRegion" fullname="QtUiTest::Widget::childrenVisibleRegion" href="qtuitest-widget.html#childrenVisibleRegion" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="QRegion" signature="childrenVisibleRegion() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="mapToGlobal" fullname="QtUiTest::Widget::mapToGlobal" href="qtuitest-widget.html#mapToGlobal" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="true" static="false" overload="false" type="QPoint" signature="mapToGlobal(const QPoint &amp; pos) const">
+ <parameter left="const QPoint &amp;" right="" name="pos" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="mapFromGlobal" fullname="QtUiTest::Widget::mapFromGlobal" href="qtuitest-widget.html#mapFromGlobal" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="true" static="false" overload="false" type="QPoint" signature="mapFromGlobal(const QPoint &amp; pos) const">
+ <parameter left="const QPoint &amp;" right="" name="pos" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="center" fullname="QtUiTest::Widget::center" href="qtuitest-widget.html#center" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="QPoint" signature="center() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="ensureVisibleRegion" fullname="QtUiTest::Widget::ensureVisibleRegion" href="qtuitest-widget.html#ensureVisibleRegion" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="false" static="false" overload="false" type="bool" signature="ensureVisibleRegion(const QRegion &amp; region)">
+ <parameter left="const QRegion &amp;" right="" name="region" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="ensureVisiblePoint" fullname="QtUiTest::Widget::ensureVisiblePoint" href="qtuitest-widget.html#ensureVisiblePoint" location="qtuitestwidgetinterface.h" virtual="non" meta="plain" const="false" static="false" overload="false" type="bool" signature="ensureVisiblePoint(const QPoint &amp; point)">
+ <parameter left="const QPoint &amp;" right="" name="point" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="setFocus" fullname="QtUiTest::Widget::setFocus" href="qtuitest-widget.html#setFocus" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="false" static="false" overload="false" type="bool" signature="setFocus()"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="focusOutEvent" fullname="QtUiTest::Widget::focusOutEvent" href="qtuitest-widget.html#focusOutEvent" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="false" static="false" overload="false" type="void" signature="focusOutEvent()"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="hasFocus" fullname="QtUiTest::Widget::hasFocus" href="qtuitest-widget.html#hasFocus" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="true" static="false" overload="false" type="bool" signature="hasFocus() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="focusProxy" fullname="QtUiTest::Widget::focusProxy" href="qtuitest-widget.html#focusProxy" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="QObject *" signature="focusProxy() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="focusPolicy" fullname="QtUiTest::Widget::focusPolicy" href="qtuitest-widget.html#focusPolicy" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="Qt::FocusPolicy" signature="focusPolicy() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="windowFlags" fullname="QtUiTest::Widget::windowFlags" href="qtuitest-widget.html#windowFlags" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="Qt::WindowFlags" signature="windowFlags() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="hasEditFocus" fullname="QtUiTest::Widget::hasEditFocus" href="qtuitest-widget.html#hasEditFocus" location="qtuitestwidgetinterface.cpp" virtual="impure" meta="plain" const="true" static="false" overload="false" type="bool" signature="hasEditFocus() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="setEditFocus" fullname="QtUiTest::Widget::setEditFocus" href="qtuitest-widget.html#setEditFocus" location="qtuitestwidgetinterface.cpp" virtual="impure" meta="plain" const="false" static="false" overload="false" type="bool" signature="setEditFocus(bool enable)">
+ <parameter left="bool" right="" name="enable" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="inherits" fullname="QtUiTest::Widget::inherits" href="qtuitest-widget.html#inherits" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="bool" signature="inherits(QtUiTest::WidgetType type) const">
+ <parameter left="QtUiTest::WidgetType" right="" name="type" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="grabPixmap" fullname="QtUiTest::Widget::grabPixmap" href="qtuitest-widget.html#grabPixmap" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="bool" signature="grabPixmap(QPixmap &amp; pixmap) const">
+ <parameter left="QPixmap &amp;" right="" name="pixmap" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="ignoreScan" fullname="QtUiTest::Widget::ignoreScan" href="qtuitest-widget.html#ignoreScan" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="bool" signature="ignoreScan() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="ignoreBuddy" fullname="QtUiTest::Widget::ignoreBuddy" href="qtuitest-widget.html#ignoreBuddy" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="bool" signature="ignoreBuddy() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="gotFocus" fullname="QtUiTest::Widget::gotFocus" href="qtuitest-widget.html#gotFocus" location="qtuitestwidgetinterface.h" virtual="non" meta="signal" const="false" static="false" overload="false" type="void" signature="gotFocus()"/>
+ </class>
+ <class access="public" threadsafety="unspecified" status="preliminary" name="ActivateWidget" fullname="QtUiTest::ActivateWidget" href="qtuitest-activatewidget.html" location="qtuitestwidgetinterface.h" bases="" module="">
+ <function access="public" threadsafety="unspecified" status="commendable" name="activate" fullname="QtUiTest::ActivateWidget::activate" href="qtuitest-activatewidget.html#activate" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="false" static="false" overload="false" type="bool" signature="activate()"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="activated" fullname="QtUiTest::ActivateWidget::activated" href="qtuitest-activatewidget.html#activated" location="qtuitestwidgetinterface.h" virtual="non" meta="signal" const="false" static="false" overload="false" type="void" signature="activated()"/>
+ </class>
+ <class access="public" threadsafety="unspecified" status="preliminary" name="LabelWidget" fullname="QtUiTest::LabelWidget" href="qtuitest-labelwidget.html" location="qtuitestwidgetinterface.h" bases="" module="">
+ <function access="public" threadsafety="unspecified" status="commendable" name="labelText" fullname="QtUiTest::LabelWidget::labelText" href="qtuitest-labelwidget.html#labelText" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="true" static="false" overload="false" type="QString" signature="labelText() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="buddy" fullname="QtUiTest::LabelWidget::buddy" href="qtuitest-labelwidget.html#buddy" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="QObject *" signature="buddy() const"/>
+ </class>
+ <class access="public" threadsafety="unspecified" status="preliminary" name="CheckWidget" fullname="QtUiTest::CheckWidget" href="qtuitest-checkwidget.html" location="qtuitestwidgetinterface.h" bases="" module="">
+ <function access="public" threadsafety="unspecified" status="commendable" name="isTristate" fullname="QtUiTest::CheckWidget::isTristate" href="qtuitest-checkwidget.html#isTristate" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="bool" signature="isTristate() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="checkState" fullname="QtUiTest::CheckWidget::checkState" href="qtuitest-checkwidget.html#checkState" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="true" static="false" overload="false" type="Qt::CheckState" signature="checkState() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="setCheckState" fullname="QtUiTest::CheckWidget::setCheckState" href="qtuitest-checkwidget.html#setCheckState" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="false" static="false" overload="false" type="bool" signature="setCheckState(Qt::CheckState state)">
+ <parameter left="Qt::CheckState" right="" name="state" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="stateChanged" fullname="QtUiTest::CheckWidget::stateChanged" href="qtuitest-checkwidget.html#stateChanged" location="qtuitestwidgetinterface.h" virtual="non" meta="signal" const="false" static="false" overload="false" type="void" signature="stateChanged(int state)">
+ <parameter left="int" right="" name="state" default=""/>
+ </function>
+ </class>
+ <class access="public" threadsafety="unspecified" status="preliminary" name="TextWidget" fullname="QtUiTest::TextWidget" href="qtuitest-textwidget.html" location="qtuitestwidgetinterface.h" bases="" module="">
+ <function access="public" threadsafety="unspecified" status="commendable" name="selectedText" fullname="QtUiTest::TextWidget::selectedText" href="qtuitest-textwidget.html#selectedText" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="QString" signature="selectedText() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="selectedValue" fullname="QtUiTest::TextWidget::selectedValue" href="qtuitest-textwidget.html#selectedValue" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="QVariant" signature="selectedValue() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="text" fullname="QtUiTest::TextWidget::text" href="qtuitest-textwidget.html#text" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="true" static="false" overload="false" type="QString" signature="text() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="value" fullname="QtUiTest::TextWidget::value" href="qtuitest-textwidget.html#value" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="QVariant" signature="value() const"/>
+ </class>
+ <class access="public" threadsafety="unspecified" status="preliminary" name="ListWidget" fullname="QtUiTest::ListWidget" href="qtuitest-listwidget.html" location="qtuitestwidgetinterface.h" bases="" module="">
+ <function access="public" threadsafety="unspecified" status="commendable" name="list" fullname="QtUiTest::ListWidget::list" href="qtuitest-listwidget.html#list" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="true" static="false" overload="false" type="QStringList" signature="list() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="visualRect" fullname="QtUiTest::ListWidget::visualRect" href="qtuitest-listwidget.html#visualRect" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="true" static="false" overload="false" type="QRect" signature="visualRect(const QString &amp; item) const">
+ <parameter left="const QString &amp;" right="" name="item" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="ensureVisible" fullname="QtUiTest::ListWidget::ensureVisible" href="qtuitest-listwidget.html#ensureVisible" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="false" static="false" overload="false" type="bool" signature="ensureVisible(const QString &amp; item)">
+ <parameter left="const QString &amp;" right="" name="item" default=""/>
+ </function>
+ </class>
+ <class access="public" threadsafety="unspecified" status="preliminary" name="InputWidget" fullname="QtUiTest::InputWidget" href="qtuitest-inputwidget.html" location="qtuitestwidgetinterface.h" bases="" module="">
+ <function access="public" threadsafety="unspecified" status="commendable" name="canEnter" fullname="QtUiTest::InputWidget::canEnter" href="qtuitest-inputwidget.html#canEnter" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="true" static="false" overload="false" type="bool" signature="canEnter(const QVariant &amp; item) const">
+ <parameter left="const QVariant &amp;" right="" name="item" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="enter" fullname="QtUiTest::InputWidget::enter" href="qtuitest-inputwidget.html#enter" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="false" static="false" overload="false" type="bool" signature="enter(const QVariant &amp; item, bool noCommit)">
+ <parameter left="const QVariant &amp;" right="" name="item" default=""/>
+ <parameter left="bool" right="" name="noCommit" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="entered" fullname="QtUiTest::InputWidget::entered" href="qtuitest-inputwidget.html#entered" location="qtuitestwidgetinterface.h" virtual="non" meta="signal" const="false" static="false" overload="false" type="void" signature="entered(const QVariant &amp; item)">
+ <parameter left="const QVariant &amp;" right="" name="item" default=""/>
+ </function>
+ </class>
+ <class access="public" threadsafety="unspecified" status="preliminary" name="SelectWidget" fullname="QtUiTest::SelectWidget" href="qtuitest-selectwidget.html" location="qtuitestwidgetinterface.h" bases="" module="">
+ <function access="public" threadsafety="unspecified" status="commendable" name="isMultiSelection" fullname="QtUiTest::SelectWidget::isMultiSelection" href="qtuitest-selectwidget.html#isMultiSelection" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="bool" signature="isMultiSelection() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="canSelect" fullname="QtUiTest::SelectWidget::canSelect" href="qtuitest-selectwidget.html#canSelect" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="true" static="false" overload="false" type="bool" signature="canSelect(const QString &amp; item) const">
+ <parameter left="const QString &amp;" right="" name="item" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="canSelectMulti" fullname="QtUiTest::SelectWidget::canSelectMulti" href="qtuitest-selectwidget.html#canSelectMulti" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="bool" signature="canSelectMulti(const QStringList &amp; items) const">
+ <parameter left="const QStringList &amp;" right="" name="items" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="select" fullname="QtUiTest::SelectWidget::select" href="qtuitest-selectwidget.html#select" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="false" static="false" overload="false" type="bool" signature="select(const QString &amp; item)">
+ <parameter left="const QString &amp;" right="" name="item" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="selectMulti" fullname="QtUiTest::SelectWidget::selectMulti" href="qtuitest-selectwidget.html#selectMulti" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="false" static="false" overload="false" type="bool" signature="selectMulti(const QStringList &amp; items)">
+ <parameter left="const QStringList &amp;" right="" name="items" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="selected" fullname="QtUiTest::SelectWidget::selected" href="qtuitest-selectwidget.html#selected" location="qtuitestwidgetinterface.h" virtual="non" meta="signal" const="false" static="false" overload="false" type="void" signature="selected(const QString &amp; item)">
+ <parameter left="const QString &amp;" right="" name="item" default=""/>
+ </function>
+ </class>
+ <class access="public" threadsafety="unspecified" status="preliminary" name="CheckItemWidget" fullname="QtUiTest::CheckItemWidget" href="qtuitest-checkitemwidget.html" location="qtuitestwidgetinterface.h" bases="" module="">
+ <function access="public" threadsafety="unspecified" status="commendable" name="isCheckable" fullname="QtUiTest::CheckItemWidget::isCheckable" href="qtuitest-checkitemwidget.html#isCheckable" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="false" static="false" overload="false" type="bool" signature="isCheckable(const QString &amp; item)">
+ <parameter left="const QString &amp;" right="" name="item" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="isChecked" fullname="QtUiTest::CheckItemWidget::isChecked" href="qtuitest-checkitemwidget.html#isChecked" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="true" static="false" overload="false" type="bool" signature="isChecked(const QString &amp; ) const">
+ <parameter left="const QString &amp;" right="" name="" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="setChecked" fullname="QtUiTest::CheckItemWidget::setChecked" href="qtuitest-checkitemwidget.html#setChecked" location="qtuitestwidgetinterface.h" virtual="pure" meta="plain" const="false" static="false" overload="false" type="bool" signature="setChecked(const QString &amp; item, bool state)">
+ <parameter left="const QString &amp;" right="" name="item" default=""/>
+ <parameter left="bool" right="" name="state" default=""/>
+ </function>
+ </class>
+ <class access="public" threadsafety="unspecified" status="preliminary" name="IndexedWidget" fullname="QtUiTest::IndexedWidget" href="qtuitest-indexedwidget.html" location="qtuitestwidgetinterface.h" bases="" module="">
+ <function access="public" threadsafety="unspecified" status="commendable" name="selectIndex" fullname="QtUiTest::IndexedWidget::selectIndex" href="qtuitest-indexedwidget.html#selectIndex" location="qtuitestwidgetinterface.h" virtual="impure" meta="plain" const="false" static="false" overload="false" type="bool" signature="selectIndex(const QVariantList &amp; index)">
+ <parameter left="const QVariantList &amp;" right="" name="index" default=""/>
+ </function>
+ </class>
+ <class access="public" threadsafety="unspecified" status="commendable" name="TestWidget" fullname="QtUiTest::TestWidget" href="qtuitest-testwidget.html" location="testwidget.h" bases="Widget,InputWidget" module="">
+ <function access="public" threadsafety="unspecified" status="commendable" name="TestWidget" fullname="QtUiTest::TestWidget::TestWidget" href="qtuitest-testwidget.html#TestWidget" location="testwidget.h" virtual="non" meta="constructor" const="false" static="false" overload="false" type="" signature="TestWidget(QObject * )">
+ <parameter left="QObject *" right="" name="" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="geometry" fullname="QtUiTest::TestWidget::geometry" href="qtuitest-testwidget.html#geometry" location="testwidget.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="const QRect &amp;" signature="geometry() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="rect" fullname="QtUiTest::TestWidget::rect" href="qtuitest-testwidget.html#rect" location="testwidget.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="QRect" signature="rect() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="isVisible" fullname="QtUiTest::TestWidget::isVisible" href="qtuitest-testwidget.html#isVisible" location="testwidget.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="bool" signature="isVisible() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="visibleRegion" fullname="QtUiTest::TestWidget::visibleRegion" href="qtuitest-testwidget.html#visibleRegion" location="testwidget.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="QRegion" signature="visibleRegion() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="children" fullname="QtUiTest::TestWidget::children" href="qtuitest-testwidget.html#children" location="testwidget.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="const QObjectList &amp;" signature="children() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="parent" fullname="QtUiTest::TestWidget::parent" href="qtuitest-testwidget.html#parent" location="testwidget.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="QObject *" signature="parent() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="windowTitle" fullname="QtUiTest::TestWidget::windowTitle" href="qtuitest-testwidget.html#windowTitle" location="testwidget.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="QString" signature="windowTitle() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="mapToGlobal" fullname="QtUiTest::TestWidget::mapToGlobal" href="qtuitest-testwidget.html#mapToGlobal" location="testwidget.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="QPoint" signature="mapToGlobal(QPoint const &amp; ) const">
+ <parameter left="QPoint const &amp;" right="" name="" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="mapFromGlobal" fullname="QtUiTest::TestWidget::mapFromGlobal" href="qtuitest-testwidget.html#mapFromGlobal" location="testwidget.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="QPoint" signature="mapFromGlobal(QPoint const &amp; ) const">
+ <parameter left="QPoint const &amp;" right="" name="" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="hasFocus" fullname="QtUiTest::TestWidget::hasFocus" href="qtuitest-testwidget.html#hasFocus" location="testwidget.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="bool" signature="hasFocus() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="windowFlags" fullname="QtUiTest::TestWidget::windowFlags" href="qtuitest-testwidget.html#windowFlags" location="testwidget.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="Qt::WindowFlags" signature="windowFlags() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="ensureVisibleRegion" fullname="QtUiTest::TestWidget::ensureVisibleRegion" href="qtuitest-testwidget.html#ensureVisibleRegion" location="testwidget.h" virtual="impure" meta="plain" const="false" static="false" overload="false" type="bool" signature="ensureVisibleRegion(QRegion const &amp; )">
+ <parameter left="QRegion const &amp;" right="" name="" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="canEnter" fullname="QtUiTest::TestWidget::canEnter" href="qtuitest-testwidget.html#canEnter" location="testwidget.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="bool" signature="canEnter(QVariant const &amp; ) const">
+ <parameter left="QVariant const &amp;" right="" name="" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="enter" fullname="QtUiTest::TestWidget::enter" href="qtuitest-testwidget.html#enter" location="testwidget.h" virtual="impure" meta="plain" const="false" static="false" overload="false" type="bool" signature="enter(QVariant const &amp; , bool )">
+ <parameter left="QVariant const &amp;" right="" name="" default=""/>
+ <parameter left="bool" right="" name="" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="focusOutEvent" fullname="QtUiTest::TestWidget::focusOutEvent" href="qtuitest-testwidget.html#focusOutEvent" location="testwidget.h" virtual="impure" meta="plain" const="false" static="false" overload="false" type="void" signature="focusOutEvent()"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="setEditFocus" fullname="QtUiTest::TestWidget::setEditFocus" href="qtuitest-testwidget.html#setEditFocus" location="testwidget.h" virtual="impure" meta="plain" const="false" static="false" overload="false" type="bool" signature="setEditFocus(bool )">
+ <parameter left="bool" right="" name="" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="focusProxy" fullname="QtUiTest::TestWidget::focusProxy" href="qtuitest-testwidget.html#focusProxy" location="testwidget.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="QObject *" signature="focusProxy() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="focusPolicy" fullname="QtUiTest::TestWidget::focusPolicy" href="qtuitest-testwidget.html#focusPolicy" location="testwidget.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="Qt::FocusPolicy" signature="focusPolicy() const"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="grabPixmap" fullname="QtUiTest::TestWidget::grabPixmap" href="qtuitest-testwidget.html#grabPixmap" location="testwidget.h" virtual="impure" meta="plain" const="true" static="false" overload="false" type="bool" signature="grabPixmap(QPixmap &amp; pixmap) const">
+ <parameter left="QPixmap &amp;" right="" name="pixmap" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="canWrap" fullname="QtUiTest::TestWidget::canWrap" href="qtuitest-testwidget.html#canWrap" location="testwidget.h" virtual="non" meta="plain" const="false" static="true" overload="false" type="bool" signature="canWrap(QObject * )">
+ <parameter left="QObject *" right="" name="" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="printable" fullname="QtUiTest::TestWidget::printable" href="qtuitest-testwidget.html#printable" location="testwidget.h" virtual="non" meta="plain" const="false" static="true" overload="false" type="QString" signature="printable(QString const &amp; )">
+ <parameter left="QString const &amp;" right="" name="" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="labelText" fullname="QtUiTest::TestWidget::labelText" href="qtuitest-testwidget.html#labelText" location="testwidget.h" virtual="non" meta="plain" const="false" static="true" overload="false" type="QString" signature="labelText(QString const &amp; )">
+ <parameter left="QString const &amp;" right="" name="" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="gotFocus" fullname="QtUiTest::TestWidget::gotFocus" href="qtuitest-testwidget.html#gotFocus" location="testwidget.h" virtual="non" meta="signal" const="false" static="false" overload="false" type="void" signature="gotFocus()"/>
+ <function access="protected" threadsafety="unspecified" status="commendable" name="eventFilter" fullname="QtUiTest::TestWidget::eventFilter" href="qtuitest-testwidget.html#eventFilter" location="testwidget.h" virtual="non" meta="plain" const="false" static="false" overload="false" type="bool" signature="eventFilter(QObject * , QEvent * )">
+ <parameter left="QObject *" right="" name="" default=""/>
+ <parameter left="QEvent *" right="" name="" default=""/>
+ </function>
+ </class>
+ <enum access="public" threadsafety="unspecified" status="commendable" name="InputOption" fullname="QtUiTest::InputOption" href="qtuitest.html#InputOption-enum" location="qtuitestnamespace.h">
+ <value name="NoOptions" value="0x0"/>
+ <value name="DemoMode" value="0x1"/>
+ <value name="KeyRepeat" value="0x2"/>
+ </enum>
+ <enum access="public" threadsafety="unspecified" status="commendable" name="WidgetType" fullname="QtUiTest::WidgetType" href="qtuitest.html#WidgetType-enum" location="qtuitestnamespace.h">
+ <value name="InputMethod" value="0"/>
+ <value name="SoftMenu" value="1"/>
+ <value name="OptionsMenu" value="2"/>
+ <value name="TabBar" value="3"/>
+ <value name="Launcher" value="4"/>
+ <value name="HomeScreen" value="5"/>
+ <value name="Focus" value="6"/>
+ <value name="CallManager" value="7"/>
+ <value name="MenuBar" value="8"/>
+ </enum>
+ <enum access="public" threadsafety="unspecified" status="commendable" name="Key" fullname="QtUiTest::Key" href="qtuitest.html#Key-enum" location="qtuitestnamespace.h">
+ <value name="Key_Activate" value="Qt::Key_Enter"/>
+ <value name="Key_Select" value="Qt::Key_Space"/>
+ <value name="Key_ActivateButton" value="Qt::Key_Space"/>
+ </enum>
+ <enum access="public" threadsafety="unspecified" status="commendable" name="LabelOrientation" fullname="QtUiTest::LabelOrientation" href="qtuitest.html#LabelOrientation-enum" location="qtuitestnamespace.h">
+ <value name="LabelLeft" value="0x01"/>
+ <value name="LabelRight" value="0x02"/>
+ <value name="LabelAbove" value="0x03"/>
+ <value name="LabelBelow" value="0x04"/>
+ </enum>
+ </namespace>
+ <namespace access="public" threadsafety="unspecified" status="preliminary" name="QSystemTest" href="qsystemtest.html" location="qsystemtest.h" module="">
+ <function access="public" threadsafety="unspecified" status="commendable" name="Q_ENUMS" fullname="QSystemTest::Q_ENUMS" href="qsystemtest.html#Q_ENUMS" location="qsystemtest.h" virtual="non" meta="plain" const="false" static="false" overload="false" type="" signature="Q_ENUMS(SkipMode )">
+ <parameter left="SkipMode" right="" name="" default=""/>
+ </function>
+ <enum access="public" threadsafety="unspecified" status="commendable" name="SkipMode" fullname="QSystemTest::SkipMode" href="qsystemtest.html#SkipMode-enum" location="qsystemtest.h">
+ <value name="SkipSingle" value="0x01"/>
+ <value name="SkipAll" value="0x02"/>
+ </enum>
+ <enum access="public" threadsafety="unspecified" status="commendable" name="EnterMode" fullname="QSystemTest::EnterMode" href="qsystemtest.html#EnterMode-enum" location="qsystemtest.h">
+ <value name="Commit" value="0x00"/>
+ <value name="NoCommit" value="0x01"/>
+ </enum>
+ <enum access="public" threadsafety="unspecified" status="commendable" name="LabelOrientation" fullname="QSystemTest::LabelOrientation" href="qsystemtest.html#LabelOrientation-enum" location="qsystemtest.h">
+ <value name="LabelLeft" value="0x01"/>
+ <value name="LabelRight" value="0x02"/>
+ <value name="LabelAbove" value="0x03"/>
+ <value name="LabelBelow" value="0x04"/>
+ </enum>
+ <enum access="public" threadsafety="unspecified" status="commendable" name="StartApplicationFlag" fullname="QSystemTest::StartApplicationFlag" href="qsystemtest.html#StartApplicationFlag-enum" location="qsystemtest.h" typedef="QSystemTest::StartApplicationFlags">
+ <value name="NoFlag" value="0x00"/>
+ <value name="WaitForFocus" value="0x01"/>
+ <value name="BackgroundCurrentApplication" value="0x02"/>
+ </enum>
+ <typedef access="public" threadsafety="unspecified" status="commendable" name="StartApplicationFlags" fullname="QSystemTest::StartApplicationFlags" href="qsystemtest.html#StartApplicationFlags-typedef" location="qsystemtest.h" enum="QSystemTest::StartApplicationFlag"/>
+ <enum access="public" threadsafety="unspecified" status="commendable" name="Role" fullname="QSystemTest::Role" href="qsystemtest.html#Role-enum" location="qsystemtest.h">
+ <value name="NoRole" value="0x00000000"/>
+ <value name="TitleBar" value="0x00000001"/>
+ <value name="MenuBar" value="0x00000002"/>
+ <value name="ScrollBar" value="0x00000003"/>
+ <value name="Grip" value="0x00000004"/>
+ <value name="Sound" value="0x00000005"/>
+ <value name="Cursor" value="0x00000006"/>
+ <value name="Caret" value="0x00000007"/>
+ <value name="AlertMessage" value="0x00000008"/>
+ <value name="Window" value="0x00000009"/>
+ <value name="Client" value="0x0000000A"/>
+ <value name="PopupMenu" value="0x0000000B"/>
+ <value name="MenuItem" value="0x0000000C"/>
+ <value name="ToolTip" value="0x0000000D"/>
+ <value name="Application" value="0x0000000E"/>
+ <value name="Document" value="0x0000000F"/>
+ <value name="Pane" value="0x00000010"/>
+ <value name="Chart" value="0x00000011"/>
+ <value name="Dialog" value="0x00000012"/>
+ <value name="Border" value="0x00000013"/>
+ <value name="Grouping" value="0x00000014"/>
+ <value name="Separator" value="0x00000015"/>
+ <value name="ToolBar" value="0x00000016"/>
+ <value name="StatusBar" value="0x00000017"/>
+ <value name="Table" value="0x00000018"/>
+ <value name="ColumnHeader" value="0x00000019"/>
+ <value name="RowHeader" value="0x0000001A"/>
+ <value name="Column" value="0x0000001B"/>
+ <value name="Row" value="0x0000001C"/>
+ <value name="Cell" value="0x0000001D"/>
+ <value name="Link" value="0x0000001E"/>
+ <value name="HelpBalloon" value="0x0000001F"/>
+ <value name="Assistant" value="0x00000020"/>
+ <value name="List" value="0x00000021"/>
+ <value name="ListItem" value="0x00000022"/>
+ <value name="Tree" value="0x00000023"/>
+ <value name="TreeItem" value="0x00000024"/>
+ <value name="PageTab" value="0x00000025"/>
+ <value name="PropertyPage" value="0x00000026"/>
+ <value name="Indicator" value="0x00000027"/>
+ <value name="Graphic" value="0x00000028"/>
+ <value name="StaticText" value="0x00000029"/>
+ <value name="EditableText" value="0x0000002A"/>
+ <value name="PushButton" value="0x0000002B"/>
+ <value name="CheckBox" value="0x0000002C"/>
+ <value name="RadioButton" value="0x0000002D"/>
+ <value name="ComboBox" value="0x0000002E"/>
+ <value name="ProgressBar" value="0x00000030"/>
+ <value name="Dial" value="0x00000031"/>
+ <value name="HotkeyField" value="0x00000032"/>
+ <value name="Slider" value="0x00000033"/>
+ <value name="SpinBox" value="0x00000034"/>
+ <value name="Canvas" value="0x00000035"/>
+ <value name="Animation" value="0x00000036"/>
+ <value name="Equation" value="0x00000037"/>
+ <value name="ButtonDropDown" value="0x00000038"/>
+ <value name="ButtonMenu" value="0x00000039"/>
+ <value name="ButtonDropGrid" value="0x0000003A"/>
+ <value name="Whitespace" value="0x0000003B"/>
+ <value name="PageTabList" value="0x0000003C"/>
+ <value name="Clock" value="0x0000003D"/>
+ <value name="Splitter" value="0x0000003E"/>
+ <value name="LayeredPane" value="0x0000003F"/>
+ <value name="UserRole" value="0x0000ffff"/>
+ </enum>
+ <enum access="public" threadsafety="unspecified" status="commendable" name="StateFlag" fullname="QSystemTest::StateFlag" href="qsystemtest.html#StateFlag-enum" location="qsystemtest.h" typedef="QSystemTest::State">
+ <value name="Normal" value="0x00000000"/>
+ <value name="Unavailable" value="0x00000001"/>
+ <value name="Selected" value="0x00000002"/>
+ <value name="Focused" value="0x00000004"/>
+ <value name="Pressed" value="0x00000008"/>
+ <value name="Checked" value="0x00000010"/>
+ <value name="Mixed" value="0x00000020"/>
+ <value name="ReadOnly" value="0x00000040"/>
+ <value name="HotTracked" value="0x00000080"/>
+ <value name="DefaultButton" value="0x00000100"/>
+ <value name="Expanded" value="0x00000200"/>
+ <value name="Collapsed" value="0x00000400"/>
+ <value name="Busy" value="0x00000800"/>
+ <value name="Marqueed" value="0x00002000"/>
+ <value name="Animated" value="0x00004000"/>
+ <value name="Invisible" value="0x00008000"/>
+ <value name="Offscreen" value="0x00010000"/>
+ <value name="Sizeable" value="0x00020000"/>
+ <value name="Movable" value="0x00040000"/>
+ <value name="SelfVoicing" value="0x00080000"/>
+ <value name="Focusable" value="0x00100000"/>
+ <value name="Selectable" value="0x00200000"/>
+ <value name="Linked" value="0x00400000"/>
+ <value name="Traversed" value="0x00800000"/>
+ <value name="MultiSelectable" value="0x01000000"/>
+ <value name="ExtSelectable" value="0x02000000"/>
+ <value name="Protected" value="0x20000000"/>
+ <value name="HasPopup" value="0x40000000"/>
+ <value name="Modal" value="0x80000000"/>
+ </enum>
+ <typedef access="public" threadsafety="unspecified" status="commendable" name="State" fullname="QSystemTest::State" href="qsystemtest.html#State-typedef" location="qsystemtest.h" enum="QSystemTest::StateFlag"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="strict" fullname="QSystemTest::strict" href="qsystemtest.html#strict" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="strict(bool on)">
+ <parameter left="bool" right="" name="on" default="true"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="userName" fullname="QSystemTest::userName" href="qsystemtest.html#userName" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="true" overload="false" type="QString" signature="userName()"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="runsOnDevice" fullname="QSystemTest::runsOnDevice" href="qsystemtest.html#runsOnDevice" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="bool" signature="runsOnDevice()"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="skip" fullname="QSystemTest::skip" href="qsystemtest.html#skip" location="qsystemtest.h" virtual="impure" meta="slot" const="false" static="false" overload="false" type="void" signature="skip(const QString &amp; message, SkipMode mode)">
+ <parameter left="const QString &amp;" right="" name="message" default=""/>
+ <parameter left="SkipMode" right="" name="mode" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="expectFail" fullname="QSystemTest::expectFail" href="qsystemtest.html#expectFail" location="qsystemtest.h" virtual="impure" meta="slot" const="false" static="false" overload="false" type="void" signature="expectFail(const QString &amp; reason)">
+ <parameter left="const QString &amp;" right="" name="reason" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="addExpectedMessageBox" fullname="QSystemTest::addExpectedMessageBox" href="qsystemtest.html#addExpectedMessageBox" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="addExpectedMessageBox(const QString &amp; title, const QString &amp; text, const QString &amp; option)">
+ <parameter left="const QString &amp;" right="" name="title" default=""/>
+ <parameter left="const QString &amp;" right="" name="text" default=""/>
+ <parameter left="const QString &amp;" right="" name="option" default="QString()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="clearExpectedMessageBoxes" fullname="QSystemTest::clearExpectedMessageBoxes" href="qsystemtest.html#clearExpectedMessageBoxes" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="clearExpectedMessageBoxes()"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="clearExpectedMessageBox" fullname="QSystemTest::clearExpectedMessageBox" href="qsystemtest.html#clearExpectedMessageBox" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="clearExpectedMessageBox(const QString &amp; title, const QString &amp; text)">
+ <parameter left="const QString &amp;" right="" name="title" default=""/>
+ <parameter left="const QString &amp;" right="" name="text" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="waitExpectedMessageBox" fullname="QSystemTest::waitExpectedMessageBox" href="qsystemtest.html#waitExpectedMessageBox" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="bool" signature="waitExpectedMessageBox(uint timeout, bool waitForAll, const QString &amp; title, const QString &amp; text)">
+ <parameter left="uint" right="" name="timeout" default=""/>
+ <parameter left="bool" right="" name="waitForAll" default="true"/>
+ <parameter left="const QString &amp;" right="" name="title" default="QString()"/>
+ <parameter left="const QString &amp;" right="" name="text" default="QString()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="ignoreMessageBoxes" fullname="QSystemTest::ignoreMessageBoxes" href="qsystemtest.html#ignoreMessageBoxes" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="ignoreMessageBoxes(bool ignore)">
+ <parameter left="bool" right="" name="ignore" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="signature" fullname="QSystemTest::signature" href="qsystemtest.html#signature" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QString" signature="signature(const QString &amp; labelText, int offset)">
+ <parameter left="const QString &amp;" right="" name="labelText" default=""/>
+ <parameter left="int" right="" name="offset" default="0"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="isVisible" fullname="QSystemTest::isVisible" href="qsystemtest.html#isVisible" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="bool" signature="isVisible(const QString &amp; queryPath)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="isEnabled" fullname="QSystemTest::isEnabled" href="qsystemtest.html#isEnabled" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="bool" signature="isEnabled(const QString &amp; queryPath)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="isChecked" fullname="QSystemTest::isChecked" href="qsystemtest.html#isChecked" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="bool" signature="isChecked(const QString &amp; queryPath)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="isChecked" fullname="QSystemTest::isChecked" href="qsystemtest.html#isChecked-2" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="true" overload-number="2" type="bool" signature="isChecked(const QString &amp; item, const QString &amp; queryPath)">
+ <parameter left="const QString &amp;" right="" name="item" default=""/>
+ <parameter left="const QString &amp;" right="" name="queryPath" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="setChecked" fullname="QSystemTest::setChecked" href="qsystemtest.html#setChecked" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="setChecked(bool doCheck, const QString &amp; queryPath)">
+ <parameter left="bool" right="" name="doCheck" default=""/>
+ <parameter left="const QString &amp;" right="" name="queryPath" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="setChecked" fullname="QSystemTest::setChecked" href="qsystemtest.html#setChecked-2" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="true" overload-number="2" type="void" signature="setChecked(bool doCheck, const QString &amp; item, const QString &amp; queryPath)">
+ <parameter left="bool" right="" name="doCheck" default=""/>
+ <parameter left="const QString &amp;" right="" name="item" default=""/>
+ <parameter left="const QString &amp;" right="" name="queryPath" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="checkState" fullname="QSystemTest::checkState" href="qsystemtest.html#checkState" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="int" signature="checkState(const QString &amp; queryPath)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="setCheckState" fullname="QSystemTest::setCheckState" href="qsystemtest.html#setCheckState" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="setCheckState(int state, const QString &amp; queryPath)">
+ <parameter left="int" right="" name="state" default=""/>
+ <parameter left="const QString &amp;" right="" name="queryPath" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="currentApplication" fullname="QSystemTest::currentApplication" href="qsystemtest.html#currentApplication" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QString" signature="currentApplication()"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="currentTitle" fullname="QSystemTest::currentTitle" href="qsystemtest.html#currentTitle" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QString" signature="currentTitle(const QString &amp; queryPath)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default="QString()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="focusWidget" fullname="QSystemTest::focusWidget" href="qsystemtest.html#focusWidget" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QString" signature="focusWidget(const QString &amp; queryPath)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default="QString()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="getSelectedText" fullname="QSystemTest::getSelectedText" href="qsystemtest.html#getSelectedText" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QString" signature="getSelectedText(const QString &amp; queryPath)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default="QString()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="getText" fullname="QSystemTest::getText" href="qsystemtest.html#getText" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QString" signature="getText(const QString &amp; queryPath)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default="QString()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="getSelectedValue" fullname="QSystemTest::getSelectedValue" href="qsystemtest.html#getSelectedValue" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QVariant" signature="getSelectedValue(const QString &amp; queryPath)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default="QString()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="getValue" fullname="QSystemTest::getValue" href="qsystemtest.html#getValue" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QVariant" signature="getValue(const QString &amp; queryPath)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default="QString()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="getList" fullname="QSystemTest::getList" href="qsystemtest.html#getList" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QStringList" signature="getList(const QString &amp; queryPath)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default="QString()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="getLabels" fullname="QSystemTest::getLabels" href="qsystemtest.html#getLabels" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QStringList" signature="getLabels(const QString &amp; queryPath)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default="QString()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="getClipboardText" fullname="QSystemTest::getClipboardText" href="qsystemtest.html#getClipboardText" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QString" signature="getClipboardText()"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="setClipboardText" fullname="QSystemTest::setClipboardText" href="qsystemtest.html#setClipboardText" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="setClipboardText(const QString &amp; text)">
+ <parameter left="const QString &amp;" right="" name="text" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="getDateTime" fullname="QSystemTest::getDateTime" href="qsystemtest.html#getDateTime" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QDateTime" signature="getDateTime()"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="visibleResponseTime" fullname="QSystemTest::visibleResponseTime" href="qsystemtest.html#visibleResponseTime" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="int" signature="visibleResponseTime()"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="setVisibleResponseTime" fullname="QSystemTest::setVisibleResponseTime" href="qsystemtest.html#setVisibleResponseTime" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="setVisibleResponseTime(int time)">
+ <parameter left="int" right="" name="time" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="startApplication" fullname="QSystemTest::startApplication" href="qsystemtest.html#startApplication" location="qsystemtest.h" virtual="impure" meta="slot" const="false" static="false" overload="false" type="void" signature="startApplication(const QString &amp; application, const QStringList &amp; arguments, int timeout, QFlags&lt;QSystemTest::StartApplicationFlag&gt; flags)">
+ <parameter left="const QString &amp;" right="" name="application" default=""/>
+ <parameter left="const QStringList &amp;" right="" name="arguments" default="QStringList()"/>
+ <parameter left="int" right="" name="timeout" default="5000"/>
+ <parameter left="QFlags&lt;QSystemTest::StartApplicationFlag&gt;" right="" name="flags" default="QSystemTest::WaitForFocus"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="expectApplicationClose" fullname="QSystemTest::expectApplicationClose" href="qsystemtest.html#expectApplicationClose" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="expectApplicationClose(bool value)">
+ <parameter left="bool" right="" name="value" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="keyClick" fullname="QSystemTest::keyClick" href="qsystemtest.html#keyClick" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="keyClick(Qt::Key key, const QString &amp; queryPath)">
+ <parameter left="Qt::Key" right="" name="key" default=""/>
+ <parameter left="const QString &amp;" right="" name="queryPath" default="QString()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="keyClickHold" fullname="QSystemTest::keyClickHold" href="qsystemtest.html#keyClickHold" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="keyClickHold(Qt::Key key, int duration, const QString &amp; queryPath)">
+ <parameter left="Qt::Key" right="" name="key" default=""/>
+ <parameter left="int" right="" name="duration" default=""/>
+ <parameter left="const QString &amp;" right="" name="queryPath" default="QString()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="keyPress" fullname="QSystemTest::keyPress" href="qsystemtest.html#keyPress" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="keyPress(Qt::Key key, const QString &amp; queryPath)">
+ <parameter left="Qt::Key" right="" name="key" default=""/>
+ <parameter left="const QString &amp;" right="" name="queryPath" default="QString()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="keyRelease" fullname="QSystemTest::keyRelease" href="qsystemtest.html#keyRelease" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="keyRelease(Qt::Key key, const QString &amp; queryPath)">
+ <parameter left="Qt::Key" right="" name="key" default=""/>
+ <parameter left="const QString &amp;" right="" name="queryPath" default="QString()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="mouseClick" fullname="QSystemTest::mouseClick" href="qsystemtest.html#mouseClick" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="mouseClick(int x, int y, QFlags&lt;Qt::MouseButton&gt; buttons)">
+ <parameter left="int" right="" name="x" default=""/>
+ <parameter left="int" right="" name="y" default=""/>
+ <parameter left="QFlags&lt;Qt::MouseButton&gt;" right="" name="buttons" default="Qt::LeftButton"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="mouseClick" fullname="QSystemTest::mouseClick" href="qsystemtest.html#mouseClick-2" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="true" overload-number="2" type="void" signature="mouseClick(const QString &amp; queryPath, QFlags&lt;Qt::MouseButton&gt; buttons)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default=""/>
+ <parameter left="QFlags&lt;Qt::MouseButton&gt;" right="" name="buttons" default="Qt::LeftButton"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="mouseClickHold" fullname="QSystemTest::mouseClickHold" href="qsystemtest.html#mouseClickHold" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="mouseClickHold(int x, int y, int duration, QFlags&lt;Qt::MouseButton&gt; buttons)">
+ <parameter left="int" right="" name="x" default=""/>
+ <parameter left="int" right="" name="y" default=""/>
+ <parameter left="int" right="" name="duration" default=""/>
+ <parameter left="QFlags&lt;Qt::MouseButton&gt;" right="" name="buttons" default="Qt::LeftButton"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="mouseClickHold" fullname="QSystemTest::mouseClickHold" href="qsystemtest.html#mouseClickHold-2" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="true" overload-number="2" type="void" signature="mouseClickHold(const QString &amp; queryPath, int duration, QFlags&lt;Qt::MouseButton&gt; buttons)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default=""/>
+ <parameter left="int" right="" name="duration" default=""/>
+ <parameter left="QFlags&lt;Qt::MouseButton&gt;" right="" name="buttons" default="Qt::LeftButton"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="mousePress" fullname="QSystemTest::mousePress" href="qsystemtest.html#mousePress" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="mousePress(int x, int y, QFlags&lt;Qt::MouseButton&gt; buttons)">
+ <parameter left="int" right="" name="x" default=""/>
+ <parameter left="int" right="" name="y" default=""/>
+ <parameter left="QFlags&lt;Qt::MouseButton&gt;" right="" name="buttons" default="Qt::LeftButton"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="mousePress" fullname="QSystemTest::mousePress" href="qsystemtest.html#mousePress-2" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="true" overload-number="2" type="void" signature="mousePress(const QString &amp; queryPath, QFlags&lt;Qt::MouseButton&gt; buttons)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default=""/>
+ <parameter left="QFlags&lt;Qt::MouseButton&gt;" right="" name="buttons" default="Qt::LeftButton"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="mouseRelease" fullname="QSystemTest::mouseRelease" href="qsystemtest.html#mouseRelease" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="mouseRelease(int x, int y, QFlags&lt;Qt::MouseButton&gt; buttons)">
+ <parameter left="int" right="" name="x" default=""/>
+ <parameter left="int" right="" name="y" default=""/>
+ <parameter left="QFlags&lt;Qt::MouseButton&gt;" right="" name="buttons" default="Qt::LeftButton"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="mouseRelease" fullname="QSystemTest::mouseRelease" href="qsystemtest.html#mouseRelease-2" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="true" overload-number="2" type="void" signature="mouseRelease(const QString &amp; queryPath, QFlags&lt;Qt::MouseButton&gt; buttons)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default=""/>
+ <parameter left="QFlags&lt;Qt::MouseButton&gt;" right="" name="buttons" default="Qt::LeftButton"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="mousePreferred" fullname="QSystemTest::mousePreferred" href="qsystemtest.html#mousePreferred" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="bool" signature="mousePreferred()"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="setMousePreferred" fullname="QSystemTest::setMousePreferred" href="qsystemtest.html#setMousePreferred" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="setMousePreferred(bool useMouse)">
+ <parameter left="bool" right="" name="useMouse" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="labelOrientation" fullname="QSystemTest::labelOrientation" href="qsystemtest.html#labelOrientation" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="LabelOrientation" signature="labelOrientation()"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="setLabelOrientation" fullname="QSystemTest::setLabelOrientation" href="qsystemtest.html#setLabelOrientation" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="setLabelOrientation(LabelOrientation orientation)">
+ <parameter left="LabelOrientation" right="" name="orientation" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="enter" fullname="QSystemTest::enter" href="qsystemtest.html#enter" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="enter(const QVariant &amp; value, const QString &amp; queryPath, EnterMode mode)">
+ <parameter left="const QVariant &amp;" right="" name="value" default=""/>
+ <parameter left="const QString &amp;" right="" name="queryPath" default="QString()"/>
+ <parameter left="EnterMode" right="" name="mode" default="Commit"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="select" fullname="QSystemTest::select" href="qsystemtest.html#select" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="select(const QString &amp; item, const QString &amp; queryPath)">
+ <parameter left="const QString &amp;" right="" name="item" default=""/>
+ <parameter left="const QString &amp;" right="" name="queryPath" default="QString()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="selectIndex" fullname="QSystemTest::selectIndex" href="qsystemtest.html#selectIndex" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="selectIndex(const QVariantList &amp; index, const QString &amp; queryPath)">
+ <parameter left="const QVariantList &amp;" right="" name="index" default=""/>
+ <parameter left="const QString &amp;" right="" name="queryPath" default="QString()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="activate" fullname="QSystemTest::activate" href="qsystemtest.html#activate" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="activate(const QString &amp; queryPath)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="waitForTitle" fullname="QSystemTest::waitForTitle" href="qsystemtest.html#waitForTitle" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="waitForTitle(const QString &amp; title, int timeout)">
+ <parameter left="const QString &amp;" right="" name="title" default=""/>
+ <parameter left="int" right="" name="timeout" default="0"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="verifyImage" fullname="QSystemTest::verifyImage" href="qsystemtest.html#verifyImage" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="verifyImage(const QString &amp; expectedName, const QString &amp; queryPath, const QString &amp; comment, const QStringList &amp; maskedWidgets)">
+ <parameter left="const QString &amp;" right="" name="expectedName" default=""/>
+ <parameter left="const QString &amp;" right="" name="queryPath" default="QString()"/>
+ <parameter left="const QString &amp;" right="" name="comment" default="QString()"/>
+ <parameter left="const QStringList &amp;" right="" name="maskedWidgets" default="QStringList()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="compareImage" fullname="QSystemTest::compareImage" href="qsystemtest.html#compareImage" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="bool" signature="compareImage(const QString &amp; expectedName, const QString &amp; queryPath, const QStringList &amp; maskedWidgets)">
+ <parameter left="const QString &amp;" right="" name="expectedName" default=""/>
+ <parameter left="const QString &amp;" right="" name="queryPath" default=""/>
+ <parameter left="const QStringList &amp;" right="" name="maskedWidgets" default="QStringList()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="prompt" fullname="QSystemTest::prompt" href="qsystemtest.html#prompt" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="prompt(const QString &amp; promptText)">
+ <parameter left="const QString &amp;" right="" name="promptText" default="QString()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="wait" fullname="QSystemTest::wait" href="qsystemtest.html#wait" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="wait(int msecs)">
+ <parameter left="int" right="" name="msecs" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="saveScreen" fullname="QSystemTest::saveScreen" href="qsystemtest.html#saveScreen" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="saveScreen(const QString &amp; name, const QString &amp; queryPath)">
+ <parameter left="const QString &amp;" right="" name="name" default=""/>
+ <parameter left="const QString &amp;" right="" name="queryPath" default="&quot;qpe:&quot;"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="runProcess" fullname="QSystemTest::runProcess" href="qsystemtest.html#runProcess" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QString" signature="runProcess(const QString &amp; application, const QStringList &amp; args, const QString &amp; input)">
+ <parameter left="const QString &amp;" right="" name="application" default=""/>
+ <parameter left="const QStringList &amp;" right="" name="args" default=""/>
+ <parameter left="const QString &amp;" right="" name="input" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="getenv" fullname="QSystemTest::getenv" href="qsystemtest.html#getenv" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QString" signature="getenv(const QString &amp; )">
+ <parameter left="const QString &amp;" right="" name="" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="checkOS" fullname="QSystemTest::checkOS" href="qsystemtest.html#checkOS" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="bool" signature="checkOS(const QString &amp; )">
+ <parameter left="const QString &amp;" right="" name="" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="putFile" fullname="QSystemTest::putFile" href="qsystemtest.html#putFile" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="putFile(const QString &amp; srcFile, const QString &amp; destFile, QFile::Permissions permissions)">
+ <parameter left="const QString &amp;" right="" name="srcFile" default=""/>
+ <parameter left="const QString &amp;" right="" name="destFile" default=""/>
+ <parameter left="QFile::Permissions" right="" name="permissions" default="0"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="putData" fullname="QSystemTest::putData" href="qsystemtest.html#putData" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="putData(const QByteArray &amp; data, const QString &amp; destFile, QFile::Permissions permissions)">
+ <parameter left="const QByteArray &amp;" right="" name="data" default=""/>
+ <parameter left="const QString &amp;" right="" name="destFile" default=""/>
+ <parameter left="QFile::Permissions" right="" name="permissions" default="0"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="getFile" fullname="QSystemTest::getFile" href="qsystemtest.html#getFile" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="getFile(const QString &amp; srcFile, const QString &amp; destFile)">
+ <parameter left="const QString &amp;" right="" name="srcFile" default=""/>
+ <parameter left="const QString &amp;" right="" name="destFile" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="readLocalFile" fullname="QSystemTest::readLocalFile" href="qsystemtest.html#readLocalFile" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QString" signature="readLocalFile(const QString &amp; file)">
+ <parameter left="const QString &amp;" right="" name="file" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="getData" fullname="QSystemTest::getData" href="qsystemtest.html#getData" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QString" signature="getData(const QString &amp; srcFile)">
+ <parameter left="const QString &amp;" right="" name="srcFile" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="deletePath" fullname="QSystemTest::deletePath" href="qsystemtest.html#deletePath" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="deletePath(const QString &amp; path)">
+ <parameter left="const QString &amp;" right="" name="path" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="getDirectoryEntries" fullname="QSystemTest::getDirectoryEntries" href="qsystemtest.html#getDirectoryEntries" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QStringList" signature="getDirectoryEntries(const QString &amp; dir, QDir::Filters filters)">
+ <parameter left="const QString &amp;" right="" name="dir" default=""/>
+ <parameter left="QDir::Filters" right="" name="filters" default="QDir::NoFilter"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="getGeometry" fullname="QSystemTest::getGeometry" href="qsystemtest.html#getGeometry" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QRect" signature="getGeometry(const QString &amp; queryPath)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default="QString()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="setProperty" fullname="QSystemTest::setProperty" href="qsystemtest.html#setProperty" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="setProperty(const QString &amp; queryPath, const QString &amp; name, const QVariant &amp; value)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default=""/>
+ <parameter left="const QString &amp;" right="" name="name" default=""/>
+ <parameter left="const QVariant &amp;" right="" name="value" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="getProperty" fullname="QSystemTest::getProperty" href="qsystemtest.html#getProperty" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QVariant" signature="getProperty(const QString &amp; queryPath, const QString &amp; name)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default=""/>
+ <parameter left="const QString &amp;" right="" name="name" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="findByProperty" fullname="QSystemTest::findByProperty" href="qsystemtest.html#findByProperty" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QStringList" signature="findByProperty(const QString &amp; property, const QVariant &amp; searchValue)">
+ <parameter left="const QString &amp;" right="" name="property" default=""/>
+ <parameter left="const QVariant &amp;" right="" name="searchValue" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="findByProperty" fullname="QSystemTest::findByProperty" href="qsystemtest.html#findByProperty-2" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="true" overload-number="2" type="QStringList" signature="findByProperty(const QVariantMap &amp; searchValues)">
+ <parameter left="const QVariantMap &amp;" right="" name="searchValues" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="invokeMethod" fullname="QSystemTest::invokeMethod" href="qsystemtest.html#invokeMethod-2" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="true" overload-number="2" type="bool" signature="invokeMethod(const QString &amp; queryPath, const QString &amp; method, const QVariant &amp; arg0, const QVariant &amp; arg1, const QVariant &amp; arg2, const QVariant &amp; arg3, const QVariant &amp; arg4, const QVariant &amp; arg5, const QVariant &amp; arg6, const QVariant &amp; arg7, const QVariant &amp; arg8, const QVariant &amp; arg9)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default=""/>
+ <parameter left="const QString &amp;" right="" name="method" default=""/>
+ <parameter left="const QVariant &amp;" right="" name="arg0" default="QVariant()"/>
+ <parameter left="const QVariant &amp;" right="" name="arg1" default="QVariant()"/>
+ <parameter left="const QVariant &amp;" right="" name="arg2" default="QVariant()"/>
+ <parameter left="const QVariant &amp;" right="" name="arg3" default="QVariant()"/>
+ <parameter left="const QVariant &amp;" right="" name="arg4" default="QVariant()"/>
+ <parameter left="const QVariant &amp;" right="" name="arg5" default="QVariant()"/>
+ <parameter left="const QVariant &amp;" right="" name="arg6" default="QVariant()"/>
+ <parameter left="const QVariant &amp;" right="" name="arg7" default="QVariant()"/>
+ <parameter left="const QVariant &amp;" right="" name="arg8" default="QVariant()"/>
+ <parameter left="const QVariant &amp;" right="" name="arg9" default="QVariant()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="invokeMethod" fullname="QSystemTest::invokeMethod" href="qsystemtest.html#invokeMethod" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="bool" signature="invokeMethod(const QString &amp; queryPath, const QString &amp; method, Qt::ConnectionType type, const QVariant &amp; arg0, const QVariant &amp; arg1, const QVariant &amp; arg2, const QVariant &amp; arg3, const QVariant &amp; arg4, const QVariant &amp; arg5, const QVariant &amp; arg6, const QVariant &amp; arg7, const QVariant &amp; arg8, const QVariant &amp; arg9)">
+ <parameter left="const QString &amp;" right="" name="queryPath" default=""/>
+ <parameter left="const QString &amp;" right="" name="method" default=""/>
+ <parameter left="Qt::ConnectionType" right="" name="type" default=""/>
+ <parameter left="const QVariant &amp;" right="" name="arg0" default="QVariant()"/>
+ <parameter left="const QVariant &amp;" right="" name="arg1" default="QVariant()"/>
+ <parameter left="const QVariant &amp;" right="" name="arg2" default="QVariant()"/>
+ <parameter left="const QVariant &amp;" right="" name="arg3" default="QVariant()"/>
+ <parameter left="const QVariant &amp;" right="" name="arg4" default="QVariant()"/>
+ <parameter left="const QVariant &amp;" right="" name="arg5" default="QVariant()"/>
+ <parameter left="const QVariant &amp;" right="" name="arg6" default="QVariant()"/>
+ <parameter left="const QVariant &amp;" right="" name="arg7" default="QVariant()"/>
+ <parameter left="const QVariant &amp;" right="" name="arg8" default="QVariant()"/>
+ <parameter left="const QVariant &amp;" right="" name="arg9" default="QVariant()"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="getSetting" fullname="QSystemTest::getSetting" href="qsystemtest.html#getSetting" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QVariant" signature="getSetting(const QString &amp; file, const QString &amp; group, const QString &amp; key)">
+ <parameter left="const QString &amp;" right="" name="file" default=""/>
+ <parameter left="const QString &amp;" right="" name="group" default=""/>
+ <parameter left="const QString &amp;" right="" name="key" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="getSetting" fullname="QSystemTest::getSetting" href="qsystemtest.html#getSetting-2" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="true" overload-number="2" type="QVariant" signature="getSetting(const QString &amp; organization, const QString &amp; application, const QString &amp; group, const QString &amp; key)">
+ <parameter left="const QString &amp;" right="" name="organization" default=""/>
+ <parameter left="const QString &amp;" right="" name="application" default=""/>
+ <parameter left="const QString &amp;" right="" name="group" default=""/>
+ <parameter left="const QString &amp;" right="" name="key" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="setSetting" fullname="QSystemTest::setSetting" href="qsystemtest.html#setSetting" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="void" signature="setSetting(const QString &amp; file, const QString &amp; group, const QString &amp; key, const QVariant &amp; value)">
+ <parameter left="const QString &amp;" right="" name="file" default=""/>
+ <parameter left="const QString &amp;" right="" name="group" default=""/>
+ <parameter left="const QString &amp;" right="" name="key" default=""/>
+ <parameter left="const QVariant &amp;" right="" name="value" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="setSetting" fullname="QSystemTest::setSetting" href="qsystemtest.html#setSetting-2" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="true" overload-number="2" type="void" signature="setSetting(const QString &amp; organization, const QString &amp; application, const QString &amp; group, const QString &amp; key, const QVariant &amp; value)">
+ <parameter left="const QString &amp;" right="" name="organization" default=""/>
+ <parameter left="const QString &amp;" right="" name="application" default=""/>
+ <parameter left="const QString &amp;" right="" name="group" default=""/>
+ <parameter left="const QString &amp;" right="" name="key" default=""/>
+ <parameter left="const QVariant &amp;" right="" name="value" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="translate" fullname="QSystemTest::translate" href="qsystemtest.html#translate" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QString" signature="translate(const QString &amp; context, const QString &amp; text, const QString &amp; comment, int n)">
+ <parameter left="const QString &amp;" right="" name="context" default=""/>
+ <parameter left="const QString &amp;" right="" name="text" default=""/>
+ <parameter left="const QString &amp;" right="" name="comment" default="QString()"/>
+ <parameter left="int" right="" name="n" default="0"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="getLocale" fullname="QSystemTest::getLocale" href="qsystemtest.html#getLocale" location="qsystemtest.h" virtual="non" meta="slot" const="false" static="false" overload="false" type="QLocale" signature="getLocale()"/>
+ <variable access="protected" threadsafety="unspecified" status="commendable" name="abort_prompt" fullname="QSystemTest::abort_prompt" href="qsystemtest.html#abort_prompt-var" location="qsystemtest.h" type="bool" static="false"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="waitFor" fullname="QSystemTest::waitFor" href="qsystemtest.html#waitFor" location="qsystemtest.h" virtual="non" meta="plain" const="false" static="false" overload="false" type="void" signature="waitFor(Number timeout, Number intervals, String message)">
+ <parameter left="Number" right="" name="timeout" default="10000"/>
+ <parameter left="Number" right="" name="intervals" default="20"/>
+ <parameter left="String" right="" name="message" default="null"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="expectMessageBox" fullname="QSystemTest::expectMessageBox" href="qsystemtest.html#expectMessageBox" location="qsystemtest.h" virtual="non" meta="plain" const="false" static="false" overload="false" type="void" signature="expectMessageBox(String title, String text, String option, Number timeout)">
+ <parameter left="String" right="" name="title" default=""/>
+ <parameter left="String" right="" name="text" default=""/>
+ <parameter left="String" right="" name="option" default=""/>
+ <parameter left="Number" right="" name="timeout" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="compare" fullname="QSystemTest::compare" href="qsystemtest.html#compare" location="qsystemtest.h" virtual="non" meta="plain" const="false" static="false" overload="false" type="void" signature="compare(Variant actual, Variant expected)">
+ <parameter left="Variant" right="" name="actual" default=""/>
+ <parameter left="Variant" right="" name="expected" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="verify" fullname="QSystemTest::verify" href="qsystemtest.html#verify" location="qsystemtest.h" virtual="non" meta="plain" const="false" static="false" overload="false" type="void" signature="verify(Boolean condition, String message)">
+ <parameter left="Boolean" right="" name="condition" default=""/>
+ <parameter left="String" right="" name="message" default="null"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="fail" fullname="QSystemTest::fail" href="qsystemtest.html#fail" location="qsystemtest.h" virtual="non" meta="plain" const="false" static="false" overload="false" type="void" signature="fail(String message)">
+ <parameter left="String" right="" name="message" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="tabBar" fullname="QSystemTest::tabBar" href="qsystemtest.html#tabBar" location="qsystemtest.h" virtual="non" meta="plain" const="false" static="false" overload="false" type="void" signature="tabBar(int index)">
+ <parameter left="int" right="" name="index" default="0"/>
+ </function>
+ </namespace>
+ <typedef access="public" threadsafety="unspecified" status="commendable" name="StringArray" href="qsystemtest.html#StringArray-typedef" location="qsystemtest.h"/>
+ <typedef access="public" threadsafety="unspecified" status="commendable" name="QVariantArray" href="qsystemtest.html#QVariantArray-typedef" location="qsystemtest.h"/>
+ <typedef access="public" threadsafety="unspecified" status="commendable" name="Boolean" href="qsystemtest.html#Boolean-typedef" location="qsystemtest.h"/>
+ <typedef access="public" threadsafety="unspecified" status="commendable" name="Number" href="qsystemtest.html#Number-typedef" location="qsystemtest.h"/>
+ <typedef access="public" threadsafety="unspecified" status="commendable" name="Array" href="qsystemtest.html#Array-typedef" location="qsystemtest.h"/>
+ <typedef access="public" threadsafety="unspecified" status="commendable" name="Function" href="qsystemtest.html#Function-typedef" location="qsystemtest.h"/>
+ <class access="public" threadsafety="unspecified" status="preliminary" name="QtUiTestRecorder" href="qtuitestrecorder.html" location="qtuitestrecorder.h" bases="" module="">
+ <function access="public" threadsafety="unspecified" status="commendable" name="QtUiTestRecorder" fullname="QtUiTestRecorder::QtUiTestRecorder" href="qtuitestrecorder.html#QtUiTestRecorder" location="qtuitestrecorder.h" virtual="non" meta="constructor" const="false" static="false" overload="false" type="" signature="QtUiTestRecorder(QObject * parent)">
+ <parameter left="QObject *" right="" name="parent" default="0"/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="~QtUiTestRecorder" fullname="QtUiTestRecorder::~QtUiTestRecorder" href="qtuitestrecorder.html#dtor.QtUiTestRecorder" location="qtuitestrecorder.h" virtual="non" meta="destructor" const="false" static="false" overload="false" type="" signature="~QtUiTestRecorder()"/>
+ <function access="public" threadsafety="unspecified" status="commendable" name="gotFocus" fullname="QtUiTestRecorder::gotFocus" href="qtuitestrecorder.html#gotFocus" location="qtuitestrecorder.h" virtual="non" meta="signal" const="false" static="false" overload="false" type="void" signature="gotFocus(QObject * widget)">
+ <parameter left="QObject *" right="" name="widget" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="activated" fullname="QtUiTestRecorder::activated" href="qtuitestrecorder.html#activated" location="qtuitestrecorder.h" virtual="non" meta="signal" const="false" static="false" overload="false" type="void" signature="activated(QObject * widget)">
+ <parameter left="QObject *" right="" name="widget" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="stateChanged" fullname="QtUiTestRecorder::stateChanged" href="qtuitestrecorder.html#stateChanged" location="qtuitestrecorder.h" virtual="non" meta="signal" const="false" static="false" overload="false" type="void" signature="stateChanged(QObject * widget, int state)">
+ <parameter left="QObject *" right="" name="widget" default=""/>
+ <parameter left="int" right="" name="state" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="entered" fullname="QtUiTestRecorder::entered" href="qtuitestrecorder.html#entered" location="qtuitestrecorder.h" virtual="non" meta="signal" const="false" static="false" overload="false" type="void" signature="entered(QObject * widget, QVariant const &amp; item)">
+ <parameter left="QObject *" right="" name="widget" default=""/>
+ <parameter left="QVariant const &amp;" right="" name="item" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="selected" fullname="QtUiTestRecorder::selected" href="qtuitestrecorder.html#selected" location="qtuitestrecorder.h" virtual="non" meta="signal" const="false" static="false" overload="false" type="void" signature="selected(QObject * widget, QString const &amp; item)">
+ <parameter left="QObject *" right="" name="widget" default=""/>
+ <parameter left="QString const &amp;" right="" name="item" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="keyEvent" fullname="QtUiTestRecorder::keyEvent" href="qtuitestrecorder.html#keyEvent" location="qtuitestrecorder.h" virtual="non" meta="signal" const="false" static="false" overload="false" type="void" signature="keyEvent(int key, int modifiers, bool isPress, bool isAutoRepeat)">
+ <parameter left="int" right="" name="key" default=""/>
+ <parameter left="int" right="" name="modifiers" default=""/>
+ <parameter left="bool" right="" name="isPress" default=""/>
+ <parameter left="bool" right="" name="isAutoRepeat" default=""/>
+ </function>
+ <function access="public" threadsafety="unspecified" status="commendable" name="mouseEvent" fullname="QtUiTestRecorder::mouseEvent" href="qtuitestrecorder.html#mouseEvent" location="qtuitestrecorder.h" virtual="non" meta="signal" const="false" static="false" overload="false" type="void" signature="mouseEvent(int x, int y, int state)">
+ <parameter left="int" right="" name="x" default=""/>
+ <parameter left="int" right="" name="y" default=""/>
+ <parameter left="int" right="" name="state" default=""/>
+ </function>
+ </class>
+ <function access="public" threadsafety="unspecified" status="commendable" name="qtuitest_cast" href="qtuitest.html#qtuitest_cast" location="qtuitestnamespace.h" virtual="non" meta="plain" const="false" static="false" overload="false" relates="QtUiTest" type="T" signature="qtuitest_cast(const QObject * object)">
+ <parameter left="const QObject *" right="" name="object" default=""/>
+ </function>
+ <page access="public" status="commendable" name="qtuitest_manual.html" href="qtuitest-manual.html" subtype="page" title="QtUiTest Manual" fulltitle="QtUiTest Manual" subtitle="" location="qtuitest_manual.qdoc">
+ <contents name="introduction" title="Introduction" level="1"/>
+ <contents name="the-scripting-language" title="The Scripting Language" level="1"/>
+ <contents name="language-design-philosophy" title="Language design philosophy" level="2"/>
+ <contents name="using-qtuitest" title="Using QtUiTest" level="1"/>
+ <contents name="creating-a-test" title="Creating a Test" level="2"/>
+ <contents name="writing-a-manual-system-test" title="Writing a Manual System Test" level="3"/>
+ <contents name="running-a-test" title="Running a Test" level="2"/>
+ <contents name="running-tests-in-a-continuous-integration-system" title="Running tests in a Continuous Integration System" level="3"/>
+ <contents name="qtuitest-tutorial" title="QtUiTest Tutorial" level="2"/>
+ <contents name="qtuitest-api-overview" title="QtUiTest API Overview" level="1"/>
+ <contents name="system-architecture" title="System Architecture" level="2"/>
+ <contents name="query-paths" title="Query Paths" level="2"/>
+ <contents name="labels" title="Labels" level="3"/>
+ <contents name="signatures" title="Signatures" level="3"/>
+ <contents name="querying-widgets-by-property" title="Querying Widgets By Property" level="3"/>
+ <contents name="learn-mode" title="Learn Mode" level="2"/>
+ <contents name="application-management" title="Application Management" level="2"/>
+ <contents name="file-management" title="File Management" level="2"/>
+ <contents name="querying-objects" title="Querying Objects" level="2"/>
+ <contents name="text-entry-and-navigation" title="Text Entry and Navigation" level="2"/>
+ <contents name="key-simulation" title="Key Simulation" level="2"/>
+ <contents name="mouse-touchscreen-simulation" title="Mouse / Touchscreen Simulation" level="2"/>
+ <contents name="other" title="Other" level="2"/>
+ <contents name="extending-qtuitest-for-custom-widgets" title="Extending QtUiTest for Custom Widgets" level="1"/>
+ <contents name="qtuitest-api-reference" title="QtUiTest API Reference" level="1"/>
+ </page>
+ <page access="public" status="commendable" name="qtuitest-tutorial.html" href="qtuitest-tutorial.html" subtype="page" title="QtUiTest Tutorial" fulltitle="QtUiTest Tutorial" subtitle="" location="qtuitest_tutorial.qdoc"/>
+ <page access="public" status="commendable" name="qtuitest-tutorial1.html" href="qtuitest-tutorial1.html" subtype="page" title="Chapter 1: Writing a System Test" fulltitle="Chapter 1: Writing a System Test" subtitle="" location="qtuitest_tutorial.qdoc">
+ <contents name="setting-up-the-environment" title="Setting up the environment" level="1"/>
+ <contents name="writing-the-test" title="Writing the Test" level="1"/>
+ <contents name="running-the-test-for-the-first-time" title="Running the test for the first time" level="2"/>
+ <contents name="special-functions" title="Special functions" level="2"/>
+ <contents name="interacting-with-the-system-under-test" title="Interacting with the System Under Test" level="2"/>
+ </page>
+ <page access="public" status="commendable" name="qtuitest-tutorial2.html" href="qtuitest-tutorial2.html" subtype="page" title="Chapter 2: Input, Output and Widget Navigation" fulltitle="Chapter 2: Input, Output and Widget Navigation" subtitle="" location="qtuitest_tutorial.qdoc">
+ <contents name="basic-input" title="Basic Input" level="1"/>
+ <contents name="input-into-specific-widgets" title="Input Into Specific Widgets" level="1"/>
+ <contents name="selecting-items-from-lists-and-menus-and-activating-buttons" title="Selecting Items from Lists and Menus, and Activating Buttons" level="1"/>
+ <contents name="output" title="Output" level="1"/>
+ </page>
+ <page access="public" status="commendable" name="qtuitest-tutorial3.html" href="qtuitest-tutorial3.html" subtype="page" title="Chapter 3: Data driven testing" fulltitle="Chapter 3: Data driven testing" subtitle="" location="qtuitest_tutorial.qdoc"/>
+ <page access="public" status="commendable" name="qtuitest-tutorial4.html" href="qtuitest-tutorial4.html" subtype="page" title="Chapter 4: Putting It All Together" fulltitle="Chapter 4: Putting It All Together" subtitle="" location="qtuitest_tutorial.qdoc"/>
+ <page access="public" status="commendable" name="index.html" href="index.html" subtype="page" title="Qt Reference Documentation" fulltitle="Qt Reference Documentation" subtitle="" location="index.qdoc">
+ <keyword name="qt-reference-documentation"/>
+ </page>
+ <page access="public" status="commendable" name="qtuitest_plugins.html" href="qtuitest-plugins.html" subtype="page" title="Creating a QtUiTest Test Widget" fulltitle="Creating a QtUiTest Test Widget" subtitle="" location="qtuitest_plugins.qdoc">
+ <contents name="introduction" title="Introduction" level="1"/>
+ <contents name="when-a-test-widget-is-required" title="When a Test Widget is Required" level="1"/>
+ <contents name="choosing-the-right-interfaces" title="Choosing the Right Interfaces" level="1"/>
+ <contents name="implementing-the-test-widget" title="Implementing the Test Widget" level="1"/>
+ <contents name="plugin-method" title="Plugin method" level="2"/>
+ <contents name="test-widget-class" title="Test widget class" level="3"/>
+ <contents name="test-widget-factory" title="Test widget factory" level="3"/>
+ <contents name="multiple-inheritance-method" title="Multiple inheritance method" level="2"/>
+ </page>
+ </namespace>
+</INDEX>
diff --git a/doc/html/qtuitestrecorder-members.html b/doc/html/qtuitestrecorder-members.html
new file mode 100644
index 0000000..51d6f62
--- /dev/null
+++ b/doc/html/qtuitestrecorder-members.html
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestrecorder.cpp -->
+<head>
+ <title>List of All Members for QtUiTestRecorder</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">List of All Members for QtUiTestRecorder</h1>
+<p>This is the complete list of members for <a href="qtuitestrecorder.html">QtUiTestRecorder</a>, including inherited members.</p>
+<ul>
+<li><div class="fn"><b><a href="qtuitestrecorder.html#QtUiTestRecorder">QtUiTestRecorder</a></b> ( QObject * )</div></li>
+<li><div class="fn"><b><a href="qtuitestrecorder.html#dtor.QtUiTestRecorder">~QtUiTestRecorder</a></b> ()</div></li>
+<li><div class="fn"><b><a href="qtuitestrecorder.html#activated">activated</a></b> ( QObject * )</div></li>
+<li><div class="fn"><b><a href="qtuitestrecorder.html#entered">entered</a></b> ( QObject *, QVariant const &amp; )</div></li>
+<li><div class="fn"><b><a href="qtuitestrecorder.html#gotFocus">gotFocus</a></b> ( QObject * )</div></li>
+<li><div class="fn"><b><a href="qtuitestrecorder.html#keyEvent">keyEvent</a></b> ( int, int, bool, bool )</div></li>
+<li><div class="fn"><b><a href="qtuitestrecorder.html#mouseEvent">mouseEvent</a></b> ( int, int, int )</div></li>
+<li><div class="fn"><b><a href="qtuitestrecorder.html#selected">selected</a></b> ( QObject *, QString const &amp; )</div></li>
+<li><div class="fn"><b><a href="qtuitestrecorder.html#stateChanged">stateChanged</a></b> ( QObject *, int )</div></li>
+</ul>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/html/qtuitestrecorder.html b/doc/html/qtuitestrecorder.html
new file mode 100644
index 0000000..17b1e13
--- /dev/null
+++ b/doc/html/qtuitestrecorder.html
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<!-- ../../lib/qtuitestrecorder.cpp -->
+<head>
+ <title>QtUiTestRecorder Class Reference</title>
+ <link href="classic.css" rel="stylesheet" type="text/css" />
+</head>
+<body>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr>
+<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
+<td width="1">&nbsp;&nbsp;</td><td align="right" valign="top" width="230"></td></tr></table><h1 class="title">QtUiTestRecorder Class Reference<br /><span class="small-subtitle">[QtUiTestModule]</span>
+</h1>
+<p>The QtUiTestRecorder class provides an interface for observing application-wide high level user actions. <a href="#details">More...</a></p>
+<pre> #include &lt;QtUiTestRecorder&gt;</pre><p><b>This class is under development and is subject to change.</b></p>
+<ul>
+<li><a href="qtuitestrecorder-members.html">List of all members, including inherited members</a></li>
+</ul>
+<hr />
+<a name="public-functions"></a>
+<h2>Public Functions</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtuitestrecorder.html#QtUiTestRecorder">QtUiTestRecorder</a></b> ( QObject * <i>parent</i> = 0 )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="qtuitestrecorder.html#dtor.QtUiTestRecorder">~QtUiTestRecorder</a></b> ()</td></tr>
+</table>
+<hr />
+<a name="signals"></a>
+<h2>Signals</h2>
+<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtuitestrecorder.html#activated">activated</a></b> ( QObject * <i>widget</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtuitestrecorder.html#entered">entered</a></b> ( QObject * <i>widget</i>, QVariant const &amp; <i>item</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtuitestrecorder.html#gotFocus">gotFocus</a></b> ( QObject * <i>widget</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtuitestrecorder.html#keyEvent">keyEvent</a></b> ( int <i>key</i>, int <i>modifiers</i>, bool <i>isPress</i>, bool <i>isAutoRepeat</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtuitestrecorder.html#mouseEvent">mouseEvent</a></b> ( int <i>x</i>, int <i>y</i>, int <i>state</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtuitestrecorder.html#selected">selected</a></b> ( QObject * <i>widget</i>, QString const &amp; <i>item</i> )</td></tr>
+<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="qtuitestrecorder.html#stateChanged">stateChanged</a></b> ( QObject * <i>widget</i>, int <i>state</i> )</td></tr>
+</table>
+<a name="details"></a>
+<hr />
+<h2>Detailed Description</h2>
+<p>The QtUiTestRecorder class provides an interface for observing application-wide high level user actions.</p>
+<p>QtUiTestRecorder aggregates the signals declared in the <a href="qtuitest.html">QtUiTest widget interfaces</a> to provide a single object capable of watching for user input.</p>
+<p>Note that using this class is expensive because it involves watching for signals on a large number of objects. When you create a QtUiTestRecorder and connect to its signals, this will result in every existing widget being wrapped in a <a href="qtuitest.html">test widget</a>. To avoid this, do not connect to the signals of a QtUiTestRecorder unless you will definitely use the result.</p>
+<hr />
+<h2>Member Function Documentation</h2>
+<h3 class="fn"><a name="QtUiTestRecorder"></a>QtUiTestRecorder::QtUiTestRecorder ( QObject * <i>parent</i> = 0 )</h3>
+<p>Constructs a <a href="qtuitestrecorder.html">QtUiTestRecorder</a> with the given <i>parent</i>.</p>
+<h3 class="fn"><a name="dtor.QtUiTestRecorder"></a>QtUiTestRecorder::~QtUiTestRecorder ()</h3>
+<p>Destroys the <a href="qtuitestrecorder.html">QtUiTestRecorder</a>.</p>
+<h3 class="fn"><a name="activated"></a>void QtUiTestRecorder::activated ( QObject * <i>widget</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
+<p>Emitted when <i>widget</i> is activated by any means.</p>
+<p>In this context, &quot;activated&quot; means, for example, clicking a button.</p>
+<p>See also <a href="qtuitest-activatewidget.html#activated">QtUiTest::ActivateWidget::activated</a>().</p>
+<h3 class="fn"><a name="entered"></a>void QtUiTestRecorder::entered ( QObject * <i>widget</i>, QVariant const &amp; <i>item</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
+<p>Emitted when <i>item</i> is entered into <i>widget</i>.</p>
+<p>See also <a href="qtuitest-inputwidget.html#entered">QtUiTest::InputWidget::entered</a>().</p>
+<h3 class="fn"><a name="gotFocus"></a>void QtUiTestRecorder::gotFocus ( QObject * <i>widget</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
+<p>Emitted when <i>widget</i> obtains focus by any means.</p>
+<p>See also <a href="qtuitest-widget.html#gotFocus">QtUiTest::Widget::gotFocus</a>().</p>
+<h3 class="fn"><a name="keyEvent"></a>void QtUiTestRecorder::keyEvent ( int <i>key</i>, int <i>modifiers</i>, bool <i>isPress</i>, bool <i>isAutoRepeat</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
+<p>Emitted when <i>key</i> (with <i>modifiers</i>) is pressed or released.</p>
+<p><i>key</i> is compatible with Qt::Key and <i>modifiers</i> is compatible with Qt::KeyboardModifiers.</p>
+<p>If the event is a press <i>isPress</i> is true, otherwise it is a release. <i>isAutoRepeat</i> is true if the event is generated due to autorepeat.</p>
+<p>This signal is only emitted within the server process, because individual applications cannot monitor system-wide key events.</p>
+<h3 class="fn"><a name="mouseEvent"></a>void QtUiTestRecorder::mouseEvent ( int <i>x</i>, int <i>y</i>, int <i>state</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
+<p>Emitted when the mouse changes state.</p>
+<p><i>x</i> and <i>y</i> are the global co-ordinates of the event. <i>state</i> is the current state of the mouse buttons, compatible with Qt::MouseButtons.</p>
+<p>This signal is only emitted within the server process, because individual applications cannot monitor system-wide mouse events.</p>
+<h3 class="fn"><a name="selected"></a>void QtUiTestRecorder::selected ( QObject * <i>widget</i>, QString const &amp; <i>item</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
+<p>Emitted when <i>item</i> is selected from <i>widget</i>.</p>
+<p>See also <a href="qtuitest-selectwidget.html#selected">QtUiTest::SelectWidget::selected</a>().</p>
+<h3 class="fn"><a name="stateChanged"></a>void QtUiTestRecorder::stateChanged ( QObject * <i>widget</i>, int <i>state</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
+<p>Emitted when the check state changes to <i>state</i> in <i>widget</i>.</p>
+<p>See also <a href="qtuitest-checkwidget.html#stateChanged">QtUiTest::CheckWidget::stateChanged</a>().</p>
+<p /><address><hr /><div align="center">
+<table width="100%" cellspacing="0" border="0"><tr class="address">
+<td width="30%" align="left">Copyright &copy; 2009 Nokia Corporation and/or its subsidiary(-ies)</td>
+<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
+<td width="30%" align="right"><div align="right">QtUiTest</div></td>
+</tr></table></div></address></body>
+</html>
diff --git a/doc/src/classic.css b/doc/src/classic.css
new file mode 100644
index 0000000..320da66
--- /dev/null
+++ b/doc/src/classic.css
@@ -0,0 +1,279 @@
+BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV {
+ font-family: Arial, Geneva, Helvetica, sans-serif;
+}
+H1 {
+ text-align: center;
+ font-size: 160%;
+}
+H2 {
+ font-size: 120%;
+}
+H3 {
+ font-size: 100%;
+}
+
+h3.fn,span.fn
+{
+ background-color: #eee;
+ border-width: 1px;
+ border-style: solid;
+ border-color: #ddd;
+ font-weight: bold;
+ padding: 6px 0px 6px 10px;
+ margin: 42px 0px 0px 0px;
+}
+
+hr {
+ border: 0;
+ color: #a0a0a0;
+ background-color: #ccc;
+ height: 1px;
+ width: 100%;
+ text-align: left;
+ margin: 34px 0px 34px 0px;
+}
+
+table.valuelist {
+ border-width: 1px 1px 1px 1px;
+ border-style: solid;
+ border-color: #dddddd;
+ border-collapse: collapse;
+ background-color: #f0f0f0;
+}
+
+table.indextable {
+ border-width: 1px 1px 1px 1px;
+ border-style: solid;
+ border-collapse: collapse;
+ background-color: #f0f0f0;
+ border-color:#555;
+ font-size: 100%;
+}
+
+table td.largeindex {
+ border-width: 1px 1px 1px 1px;
+ border-collapse: collapse;
+ background-color: #f0f0f0;
+ border-color:#555;
+ font-size: 120%;
+}
+
+table.valuelist th {
+ border-width: 1px 1px 1px 2px;
+ padding: 4px;
+ border-style: solid;
+ border-color: #666;
+ color:white;
+ background-color:#666;
+}
+
+th.titleheader {
+ border-width: 1px 0px 1px 0px;
+ padding: 2px;
+ border-style: solid;
+ border-color: #666;
+ color:white;
+ background-color:#555;
+ background-image:url('images/gradient.png')};
+ background-repeat: repeat-x;
+ font-size: 100%;
+}
+
+
+th.largeheader {
+ border-width: 1px 0px 1px 0px;
+ padding: 4px;
+ border-style: solid;
+ border-color: #444;
+ color:white;
+ background-color:#555555;
+ font-size: 120%;
+}
+
+p {
+
+ margin-left: 4px;
+ margin-top: 8px;
+ margin-bottom: 8px;
+}
+
+a:link
+{
+ color: #0046ad;
+ text-decoration: none
+}
+
+a:visited
+{
+ color: #672967;
+ text-decoration: none
+}
+
+a.obsolete
+{
+ color: #661100;
+ text-decoration: none
+}
+
+a.compat
+{
+ color: #661100;
+ text-decoration: none
+}
+
+a.obsolete:visited
+{
+ color: #995500;
+ text-decoration: none
+}
+
+a.compat:visited
+{
+ color: #995500;
+ text-decoration: none
+}
+
+body
+{
+ background: #ffffff;
+ color: black
+}
+
+table.generic, table.annotated
+{
+ border-width: 1px;
+ border-color:#bbb;
+ border-style:solid;
+ border-collapse:collapse;
+}
+
+table td.memItemLeft {
+ width: 180px;
+ padding: 2px 0px 0px 8px;
+ margin: 4px;
+ border-width: 1px;
+ border-color: #E0E0E0;
+ border-style: none;
+ font-size: 100%;
+ white-space: nowrap
+}
+
+table td.memItemRight {
+ padding: 2px 8px 0px 8px;
+ margin: 4px;
+ border-width: 1px;
+ border-color: #E0E0E0;
+ border-style: none;
+ font-size: 100%;
+}
+
+table tr.odd {
+ background: #f0f0f0;
+ color: black;
+}
+
+table tr.even {
+ background: #e4e4e4;
+ color: black;
+}
+
+table.annotated th {
+ padding: 3px;
+ text-align: left
+}
+
+table.annotated td {
+ padding: 3px;
+}
+
+table tr pre
+{
+ padding-top: 0px;
+ padding-bottom: 0px;
+ padding-left: 0px;
+ padding-right: 0px;
+ border: none;
+ background: none
+}
+
+tr.qt-style
+{
+ background: #96E066;
+ color: black
+}
+
+body pre
+{
+ padding: 0.2em;
+ border: #e7e7e7 1px solid;
+ background: #f1f1f1;
+ color: black
+}
+
+table tr.qt-code pre
+{
+ padding: 0.2em;
+ border: #e7e7e7 1px solid;
+ background: #f1f1f1;
+ color: black
+}
+
+span.preprocessor, span.preprocessor a
+{
+ color: darkblue;
+}
+
+span.comment
+{
+ color: darkred;
+ font-style: italic
+}
+
+span.string,span.char
+{
+ color: darkgreen;
+}
+
+.title
+{
+ text-align: center
+}
+
+.subtitle
+{
+ font-size: 0.8em
+}
+
+.small-subtitle
+{
+ font-size: 0.65em
+}
+
+.qmlitem {
+ padding: 0;
+}
+
+.qmlname {
+ white-space: nowrap;
+}
+
+.qmltype {
+ text-align: center;
+ font-size: 160%;
+}
+
+.qmlproto {
+ background-color: #eee;
+ border-width: 1px;
+ border-style: solid;
+ border-color: #ddd;
+ font-weight: bold;
+ padding: 6px 0px 6px 10px;
+ margin: 42px 0px 0px 0px;
+}
+
+.qmldoc {
+}
+
+*.qmlitem p {
+}
diff --git a/doc/src/gendoc.sh b/doc/src/gendoc.sh
new file mode 100755
index 0000000..bfb1bfe
--- /dev/null
+++ b/doc/src/gendoc.sh
@@ -0,0 +1,6 @@
+QTUITEST=../.. qdoc3 qtuitest.qdocconf
+THISYEAR=`date +%Y`
+for f in $( ls ../html/*.html ); do
+ sed s/%THISYEAR%/$THISYEAR/g ../html/$f > ../html/$f.temp
+ mv ../html/$f.temp ../html/$f
+done
diff --git a/doc/src/images/qt-logo.png b/doc/src/images/qt-logo.png
new file mode 100644
index 0000000..2dc6716
--- /dev/null
+++ b/doc/src/images/qt-logo.png
Binary files differ
diff --git a/doc/src/qtuitest.qdocconf b/doc/src/qtuitest.qdocconf
new file mode 100644
index 0000000..30eb1e1
--- /dev/null
+++ b/doc/src/qtuitest.qdocconf
@@ -0,0 +1,55 @@
+# Run qdoc from the directory that contains this file.
+
+project = QtUiTest
+description = QtUiTest Reference Documentation
+url = http://doc.qt.nokia.com/
+
+language = Cpp
+
+defines = Q_QDOC __cplusplus
+
+headerdirs = $QTUITEST/libqsystemtest $QTUITEST/lib
+sourcedirs = $QTUITEST/doc/src $QTUITEST/libqsystemtest $QTUITEST/lib
+sources.fileextensions = "*.cpp *.qdoc"
+
+Cpp.ignoretokens = QSYSTEMTEST_EXPORT
+codeindent = 1
+
+imagedirs = images
+outputdir = ../html
+codeindent = 1
+extraimages.HTML = qt-logo
+extrafiles = classic.css
+
+macro.key = "\\bold"
+macro.menu = "\\bold"
+macro.gui = "\\bold"
+macro.reg.HTML = "<sup>&reg;</sup>"
+macro.raisedaster.HTML = "<sup>*</sup>"
+macro.BR.HTML = "<br />"
+macro.br.HTML = "<br />"
+macro.QD = "\\e{Qt Designer}"
+macro.QA = "\\e{Qt Assistant}"
+macro.eacute.HTML = "&eacute;"
+macro.aring.HTML = "&aring;"
+macro.oslash.HTML = "&oslash;"
+macro.ouml.HTML = "&ouml;"
+macro.Auml.HTML = "&Auml;"
+macro.uuml.HTML = "&uuml;"
+
+HTML.stylesheets = classic.css
+HTML.postheader = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">\n" \
+ "<tr>\n" \
+ "<td align=\"left\" valign=\"top\" width=\"32\">" \
+ "<a href=\"http://qt.nokia.com/\"><img src=\"images/qt-logo.png\" align=\"left\" border=\"0\" /></a>" \
+ "</td>\n" \
+ "<td width=\"1\">&nbsp;&nbsp;</td>" \
+ "<td align=\"right\" valign=\"top\" width=\"230\"></td></tr></table>"
+
+HTML.footer = "<p /><address><hr /><div align=\"center\">\n" \
+ "<table width=\"100%\" cellspacing=\"0\" border=\"0\"><tr class=\"address\">\n" \
+ "<td width=\"30%\" align=\"left\">Copyright &copy; %THISYEAR% Nokia Corporation " \
+ "and/or its subsidiary(-ies)</td>\n" \
+ "<td width=\"40%\" align=\"center\"><a href=\"trademarks.html\">Trademarks</a></td>\n" \
+ "<td width=\"30%\" align=\"right\"><div align=\"right\">QtUiTest</div></td>\n" \
+ "</tr></table></div></address>"
diff --git a/doc/src/qtuitest_manual.qdoc b/doc/src/qtuitest_manual.qdoc
new file mode 100644
index 0000000..133e1aa
--- /dev/null
+++ b/doc/src/qtuitest_manual.qdoc
@@ -0,0 +1,372 @@
+/*!
+
+\page qtuitest_manual.html
+\title QtUiTest Manual
+
+The QtUiTest framework is a tool for automatic and semi-automatic User Interface/System level testing of Qt based applications and libraries. QtUiTest provides functionality commonly found in system test frameworks but with a focus on maintainable cross-platform tests.
+
+Contents:
+\tableofcontents
+
+\section1 Introduction
+
+QtUiTest is, by design, quite similar to the \l{QTest}{QTestLib API} that is used for Unit level testing. In contrast to QTestLib however, QtUiTest based tests are written in QtScript. Please refer to the \l{QTestLib Manual} if you are looking for a Unit test framework.
+
+QtUiTest is a scripting test language plus some basic test execution tools and as such does not provide a complete Integrated Development Environment (IDE) to write and execute tests. Tests can be written with any standard editor or development IDE. Tests can be executed from the command line or in continuous integration test systems.
+
+\section1 The Scripting Language
+
+\section2 Language design philosophy
+
+QtUiTest aims to provide a test scripting language that is:
+\list
+\o simple, reliable and easy to learn,
+\o resilient to UI changes,
+\o transparent to device changes (i.e. a touchscreen and keyboard based device should run the same test),
+\o suitable for performance testing.
+\endlist
+
+QtUiTest scripts are written from a User perspective. When a User uses a GUI application all he/she does is apply a few concepts that form the basis of using a GUI application. For instance, a button can be clicked on and then 'the text on the button' will happen.
+
+It is irrelevant to the user that the actual UI implementation uses a button. The UI could just as well have been an html page with a hyperlink in it with a similar text as on the button. In both cases, the user will 'select' the text to initiate a certain action from the application. So, today the implementation can be a button, tomorrow it can be a hyperlink, the day after tomorrow it can be something that hasn't been invented yet: the principle remains the same.
+
+So conceptually a user does not 'click' keys, but rather uses the concept of a button to 'select' an action or hits keys on a real or virtual keyboard to 'enter' text. The user wants something to happen and has an understanding of what needs to be done to "get there".
+
+On a new system a user first needs to learn the User Manual. The more the system behaves in a way the user already knows, and the more the system provides functionality in a way the user can predict, the more "Intuitive" and "Usable" the system is experienced by the user.
+
+System testing is, in our view, very much related to these fundamental issues and just like a real user, QtUiTest understands the UI concepts that form the foundation of a UI application and uses a simple syntax to enable the tester to describe it's Use Cases.
+
+Next to being able to write tests in a language that is as close as possible to the user experience it is also important to write maintainable code. Automating tests is well known to be major investment, and tests being broken for every small UI change, or tests that need to be modified for each slightly different device (or Operating System) are a major problem. QtUiTest is designed in such a way that the script will result in good readable and understandable code which reduces the need for additional documentation, as well as tests that are platform agnostic.
+
+\list
+\o The four most important commands are \l{QSystemTest::}{select()}, \l{QSystemTest::}{enter()}, \l{QSystemTest::}{compare()} and \l{QSystemTest::}{verify()}.
+\o Every command is making verification steps along the way. For instance, \l{QSystemTest::}{enter()} will perform a verification at the end to ensure that the text has been entered correctly.
+\o There is no need to explicitly code key clicks or mouse clicks. The usage of key/mouse clicks typically results in low level code that is difficult to understand and should only be used in exceptional cases.
+\o The test can be executed equally well with a keyboard based and/or a mouse/touchscreen based system.
+\o There is usually no need for explicit synchronisation steps such as a \l{QSystemTest::}{wait()}: QtUiTest understands that certain actions may result in a background task and will wait automatically.
+\o QtUiTest uses the Labels that are visible on the screen to find the editable 'buddy fields'.
+\o QtUiTest is forgiving to UI changes. For instance, the user "Name" field may start as a simple line edit, then may become a full text edit, and finally become a combobox but all this time the test will pass without as much as a single complaint: as long as a field labeled "Name" exists and a text can be successfully entered into a buddy field the test is a success from user perspective.
+\o Test Data and Test Logic are separated.
+\endlist
+
+\l{QtUiTest Manual#introduction}{Back to QtUiTest Manual}
+
+\section1 Using QtUiTest
+
+\section2 Creating a Test
+
+Each System Test is stored in its own file ending with the \c .js extension.
+
+Within the test script, a \c testcase object is created containing several test functions.
+Within each test function, the \l {QtUiTest API Reference}{QtUiTest API} scripting commands may be used, as well as
+standard commands provided by \l{QtScript Module}{QtScript}.
+
+Helper functions and global variables can be written outside of the testcase object.
+
+For example:
+
+\code
+testcase = {
+ testFunction1: function() {
+ startApplication("Dog Walker");
+ select("Walk the dog...", optionsMenu());
+ compare( getText(), "Dog was walked." );
+ },
+
+ testFunction2: function() {
+ var i = 1;
+ helper(i);
+ }
+}
+
+function helper(num) {
+ verify( num > 0 );
+ ...
+}
+\endcode
+
+The project files for System tests are usually very simple, for example:
+\code
+ CONFIG+=systemtest
+ SOURCES+=sys_mytest.js
+\endcode
+Adding "systemtest" to CONFIG enables the use of the "make test" command.
+
+\l{QtUiTest Manual#introduction}{Back to QtUiTest Manual}
+
+\section3 Writing a Manual System Test
+
+Writing a Manual System test is typically the first step in many test automation efforts. It is far better to document and run through the steps manually to check that an idea is executable (and repeatable) before time is invested in automating all steps.
+
+The downside about Manual tests is that the test is usually 'somewhere else', i.e. in a text document or spreadsheet that isn't necessarily saved in the same version control system as the source code it tests, or in a format that can be easily merged by the version control system.
+
+QtUiTest integrates the Manual test process into the Automation process and makes it possible to seamlessly transition from a full Manual to a Semi-Automatic to a Full-Automatic test. All work is done in the same text file, so the intermediate steps are all recorded in the version control system for easy retrieval, merging and tracking.
+
+A Manual test is written by using the prompt() command:
+\code
+ my_manual_test: function()
+ {
+ prompt( "* Do something\n"+
+ "* Do something else\n"+
+ "* Verify that the result is as expected");
+ }
+\endcode
+
+When a System test is executed it can be a combination of fully automated and semi-automated test functions. The automated tests simply execute without user intervention and result in a PASS/FAIL/etc. A Manual test will be executed until a prompt is detected at which time a Dialog is shown on the Desktop (host) machine containing the specified prompt text. In the dialog, the stars (*) will be replaced with "1:", "2:", etc to indicate the steps that need to be taken in sequence. The advantage of using stars (*) in the code is that lines can be inserted/removed without having to renumber the remaining steps until the end of the prompt.
+
+The Dialog will also contain "Pass" and "Fail" buttons as well as a "Record" button that puts the test system into recording mode. The Pass and Fail buttons obviously must be used to indicate the result of the manual step.
+
+It is perfectly fine, and to be expected, that prompts() will be combined with automated steps. For instance, one could launch an application and then select a few menu options before arriving at the section of the test that requires manual intervention.
+
+For instance:
+\code
+ startApplication("Dog Walker");
+ select("Walk the dog...");
+ prompt( "* Verify that the dog is having a good time");
+\endcode
+
+\l{QtUiTest Manual#introduction}{Back to QtUiTest Manual}
+
+\section2 Running a Test
+
+System tests can usually be run using the command "make test". Alternatively, the QtUiTest Script Execution engine (qtuitestrunner) can be called directly:
+\code
+ qtuitestrunner <scriptname> <options>
+\endcode
+These commands should be run on the desktop machine (host environment).
+
+
+\section3 Running tests in a Continuous Integration System
+
+QtUiTest tests can be executed from the command line of a desktop (Host) machine and as such are perfectly suited to be executed in Continuous Integration Test Systems. The output format of the test, the testresults, can be printed to the screen or saved into a file in a number of formats (such as XML) to allow easy post processing by test-reporting and defect-tracking systems.
+
+\l{QtUiTest Manual#introduction}{Back to QtUiTest Manual}
+
+\section2 QtUiTest Tutorial
+
+Please refer to the \l {QtUiTest Tutorial} for a detailed example about writing QtUiTest test cases.
+
+\l{QtUiTest Manual#introduction}{Back to QtUiTest Manual}
+
+\section1 QtUiTest API Overview
+
+ To write a System Test, create a new file containing a test script, which defines a "testcase" object with one or more test functions.
+
+ For example:
+ \code
+ testcase = {
+ testFunction1: function() {
+ ...
+ },
+ testFunction2: function() {
+ ...
+ }
+ }
+ \endcode
+
+ The testfunctions can be written with a combination of standard QtScript and special QtUiTest commands, which are grouped below.
+
+ \list
+ \o \l {System Architecture} - briefly describes the architecture of QtUiTest.
+ \o \l {Query Paths} - specifying widgets and objects to access.
+ \o \l {Querying Objects} - getting information from widgets or objects.
+ \o \l {Learn Mode} - dynamically generating test data.
+ \o \l {Application Management} - starting and stopping applications.
+ \o \l {File Management} - accessing files on the test system.
+ \o \l {Time Management} - functionality to manage the system time on the device.
+ \o \l {Key Simulation} - simulating entering text, selection of items from the menus or lists, and generation of arbitrary key events.
+ \o \l {Mouse / Touchscreen Simulation} - simulating user interaction via a mouse or touchscreen.
+ \o \l {Other} - some miscellaneous functionality.
+ \endlist
+
+ \section2 System Architecture
+
+ The QtUiTest framework is designed around a script execution engine (qtuitestrunner) that is executed on the desktop (host machine) and a set of QtUiTest
+ plugins that are loaded by the System Under Test (SUT). The plugins are running in the SUT process space, i.e. may be running on a device, and communicate with the System Test script execution engine via a socket based communication protocol.
+
+ Each test command is sent as a query to the SUT, and the script runner will be blocked until a reply is received from the SUT.
+
+\l{QtUiTest Manual#introduction}{Back to QtUiTest Manual}
+
+ \section2 Query Paths
+
+ Most QtUiTest functions use 'query paths' to identify the object on which the query needs to be performed. A query path is a string value, and is one of the following:
+ \list
+ \o a Label
+ \o a Signature
+ \endlist
+ \endlist
+
+\l{QtUiTest Manual#introduction}{Back to QtUiTest Manual}
+
+ \section3 Labels
+ A \bold{Label} is a (usually static) text description that is associated with an editable field. In some cases, a widget is
+ self-labelling (for example, the text property of a QPushButton), but often the label is seperate widget (usually a QLabel).
+ The Label and Edit widgets form a "buddy pair". This relationship can be hardcoded in the application, but this is not
+ mandatory.
+
+ For labels that have no buddy widget set, QtUiTest resolves the buddy relationships based on relative positions of the
+ label and edit widgets on screen. By default, for Left-to-Right languages, labels are expected to be to the left of their
+ corresponding edit widgets (and to the right for Right-to-Left languages). However, this can be changed by using the
+ setLabelOrientation() function.
+
+ For example, the code below will enter the text "dog walker" in a text field next to a Label with text "Occupation".
+ \code
+ enter( "dog walker", "Occupation" );
+ \endcode
+ In words the example says: "enter the text 'dog walker' into a field labeled 'Occupation'.
+
+ A special case of a Label is an empty string. This will resolve to the widget that currently has focus, or (for touchscreen
+ devices) the first field in the dialog. Note that for tests that should run both on keyboard and touchscreen devices it
+ may be risky to rely on this feature. Always explicitly specifying a Label is the most safe and portable thing to do.
+
+ Using a Label to identify a field is the preferred mechanism for identifying fields. It is reliable, easy to write, easy
+ to understand and easy to debug.
+
+\l{QtUiTest Manual#introduction}{Back to QtUiTest Manual}
+
+ \section3 Signatures
+ In some cases it is not possible to use a label to uniquely identify a widget. In these cases it is necessary to use a
+ \bold{Signature} to identify the widget.
+
+ A Signature is a string that uniquely identifies an object. Signatures are generated by the system at run-time; the signature
+ of a widget will be different each time a test is run, so it is not possible to hard-code a signature value in a test case.
+
+ The signature() function can be used to return the signature of an object based on its position relative to another widget.
+ \code
+ enter( "dog walker", signature("Label",1));
+ \endcode
+ In this case, the signature() function returns the first editable field to the right of or below the field associated with label "Label".
+
+ \section3 Querying Widgets By Property
+ Widgets can also be specified using the findByProperty() function. This finds all widgets that match the specified property values, sorted by position (top left to bottom right). The values returned are returned as a QStringList of signatures. In addition to the properties supported by the widget, "className" and "inherits" are also supported. The "className" matches if the specified value matches the class name of the object; "inherits" matches if the class of the object inherits the specified class name.
+
+ For example:
+ \code
+ var toolButtons = findByProperty( { className: "QToolButton" } );
+ ...
+ select (toolButtons[3]);
+ var addNewPage = findByProperty( { tooltip: "Add new page" } );
+ \endcode
+
+ Multiple property value may be specified, for example:
+ \code
+ var password = findByProperty( { className: "QLineEdit", echoMode: 2 } );
+ \endcode
+
+ Using findByProperty requires some knowledge of the inner workings of the application under test, and as such breaks some of the principles of black-box testing. It is recommended that, where possible, logic using findByProperty should be wrapped in a utility function, which can be called by the test case.
+
+
+\l{QtUiTest Manual#introduction}{Back to QtUiTest Manual}
+
+ \section2 Learn Mode
+
+ Some testcases require the existence of non-volatile test data, such as screen snapshots. To simplify the process of data gathering, the test system supports the
+ concept of a learn mode. When a test is run in learn mode, certain actions will result in the generation of test data, which will be presented to the user to manually
+ verify once, then stored for use in subsequent test runs. A system test is run in learn mode by supplying the \c -learn or \c -learn-all command line options.
+
+ The system test framework will store generated test data in the \c testdata subdirectory of the directory containing the test script.
+
+ NOTE: It is up to the tester to ensure that new learned elements are added to a version control system.
+
+\l{QtUiTest Manual#introduction}{Back to QtUiTest Manual}
+
+ \section2 Application Management
+
+ \list
+ \o \l{QSystemTest::}{startApplication()} - start an application.
+ \endlist
+
+\l{QtUiTest Manual#introduction}{Back to QtUiTest Manual}
+
+ \section2 File Management
+
+ It is possible to access files on the System Under Test (even if this is another device) from within a system test.
+
+ \list
+ \o \l{QSystemTest::}{putFile()}, \l{QSystemTest::}{putData()} - copy data to the test system.
+ \o \l{QSystemTest::}{deletePath()} - delete files from the test system.
+ \o \l{QSystemTest::}{getDirectoryEntries()} - read the contents of a directory on the test system.
+ \endlist
+
+\l{QtUiTest Manual#introduction}{Back to QtUiTest Manual}
+
+ \section2 Querying Objects
+
+ The system test framework provides powerful methods of obtaining information on
+ particular objects and widgets in the system.
+
+ \list
+ \o \l{QSystemTest::}{isVisible()}, \l{QSystemTest::}{isChecked()}, \l{QSystemTest::}{isEnabled()} - retrieve simple information from widgets.
+ \o \l{QSystemTest::}{getText()}, \l{QSystemTest::}{getSelectedText()} - retrieve a textual representation of widgets.
+ \o \l{QSystemTest::}{getProperty()}, \l{QSystemTest::}{setProperty()}, \l{QSystemTest::}{invokeMethod()} - access Qt properties, signals and slots on any QObject.
+ \endlist
+
+\l{QtUiTest Manual#introduction}{Back to QtUiTest Manual}
+
+ \section2 Text Entry and Navigation
+
+ The system test framework provides several ways of entering text into widgets and for navigating through applications.
+
+ \list
+ \o \l{QSystemTest::}{enter()} - navigate to a widget and enter any text.
+ \o \l{QSystemTest::}{select()} - choose a particular item from a list, combo box, menu or navigate to a particular widget or tab.
+ \endlist
+
+ These functions are input method independant and will have the same syntax for both Keyboard and Mouse/Touchscreen based devices and are therefore the preferred commands to use in tests.
+
+\l{QtUiTest Manual#introduction}{Back to QtUiTest Manual}
+
+ \section2 Key Simulation
+
+ The system test framework provides several ways of generating arbitrary key events.
+
+ \list
+ \o \l{QSystemTest::}{keyPress()}, \l{QSystemTest::}{keyRelease()}, \l{QSystemTest::}{keyRelease()}, \l{QSystemTest::}{keyClickHold()} - press/release/click/hold any key.
+ \endlist
+
+ Note that Key simulation should be used in exceptional cases only since it makes the test specific for keyboard based devices. Other functions such as select() are the preferred mechanism to write tests because these will work both for Keyboard and Mouse/Touchscreen based devices.
+
+\l{QtUiTest Manual#introduction}{Back to QtUiTest Manual}
+
+ \section2 Mouse / Touchscreen Simulation
+
+ The system test framework provides methods to simulate input from a mouse or touchscreen.
+
+ \list
+ \o \l{QSystemTest::}{mousePress()}, \l{QSystemTest::}{mouseRelease()}, \l{QSystemTest::}{mouseClick()}, \l{QSystemTest::}{mouseClickHold()} - press/release/click with mouse or touchscreen.
+ \endlist
+
+ Note that Mouse simulation should be used in exceptional cases only since it makes the test specific for mouse/touchscreen based devices. Other functions such as select() are the preferred mechanism to write tests because these will work both for Keyboard and Mouse/Touchscreen based devices.
+
+\l{QtUiTest Manual#introduction}{Back to QtUiTest Manual}
+
+ \section2 Other
+
+ Some functionality does not fall into the aforementioned categories:
+
+ \list
+ \o \l{QSystemTest::}{setSetting()}, \l{QSystemTest::}{getSetting()} - access any settings stored within QSettings objects.
+ \endlist
+
+\l{QtUiTest Manual#introduction}{Back to QtUiTest Manual}
+
+ \section1 Extending QtUiTest for Custom Widgets
+
+QtUiTest's high-level commands require knowledge of the widgets they interact with. For example, \l{QSystemTest::}{select()} must know how to select items from both a combobox and a list view.
+
+When testing an application which uses custom widgets, some additional steps may be required in order to use high-level QtUiTest commands. The logic for interacting with custom widgets must be implemented either in the application under test or in a plugin.
+
+See \l{Creating a QtUiTest Test Widget} for more details.
+
+\l{QtUiTest Manual#introduction}{Back to QtUiTest Manual}
+
+ \section1 QtUiTest API Reference
+
+For a complete description of the QtUiTest API please refer to \l{QSystemTest}{QSystemTest API}.
+
+\l{QtUiTest Manual#introduction}{Back to QtUiTest Manual}
+
+\endif
+
+*/
diff --git a/doc/src/qtuitest_plugins.qdoc b/doc/src/qtuitest_plugins.qdoc
new file mode 100644
index 0000000..d3161d3
--- /dev/null
+++ b/doc/src/qtuitest_plugins.qdoc
@@ -0,0 +1,297 @@
+/*!
+
+\page qtuitest_plugins.html
+\title Creating a QtUiTest Test Widget
+
+\tableofcontents
+
+\section1 Introduction
+
+QtUiTest provides support for simulating high-level user interface interactions.
+Conceptually these take the form of, for example, \i{Select 'Dog' from the widget labelled 'Animal'}, or \i{Enter 'Bob' into the widget labelled 'Name'}.
+
+Crucially, testcases do not need to specify the exact type of each widget or how to interact with it.
+Instead the logic for interacting with different types of widgets resides on the system under test, either alongside the implementation of each widget or in a plugin.
+Each class of widget which QtUiTest can interact with has a corresponding wrapper class, referred to as a test widget.
+
+This document explains when a test widget must be created and how it is implemented.
+
+\section1 When a Test Widget is Required
+
+QtUiTest includes support for most Qt widgets. When a new type of widget is introduced, a test widget may be required.
+
+In these cases, a test widget will almost certainly have to be implemented:
+\list
+\o A custom widget implements painting and interaction by overriding functions such as \l{QWidget::}{paintEvent()} and \l{QWidget::}{keyPressEvent()}.
+\o The behavior of a major user interface element has been customized (for example, a device profile is used which has a device-specific way of accepting incoming phone calls).
+\endlist
+
+In these cases, a test widget will usually not be required:
+\list
+\o A custom widget acts primarily as a container for standard widgets.
+ In this case, QtUiTest can interact with the contained widgets as normal.
+\o A custom widget subclasses a standard widget and correctly reimplements virtual functions.
+ For example, a subclass of QAbstractItemView which performs custom painting with a custom model will work with no additional effort if \l{QAbstractItemView::}{visualRect()} is implemented correctly (for mouse interaction), standard item view key event handling is used and the item model accurately reports its data.
+\endlist
+
+As an example, consider a testcase for creating a contact in the addressbook application.
+At one point in the testcase, we wish to set the contact's title to Doctor:
+
+\c{select("Dr", "Title");}
+
+This requires that the widget referred to by "Title" implements the \l{QtUiTest::}{SelectWidget} interface.
+If this is not the case, the testcase fails with a failure message like the following:
+
+\c{FAIL! : sys_addressbook::creating_a_contact() ERROR: Title (QComboBox(0x80b2768)) is not a SelectWidget.}
+
+This error message indicates that the "Title" widget, which is a QComboBox, does not have any corresponding test widget which implements the \l{QtUiTest::}{SelectWidget} interface, and therefore can't have items selected from it.
+
+Note that not all errors arising from missing test widgets will be of this form.
+
+\section1 Choosing the Right Interfaces
+
+Test widgets must implement one or more of a standard set of interfaces belonging to the \l{QtUiTest} namespace.
+
+Test widget interfaces map to the conceptual purpose of a widget from a user's perspective.
+The available interfaces are listed below:
+
+\table
+\header \o Interface \o Applies to \o Examples
+\row
+\o \l{QtUiTest::}{Widget}
+\o All 2D user interface elements.
+\o QWidget
+\row
+\o \l{QtUiTest::}{ActivateWidget}
+\o Widgets which are activated to trigger some action.
+\o QAbstractButton
+\row
+\o \l{QtUiTest::}{CheckWidget}
+\o Widgets which can be checked and unchecked.
+\o QCheckBox, QRadioButton
+\row
+\o \l{QtUiTest::}{TextWidget}
+\o Widgets which display text.
+\o QLineEdit, QTextEdit, QMenu, QAbstractItemView, QLabel, many others
+\row
+\o \l{QtUiTest::}{InputWidget}
+\o Widgets which can accept text input.
+\o QLineEdit, QTextEdit
+\row
+\o \l{QtUiTest::}{ListWidget}
+\o Widgets which display a list of items.
+\o QAbstractItemView, QMenu
+\row
+\o \l{QtUiTest::}{SelectWidget}
+\o Widgets which allow an item to be selected from a list.
+\o QAbstractItemView, QMenu
+\endtable
+
+Each test widget should implement all interfaces applicable to the wrapped widget.
+Test widgets can subclass other test widgets and reuse already-implemented interfaces.
+For example, the test widget for QCheckBox could inherit from the test widget for QAbstractButton to avoid having to reimplementing the \l{QtUiTest::}{Widget}, \l{QtUiTest::}{TextWidget} and \l{QtUiTest::}{ActivateWidget} interfaces again.
+
+Some test widget interfaces are strongly related and are likely to be implemented in pairs.
+Almost all widgets which accept text input also display the entered text, so any test widget which implements \l{QtUiTest::}{InputWidget} will usually implement \l{QtUiTest::}{TextWidget}.
+Almost all widgets which can be selected from also display the selectable items, so any test widget which implements \l{QtUiTest::}{SelectWidget} will usually implement \l{QtUiTest::}{ListWidget}.
+
+\section1 Implementing the Test Widget
+
+To make a new test widget visible to QtUiTest, there are two separate approaches which can be taken, each with their own advantages.
+
+\section2 Plugin method
+
+The plugin method involves adding the test widget code into a plugin which is then loaded by QtUiTest at runtime.
+This is the most suitable method to use in most cases and the only method used for the test widgets shipped with QtUiTest.
+
+Advantages to the plugin method compared to the multiple inheritance method include:
+\list
+\o The code for the test widget is cleanly separated from the wrapped widget and hence easy to omit from a release build without the need for \c{#ifdef}s or similar measures.
+\o It is easier to reuse test widget code because test widgets aren't directly tied to wrapped widgets.
+\o It is possible to customize the process of \l{QtUiTest::WidgetFactory::find()}{finding} and \l{QtUiTest::WidgetFactory::create()}{creating} test widgets.
+\o Typical multiple inheritance difficulties are avoided, such as the test widget interface API shadowing the API of the wrapped widget.
+\endlist
+
+\section3 Test widget class
+
+Each test widget class needs to inherit from QObject and the relevant test widget interfaces.
+
+In practice, it is common for a test widget class hierarchy to be written which closely mirrors the wrapped widget class hierarchy.
+This makes it possible to avoid rewriting the code for common interfaces such as \l{QtUiTest::Widget} many times.
+
+It is possible to subclass the test widgets shipped with QtUiTest, although they are not guaranteed to remain source or binary compatible across releases.
+The convention used in the reference plugins to generate a test widget class name is to take the wrapped widget class name, drop any leading Q, and prefix Test.
+For example, the test widget wrappers for QWidget and QAbstractItemView are named TestWidget and TestAbstractItemView respectively.
+
+Using the plugin approach, while subclassing from TestWidget to avoid reimplementing the \l{QtUiTest::Widget} interface, would result in a class declaration like the following:
+
+\code
+#include <testwidget.h>
+class TestCustomComboBox : public TestWidget, public QtUiTest::ListWidget,
+ public QtUiTest::SelectWidget, public QtUiTest::TextWidget
+{
+Q_OBJECT
+Q_INTERFACES(
+ QtUiTest::ListWidget
+ QtUiTest::SelectWidget
+ QtUiTest::TextWidget)
+
+public:
+ TestCustomComboBox(CustomComboBox* wrapped);
+ virtual ~TestCustomComboBox();
+
+ // QtUiTest::ListWidget members
+ virtual QStringList list() const;
+ virtual QRect visualRect(const QString&) const;
+
+ // QtUiTest::SelectWidget members
+ virtual bool canSelect(QString const&) const;
+ virtual bool select(QString const&);
+
+ // QtUiTest::TextWidget members
+ virtual QString text() const;
+ virtual QString selectedText() const;
+
+private:
+ CustomComboBox* m_wrapped;
+};
+\endcode
+
+Implementing the test widget is as simple as retrieving the necessary information from the wrapped widget.
+Test widgets can create and use other test widgets at runtime when necessary, as shown in the \c{list()} function below.
+
+\code
+TestCustomComboBox::TestCustomComboBox(CustomComboBox* wrapped)
+ : m_wrapped(wrapped)
+{}
+
+QStringList TestCustomComboBox::list() const
+{ return qtuitest_cast<QtUiTest::ListWidget*>(m_wrapped->view())->list(); }
+
+QString TestCustomComboBox::text() const
+{ return list().join("\n"); }
+
+QString TestCustomComboBox::selectedText() const
+{ return m_wrapped->currentText(); }
+\endcode
+
+Memory management is handled automatically; there will be a maximum of one TestCustomComboBox instance created for any CustomComboBox and it will be destroyed when the underlying CustomComboBox is destroyed.
+
+\section3 Test widget factory
+
+When using the plugin approach it is also necessary to implement a factory class.
+This serves as the entry point to the plugin and handles the logic for creating test widgets.
+
+The test widget factory must subclass \l{QtUiTest::WidgetFactory} and implement the \l{QtUiTest::WidgetFactory::}{create()} function to create test widgets and the \l{QtUiTest::WidgetFactory::}{keys()} function to report which widget classes can be wrapped.
+
+\code
+class TestWidgetsFactory : public QObject, public QtUiTest::WidgetFactory
+{
+ Q_OBJECT
+ Q_INTERFACES(QtUiTest::WidgetFactory)
+
+public:
+ TestWidgetsFactory();
+
+ virtual QObject* create(QObject*);
+ virtual QStringList keys() const;
+};
+\endcode
+
+The \l{QtUiTest::WidgetFactory::}{create()} function is called when a new test widget is to be created.
+Our example widget factory handles CustomComboBox widgets and nothing else.
+
+\code
+QObject* TestWidgetsFactory::create(QObject* wrapped)
+{
+ if ((CustomComboBox* ccb = qobject_cast<CustomComboBox*>(wrapped))) {
+ return new TestCustomComboBox(ccb);
+ }
+ return 0;
+}
+\endcode
+
+The \l{QtUiTest::WidgetFactory::}{keys()} function must report which classes can be handled by this factory.
+Any object passed into the \l{QtUiTest::WidgetFactory::}{create()} function is guaranteed to be one of the classes returned by \l{QtUiTest::WidgetFactory::}{keys()}.
+Classes are handled from most to least specific; when creating a test widget for CustomComboBox, a factory which handles CustomComboBox has higher priority over a factory which handles QWidget.
+If two or more factories handle the same class, it is undefined which factory will be asked to create the test widget.
+
+Our example factory can only handle CustomComboBox widgets so it returns that class name only.
+\code
+QStringList TestWidgetsFactory::keys() const
+{
+ return QStringList() << "CustomComboBox";
+}
+\endcode
+
+Finally, the plugin needs to be exported using the standard Qt plugin mechanism:
+\code
+#include <qplugin.h>
+Q_EXPORT_PLUGIN2(customtestwidgets, TestWidgetsFactory)
+\endcode
+
+In the project's \c{qbuild.pro}, the \c{PLUGIN_TYPE} must be set to \c{qtuitest_widgets}.
+
+\section2 Multiple inheritance method
+
+The multiple inheritance approach requires the widget being wrapped to implement the test widget interfaces itself.
+
+Advantages to the multiple inheritance method compared to the plugin method include:
+\list
+\o The code for the test widget is in the same file as the wrapped widget and hence is more likely to be maintained if the widget is modified.
+\o The test widget has access to the internal structures of the wrapped widget.
+\o There is no need to write a \l{QtUiTest::}{WidgetFactory} class to handle creation of test widgets.
+\endlist
+
+For example, implementing a custom combobox class along with all of the associated test widget interfaces would result in a class declaration like:
+
+\code
+class CustomComboBox : public QComboBox, public QtUiTest::Widget,
+ public QtUiTest::ListWidget, public QtUiTest::SelectWidget,
+ public QtUiTest::TextWidget
+{
+Q_OBJECT
+Q_INTERFACES(
+ QtUiTest::Widget
+ QtUiTest::ListWidget
+ QtUiTest::SelectWidget
+ QtUiTest::TextWidget)
+
+public:
+ CustomComboBox(QWidget* parent = 0);
+ ...
+
+ // CustomComboBox members
+ void addCustomItem(const QVariant& item);
+ void addCustomItems(const QVariantList& items);
+ ...
+
+ // QtUiTest::Widget members
+ virtual const QRect& geometry() const;
+ virtual QRect rect() const;
+ ...
+
+ // QtUiTest::ListWidget members
+ virtual QStringList list() const;
+ virtual QRect visualRect(const QString&) const;
+ ...
+
+ // etc...
+};
+\endcode
+
+Implementing the test widget is as simple as returning the necessary information.
+Test widgets can create and use other test widgets at runtime when necessary, as shown in the \c{list()} function below.
+
+\code
+QStringList CustomComboBox::list() const
+{ return qtuitest_cast<QtUiTest::ListWidget*>(view())->list(); }
+
+QString CustomComboBox::text() const
+{ return list().join("\n"); }
+
+QString CustomComboBox::selectedText() const
+{ return currentText(); }
+\endcode
+
+*/
diff --git a/doc/src/qtuitest_tutorial.qdoc b/doc/src/qtuitest_tutorial.qdoc
new file mode 100644
index 0000000..50a7853
--- /dev/null
+++ b/doc/src/qtuitest_tutorial.qdoc
@@ -0,0 +1,511 @@
+/*!
+ \page qtuitest-tutorial.html
+ \contentspage QtUiTest Manual
+ \nextpage {Chapter 1: Writing a System Test}{Chapter 1}
+
+ \title QtUiTest Tutorial
+
+ This tutorial gives a short introduction on the creation of System Tests using the QtUiTest framework. It is divided into the following chapters:
+
+ \list 1
+ \o \l {Chapter 1: Writing a System Test}{Writing a System Test}
+ \o \l {Chapter 2: Input, Output and Widget Navigation}{Input, Output and Widget Navigation}
+ \o \l {Chapter 3: Data Driven Testing}{Data Driven Testing}
+ \o \l {Chapter 4: Putting It All Together}{Putting It All Together}
+ \endlist
+*/
+
+/*!
+ \page qtuitest-tutorial1.html
+ \contentspage {QtUiTest Tutorial}{Contents}
+ \nextpage {Chapter 2: Input, Output and Widget Navigation}{Chapter 2}
+
+ \title Chapter 1: Writing a System Test
+
+ In this first chapter we will demonstrate how to write a simple system test, and how to execute it.
+
+ \section1 Setting up the environment
+
+ Tests are saved in directories, one directory per test. As a convention we keep the name of the directory the same as the test name although this isn't a requirement. Tests are further stored in a 'tests' directory immediately under the application or library that is being tested. So let's create our first test directory, and we'll be writing a test for the addressbook application.
+
+\code
+ cd src/applications/addressbook
+ mkdir -p tests/sys_demo
+\endcode
+
+ Note that we write and save tests in the \c source tree, and we can execute them from the source as well as the build tree.
+
+ \section1 Writing the Test
+
+ New system tests are defined by creating a new QtScript file (named ending with .js by convention), containing a \c{testcase} object with one or more test functions:
+ So cd into \c tests/my_demo and create a file named \c sys_demo.js with the following content:
+ \code
+ testcase = {
+ testFunction1: function() {
+ print( "Hello World" );
+ },
+ testFunction2: function() {
+ print( "Testfunction 2" );
+ }
+ }
+ \endcode
+
+ The example above shows the creation of a testcase object containing two test functions, \c testFunction1 and \c testFunction2. Obviously not much exciting is going to happen when we run this test. But we'll get to that a little later.
+
+ The second bit that needs to be done is tell the build system about our new project. For this we need to create a project file named \c qbuild.pro. The contents of the file is as follows:
+ \code
+ CONFIG+=systemtest
+ TARGET=sys_demo
+ SOURCES+=sys_demo.js
+ \endcode
+
+ \section2 Running the test for the first time
+ We can simply run the test as follows:
+ \code
+ cd <your_src_location>/src/applications/addressbook/tests/sys_demo
+ make test
+ \endcode
+
+ The test will be built and executed and results in something like this:
+ \code
+1 echo '#!/bin/sh' > <your_build_dir>/src/applications/addressbook/tests/sys_demo/sys_demo
+2 echo 'exec <your_build_dir>/bin/qtuitestrunner <your_src_location>/src/applications/addressbook/tests/sys_demo/sys_demo.js "$@"' >> <your_build_dir>/src/applications/addressbook/tests/sys_demo/sys_demo
+3 chmod 755 <your_build_dir>/src/applications/addressbook/tests/sys_demo/sys_demo
+4 export QPEHOME=$(mktemp -d /tmp/qtopia_maketest_XXXXXX); <your_build_dir>/src/applications/addressbook/tests/sys_demo/sys_demo $ARGS; rm -rf $QPEHOME
+5 ********* Start testing of sys_demo *********
+6 Config: Using QTest library 4.4.2, Qt 4.4.2
+7 PASS : sys_demo::initTestCase()
+8 QDEBUG : sys_demo::testFunction1() Hello World
+9 PASS : sys_demo::testFunction1()
+10 QDEBUG : sys_demo::testFunction2() Testfunction 2
+11 PASS : sys_demo::testFunction2()
+12 PASS : sys_demo::cleanupTestCase()
+13 Totals: 4 passed, 0 failed, 0 skipped
+14 ********* Finished testing of sys_demo *********
+\endcode
+
+In the above snippet line numbers have been added for clarity. Lines 1-4 are a bit of magic to create a subdirectory for the test in the build tree, and to create an 'executable' for the test. Once the executable is created, it is executed and the results are printed to stdout (or to a file if we use extra command line parameters).
+
+Line 5-14 are the result of the test being execute.
+Line 5 simply marks the start of the test.
+Line 6 shows the version numbers of Qt and Qtest that are used.
+Line 7 is the result of a special function named \c initTestCase. Note that we haven't written an initTestCase yet, so this function is empty (and shouldn't fail).
+Once the test is initialized (with initTestCase) the testrunner will start executing all testfunctions, in principle in the order in which they are discovered in the file.
+Line 8 is the result of the print statement we did in testFunction1. Note also that the output clearly marks this information as being a part of \c sys_demo::testFunction1.
+Line 9 is the final test result for testFunction1. Since we did nothing else but a print statement it PASSes the test.
+Line 10 and 11 show the results for testFunction2.
+Line 12 shows the result for the counterpart to initTestCase: after all testfunctions have been executed the system takes a moment to clean up any garbage that has been created during test execution. Just like it's init counterpart is cleanupTestCase \c always called, and called only once, at the end of a test. Since we haven't actually defined anything yet the cleanup is empty and we'd expect it to PASS.
+Line 13 shows the accumulated totals for the test and
+Line 14 finally marks the end of the test.
+
+In this example we have called \c {qbuild test} from the source tree, but we could have done the same, and with the same result from the build tree. This is because we're calling qbuild which knows everything about the actual configuration we're testing, as well as where to find it.
+
+ \section2 Special functions
+
+ As with \l{QTestLib Manual}{QTestLib} unit tests, special reserved functions include the four \l{QTestLib Manual#creating-a-test}{init/cleanup functions}. These behave identically to their unit test counterparts but will be explained here for completeness.
+
+ \table 80%
+ \header \o function \o description
+ \row \o initTestCase \o called once immediately after the test is started. If initTestCase fails, which could happen if you add verification steps in the function, no test will be executed. In normal circumstances, each test will be executed after initTestCase is finished.
+ \row \o init \o called immediately \c before a test function is executed. If a test function has multiple test data sets (to be discussed later) then \c init() will also be called multiple times. When init() fails, the test function will be skipped.
+ \row \o cleanup \o called immediately after a test function has finished executing. cleanup() is guaranteed to be called, even if the test function has failed, i.e. you still get a chance to cleanup the environment after a failure.
+ \row \o cleanupTestCase \o called once after the last test function has been executed.
+ \endtable
+
+ Let's re-write our testcase a bit, but this time we use the special functions.
+
+ \code
+ testcase = {
+ initTestCase: function() {
+ print( "Init complete test" );
+ },
+ cleanupTestCase: function() {
+ print( "Cleanup complete test" );
+ },
+ init: function() {
+ print( "Init test function" );
+ },
+ cleanup: function() {
+ print( "Cleanup test function" );
+ },
+ testFunction1: function() {
+ print( "Hello World" );
+ },
+ testFunction2: function() {
+ print( "Testfunction 2" );
+ }
+ }
+ \endcode
+
+ When we run \c {qbuild test} again we get the following output:
+ \code
+********* Start testing of sys_demo *********
+Config: Using QTest library 4.4.2, Qt 4.4.2
+QDEBUG : sys_demo::initTestCase() Init complete test
+PASS : sys_demo::initTestCase()
+QDEBUG : sys_demo::testFunction1() Init test function
+QDEBUG : sys_demo::testFunction1() Hello World
+QDEBUG : sys_demo::testFunction1() Cleanup test function
+PASS : sys_demo::testFunction1()
+QDEBUG : sys_demo::testFunction2() Init test function
+QDEBUG : sys_demo::testFunction2() Testfunction 2
+QDEBUG : sys_demo::testFunction2() Cleanup test function
+PASS : sys_demo::testFunction2()
+QDEBUG : sys_demo::cleanupTestCase() Cleanup complete test
+PASS : sys_demo::cleanupTestCase()
+Totals: 4 passed, 0 failed, 0 skipped
+********* Finished testing of sys_demo *********
+ \endcode
+
+ \section2 Interacting with the System Under Test
+
+ System tests do not have direct access to the code under test. Instead, the system testrunner connects to the application, and sends and receives information via a communication protocol. This effectively controls access to the tested system, reducing the impact of tests on results and emulating standard user behaviour.
+
+ Suppose we wish to create a simple test which launches an application; we first need to ensure that Qt Extended has finished loading successfully, since we can't be
+ sure of the state of the system we have connected to. This is accomplished by using the \l{QtopiaSystemTest::}{waitForQtopiaStart()} function in
+ \l{QTestLib Manual#creating-a-test}{initTestCase()}:
+
+ \code
+ initTestCase: function()
+ {
+ waitForQtopiaStart();
+ }
+ \endcode
+
+
+ Since \c initTestCase() is called before any test functions are executed, this will pause test execution until it receives confirmation that Qt Extended has started. Now we're ready to start the application:
+
+ \code
+ testFunction1: function()
+ {
+ startApplication( "Contacts" );
+ }
+ \endcode
+
+ The \l{QSystemTest::}{startApplication()} method will attempt to start the specified application (in this case, Contacts). If the specified application cannot be started, \c{testFunction} will generate a test failure and abort the test.
+
+ Once the application has started, we can begin testing. While it is possible to execute as many actions in a test function as desired, the recommendation is to dedicate each test function to a single use case. The test function should then attempt to realistically simulate each step of the use case, and verify that the expected result occurs. For example, assume we need to test creating a new contact; a simple test function could look like this:
+
+ \code
+ creating_a_contact: function()
+ {
+ // Start the application
+ startApplication( "Contacts" );
+
+ // Open the options menu and choose "New contact"
+ select( "New contact", optionsMenu() );
+
+ // Enter some details in the "Name" and "Emails" fields
+ enter( "Frank Grimes", "Name" );
+ enter( "frank@example.com", "Emails" );
+
+ // Select 'Back' from the softkey menu to commit changes
+ select( "Back", softMenu() );
+
+ // We should now be at the contacts list.
+ // Verify that we can select the contact we just created.
+ select( "Frank Grimes" );
+
+ // We should now be viewing the contact.
+ // Move to "Details" tab.
+ select( "Details", tabBar() );
+
+ // Now verify that the details screen contains
+ // the expected details.
+ var text = getText();
+ verify( text.contains("Frank Grimes") );
+ verify( text.contains("frank@example.com") );
+ }
+ \endcode
+
+ This test function will start Contacts, navigate through several screens, input data, and verify that the data was successfully saved as a new contact.
+ It is important to note that this test has not explicitly simulated any key or mouse events (although this can be done). This means that the same test can be used as-is on both a keyboard and touchscreen device. This is possible because the implementation of select() and enter() know how to select items and enter data on both keyboard and touchscreen devices.
+
+ The next chapter gives more detail on how navigation works.
+*/
+
+/*!
+ \page qtuitest-tutorial2.html
+ \previouspage {Chapter 1: Writing a System Test}{Chapter 1}
+ \contentspage {QtUiTest Tutorial}{Contents}
+ \nextpage {Chapter 3: Data Driven Testing}{Chapter 3}
+
+ \title Chapter 2: Input, Output and Widget Navigation
+
+ System tests generally consist of a series of actions and verification that the expected behaviour took place. When testing a Qt Extended application, this usually takes the form of simulating the input of specific text and verifying that the application subsequently displays the correct text. Testing necessarily includes navigating through forms and menus, activating buttons and comboboxes, and similar tasks. QtUiTest makes this very easy by supplying simple yet powerful navigation and input/output methods.
+
+ \section1 Basic Input
+
+ Using QtUitest, it is possible to simulate individual keyclicks, perhaps the most simple form of user interaction that can be simulated.
+
+ \code
+ mytestcase = {
+ mytestfunction: function() {
+ keyClick(Qt.Key_A);
+ keyClick(Qt.Key_B);
+ keyClick(Qt.Key_C);
+ }
+ }
+ \endcode
+
+ In the above example, the calls to \l{QSystemTest::}{keyClick()} simulate a few individual key clicks, exactly as if the user had physically pressed keys on the device.
+
+ However, there are several disadvantages to this approach. Firstly, it is extremely verbose. Secondly, it means that the test will only work on a keypad device. To avoid these problems, the \l{QSystemTest::}{enter()} function is provided:
+
+ \code
+ mytestcase = {
+ mytestfunction: function() {
+ enter("abc");
+ }
+ }
+ \endcode
+
+ On a keypad device, the above example has the same affect as the previous example, but is more concise. However, this test now has the additional advantage that it can work on a touchscreen device, as \l{QSystemTest::}{enter()} knows how to simulate the necessary touchscreen events to input the given text.
+
+ \section1 Input Into Specific Widgets
+
+ In both of the examples above, input would be delivered to whichever widget is currently focused. In practice, what we often wish to do is enter text into a series of widgets displayed to the user.
+
+ For example, consider the following screen for entering the details of a new contact.
+
+ \image fields_example.png
+
+ It would be possible to enter text in each field on this screen by using \c {enter()} and \c{keyClick(Qt.Key_Down)}. However, the test would easily break if the order of fields were changed, or if fields were added or removed, and the test would not work on a touchscreen device.
+
+ To solve this problem, \c {enter()} (and many other functions in QtUiTest) take an optional \i{Query Path} parameter, which specifies which widget to operate on. The most common usage of query paths takes the form "LabelText", which refers to any widget which can receive input and is named or labeled "LabelText".
+
+ Entering text into a few fields on the screen featured above is achieved by the following example:
+
+ \code
+ mytestfunction: function() {
+ enter("Yoyo Corporation", "Company");
+ enter("Yoyo Engineer", "Title");
+ enter("x51 YOYO", "Phone");
+ }
+ \endcode
+
+ In the above example, if any of the specified fields are moved, the test will continue to work as expected. If any of the specified fields are removed, renamed, or no longer visible, the test will fail with a message indicating it cannot find the specified field.
+
+ \section1 Selecting Items from Lists and Menus, and Activating Buttons
+
+ Often, a user will be presented with a list of items or a context menu. QtUiTest provides a simple way to navigate to and select items in any list- or menu-like widget. The \l{QSystemTest::}{select()} function will select an item from a list, combo box, menu or tab widget by looking at the display text for each item. It can also be used to activate a button with the given text.
+
+ \code
+ mytestfunction: function() {
+ // Select "Show contacts" from the options (context) menu.
+ select("Show contacts", optionsMenu());
+
+ // Select "Bob" in the currently shown list.
+ select("Bob");
+
+ // Activate the "Edit" button to edit Bob's details.
+ select("Edit");
+
+ // Fill in the "Gender" field (a combo box) for Bob.
+ select("Male", "Gender");
+ }
+ \endcode
+
+ select() allows a test to be reused by keypad and touchscreen devices. For instance, consider select("Edit") from the above example. On a touchscreen device, this will simply result in a click being simulated at the co-ordinates of the Edit button. On a keypad device, keyclicks will be simulated to navigate to and activate the Edit button.
+
+ \section1 Output
+
+ Built-in Qt and Qt Extended widgets can be queried for their currently displayed text. The \l{QSystemTest::}{getText()} function is the most common way of doing this.
+
+ \code
+ mytestfunction: function() {
+ enter("Yoyo Corporation", "Company");
+ compare( getText("Company"), "Yoyo Corporation" );
+ }
+ \endcode
+
+ The above example simply enters "Yoyo Corporation" into the "Company" field, then verifies that the field actually contains the text "Yoyo Corporation". Note that it is not necessary to explicitly call compare immediately after the enter command: it would have failed if the enter text had failed.
+
+ The next chapter explains how to make use of data driven testing.
+*/
+
+/*!
+ \page qtuitest-tutorial3.html
+ \previouspage {Chapter 2: Input, Output and Widget Navigation}{Chapter 2}
+ \contentspage {QtUiTest Tutorial}{Contents}
+ \nextpage {Chapter 4: Putting It All Together}{Chapter 4}
+
+ \title Chapter 3: Data driven testing
+
+ The first page of this tutorial gave an example of testing creation of a contact:
+
+ \code
+ creating_a_contact: function()
+ {
+ // Start the application
+ startApplication( "Contacts" );
+
+ // Open the options menu and choose "New contact"
+ select( "New contact", optionsMenu() );
+
+ // Enter some details in the "Name" and "Emails" fields
+ enter( "Frank Grimes", "Name" );
+ enter( "frank@example.com", "Emails" );
+
+ // Select 'Back' from the softkey menu to commit changes
+ select( "Back", softMenu() );
+
+ // We should now be at the contacts list.
+ // Verify that we can select the contact we just created.
+ select( "Frank Grimes" );
+
+ // We should now be viewing the contact.
+ // Move to "Details" tab.
+ select( "Details", tabBar() );
+
+ // Now verify that the details screen contains
+ // the expected details.
+ var text = getText();
+ verify( text.contains("Frank Grimes") );
+ verify( text.contains("frank@example.com") );
+ }
+ \endcode
+
+ One problem with this test function is that only one set of values is tested.
+ If we want to test additional values, the best way to do it is with QtUiTest's
+ built-in support for data driven testing.
+
+ We create a new object, named the same as our testfunction with '_data' appended,
+ and we make the object consist of a series of arrays:
+
+ \code
+ creating_a_contact_data: {
+ simple: [ "Frank Grimes", "frank@example.com", "+61 0321 FRANK" ],
+ no_email: [ "Bob Jones", undefined, "+61 0321 BOB" ],
+ with_middlename: [ "Jane Middlename Doe", "jmd@example.com", undefined ]
+ }
+ \endcode
+
+ \c{testcase.creating_a_contact_data} is a table of test data with rows \c{simple}, \c{no_email} and \c{with_middlename}. Each row has 3 columns, and these are passed to the \c{creating_a_contact} test function as the arguments \c{name}, \c{email}, \c{homephone} in the example below:
+
+ \code
+ creating_a_contact: function(name, email, homephone)
+ {
+ // Start the application
+ startApplication( "Contacts" );
+
+ // Open the options menu and choose "New contact"
+ select( "New contact", optionsMenu() );
+
+ // Enter details
+ enter( name, "Name" );
+ enter( email, "Emails" );
+ enter( homephone, "Home Phone" );
+
+ // Select 'Back' from the softkey menu to commit changes
+ select( "Back", softMenu() );
+
+ // We should now be at the contacts list.
+ // Verify that we can select the contact we just created.
+ select( name );
+
+ // We should now be viewing the contact.
+ // Move to "Details" tab.
+ select( "Details", tabBar() );
+
+ // Now verify that the details screen contains
+ // the expected details.
+ var text = getText();
+ if (name != undefined) verify( text.contains(name) );
+ if (email != undefined) verify( text.contains(email) );
+ if (homephone != undefined) verify( text.contains(homephone) );
+ }
+ \endcode
+
+ This test is now much more extensible. New test cases can simply be added as new rows to the testdata table and will automatically be tested without needing to add further logic to the test function.
+*/
+
+/*!
+ \page qtuitest-tutorial4.html
+ \previouspage {Chapter 3: Data Driven Testing}{Chapter 3}
+ \contentspage {QtUiTest Tutorial}{Contents}
+
+ \title Chapter 4: Putting It All Together
+
+ Using the simple building blocks of textual input and output and navigation functions, with the data driven testing approach, a full testcase can be written for creating a new contact. Note that the functions for creating and verifying a contact have been moved out into helper functions; this allows them to be reused for subsequent tests. This is very useful for cases where, for instance, one test's precondition might be that a contact has been successfully created.
+
+ \code
+ testcase = {
+ initTestCase: function() {
+ // Start "Contacts" when the testcase starts.
+ startApplication( "Contacts" );
+ },
+
+ creating_a_contact: function(name, emails, company, jobTitle, businessPhone) {
+ create_contact(name, emails, company, jobTitle, businessPhone);
+ verify_contact(name, emails, company, jobTitle, businessPhone);
+ },
+
+ creating_a_contact_data: {
+ simple: [ "Billy Jones", "billy@example.com", "Hotdog Inc.", "Hotdog Engineer", "12345" ],
+ letters_in_phone: [ "Joan Example", "joan@example.com", "Example Inc.", "Exemplary Engineer", "555 EXA" ],
+ three_names: [ "Jon John Johnson", "jjj@example.com", "Sillynames Inc.", "Dog Walker", "12345" ],
+ no_job: [ "William Doe", "bill@example.net", undefined, undefined, undefined ]
+ }
+ }
+
+ // Create a contact with the given details.
+ function create_contact(name, emails, company, jobTitle, businessPhone) {
+ // Verify that we're on the home screen of the "Contacts" app.
+ waitForTitle( "Contacts" );
+
+ // Select "New contact" from context menu.
+ select( "New contact", optionsMenu() );
+
+ // Navigate to the "Contact" tab.
+ // This is the default tab, but with this code we ensure the
+ // test will work if it becomes no longer the default.
+ select( "Contact", tabBar() );
+
+ // Fill in fields on the "Contact" tab.
+ // enter() returns immediately if we try to enter an undefined
+ // value.
+ enter( name, "Name" );
+ enter( emails, "Emails" );
+
+ // Navigate to the "Business" tab.
+ select( "Business", tabBar() );
+
+ // Fill in fields on the "Business" tab.
+ enter( company, "Company" );
+ enter( jobTitle, "Title" );
+ enter( businessPhone, "Phone" );
+
+ // Press the Back key to commit the new contact
+ select( "Back", softMenu() );
+ }
+
+ // Verify that a contact with the given details exists.
+ function verify_contact(name, emails, company, jobTitle, businessPhone) {
+ // Verify that we're on the contacts list.
+ waitForTitle( "Contacts" );
+
+ // Select the contact with the given name.
+ select( name );
+
+ // Navigate to the "Details" tab and get the displayed text.
+ select( "Details", tabBar() );
+ var details = getText();
+
+ // Now verify that the details contains all of the non-null information
+ // for the contact.
+ if (name != undefined) verify( details.contains(name) );
+ if (emails != undefined) verify( details.contains(emails) );
+ if (company != undefined) verify( details.contains(company) );
+ if (jobTitle != undefined) verify( details.contains(jobTitle) );
+ if (businessPhone != undefined) verify( details.contains(businessPhone) );
+ }
+ \endcode
+
+ The above test has been written to be reasonably permissive; it will succeed as long as the text shown by the contacts application contains all of the information for the created contact, and it does not test things such as the formatting of the given text, and does not test every single field. However, this test is well insulated against minor changes to the tested application GUI.
+
+ QtUiTest allows the tester to decide how strict a test should be. If pixel-perfect accuracy is required for output, a test can be written to test every screen with \l{QSystemTest::}{verifyImage()}. In contrast, a high-level text-based approach as shown above can result in effective tests which remain correct even when significant UI changes occur.
+
+ There are many other methods available for use; for further information, refer to the \l{QSystemTest} documentation.
+ */
+
diff --git a/examples/cppsystemtest/README b/examples/cppsystemtest/README
new file mode 100644
index 0000000..5fbd79f
--- /dev/null
+++ b/examples/cppsystemtest/README
@@ -0,0 +1,8 @@
+This example shows how an external test framework can communicate directly
+with QtUiTest at the C++ level (not via QtScript).
+
+Notes:
+- Certain QtUiTest functionality that is implemented using QtScript will not
+ be available.
+- Ensure the directory containing libqsystemtest.so* is in LD_LIBRARY_PATH
+- The example relies on testapp1 being in the path.
diff --git a/examples/cppsystemtest/cppsystemtest.pro b/examples/cppsystemtest/cppsystemtest.pro
new file mode 100644
index 0000000..bd4aab5
--- /dev/null
+++ b/examples/cppsystemtest/cppsystemtest.pro
@@ -0,0 +1,22 @@
+SOURCES += main.cpp
+TEMPLATE=app
+MOC_DIR=$$OUT_PWD/.moc
+OBJECTS_DIR=$$OUT_PWD/.obj
+VPATH+=$$PWD
+INCLUDEPATH+=$$PWD
+INCLUDEPATH+=$$SRCROOT/libqsystemtest
+INCLUDEPATH+=$$SRCROOT/libqtuitest
+
+TARGET=mysystemtest
+
+win32 {
+ CONFIG(debug,debug|release): LIBS+=-L$$BUILDROOT/libqsystemtest/debug -lqsystemtestd -L$$BUILDROOT/libqtuitest -lqtuitestd
+ CONFIG(release,debug|release):LIBS+=-L$$BUILDROOT/libqsystemtest/release -lqsystemtest -L$$BUILDROOT/libqtuitest -lqtuitest
+}
+
+!win32:!symbian {
+ LIBS += -L$$BUILDROOT/lib -lqsystemtest -lqtuitest
+}
+
+CONFIG+=qtestlib debug
+
diff --git a/examples/cppsystemtest/main.cpp b/examples/cppsystemtest/main.cpp
new file mode 100644
index 0000000..360bdb5
--- /dev/null
+++ b/examples/cppsystemtest/main.cpp
@@ -0,0 +1,25 @@
+#include <QApplication>
+#include <QDebug>
+#include <qsystemtest.h>
+
+class MySystemTest : public QSystemTest
+{
+protected:
+ virtual bool fail(const QString& msg)
+ {
+ qDebug() << msg;
+ return false;
+ }
+};
+
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv, true);
+ MySystemTest tc;
+
+ tc.startApplication("testapp1");
+ tc.enter("Hello world", "LineEdit1");
+ tc.enter("Goodbye, cruel world", "LineEdit2");
+ tc.prompt("That's all, folks");
+ return 0;
+}
diff --git a/examples/examples.pro b/examples/examples.pro
new file mode 100644
index 0000000..af2d220
--- /dev/null
+++ b/examples/examples.pro
@@ -0,0 +1,2 @@
+TEMPLATE=subdirs
+SUBDIRS+=cppsystemtest
diff --git a/features/systemtest.prf b/features/systemtest.prf
new file mode 100644
index 0000000..824f393
--- /dev/null
+++ b/features/systemtest.prf
@@ -0,0 +1,53 @@
+SRCDIR=$$replace(OUT_PWD, $$BUILDROOT, $$SRCROOT)
+BUILDDIR=$$OUT_PWD
+
+TEMPLATE=subdirs
+
+unix:!mac:!symbian {
+ symlink.commands = \
+ if [ ! -h $$BUILDDIR/$$SOURCES -a $$BUILDDIR/$$SOURCES != $$SRCDIR/$$SOURCES ]; then \
+ ln -sf $$SRCDIR/$$SOURCES $$BUILDDIR/$$SOURCES; \
+ fi
+ QMAKE_EXTRA_TARGETS+=symlink
+
+ testapp_symlink.commands = \
+ for app in $$TESTAPPS; do \
+ APPPATH=$$BUILDROOT/tests/qtuitest/testapps/\$\$app; \
+ [ -d \$\$APPPATH ] || continue; \
+ ln -sf \$\$APPPATH/\$\$app $$BUILDDIR/\$\$app; \
+ done
+ QMAKE_EXTRA_TARGETS+=testapp_symlink
+
+ test.commands = QTUITEST_BUILD_PATH=$$BUILDROOT PATH=$$BUILDDIR:\$\$PATH QTUITEST_INCLUDE_PATH=$$SRCROOT/tests/shared:\$\$QTUITEST_INCLUDE_PATH LD_LIBRARY_PATH=$$BUILDROOT/lib:\$\$LD_LIBRARY_PATH $$BUILDROOT/bin/qtuitestrunner $$BUILDDIR/$$SOURCES $(ARGS)
+ test.depends = symlink testapp_symlink
+ QMAKE_EXTRA_TARGETS+=test
+
+ storetest.commands = BUILDROOT=$$BUILDROOT BUILDDIR=$$BUILDDIR SRCROOT=$$SRCROOT $$SRCROOT/scripts/storetest $$BUILDDIR/$$SOURCES $(ARGS)
+ storetest.depends = symlink testapp_symlink
+ QMAKE_EXTRA_TARGETS+=storetest
+}
+
+mac {
+ symlink.commands = ln -sf $$SRCDIR/$$SOURCES $$BUILDDIR/$$SOURCES
+ QMAKE_EXTRA_TARGETS+=symlink
+
+ testapp_symlink.commands = \
+ for app in $$TESTAPPS; do \
+ APPPATH=$$BUILDROOT/tests/qtuitest/testapps/\$\$app; \
+ [ -d \$\$APPPATH ] || continue; \
+ ln -sf \$\$APPPATH/\$\$app $$BUILDDIR/\$\$app; \
+ done
+ QMAKE_EXTRA_TARGETS+=testapp_symlink
+
+ test.commands = PATH=$$BUILDDIR:\$\$PATH QTUITEST_INCLUDE_PATH=$$SRCROOT/tests/shared:\$\$QTUITEST_INCLUDE_PATH DYLD_LIBRARY_PATH=$$BUILDROOT/lib:\$\$DYLD_LIBRARY_PATH $$BUILDROOT/bin/qtuitestrunner $$BUILDDIR/$$SOURCES $(ARGS)
+ test.depends = symlink testapp_symlink
+ QMAKE_EXTRA_TARGETS+=test
+}
+
+win32 {
+ WIN_SRCDIR=$$replace(SRCDIR,/,\)
+ WIN_INSTALLROOT=$$replace(INSTALLROOT,/,\)
+
+ test.commands=cmd /c set PATH=$${WIN_INSTALLROOT};%PATH% && set QTUITEST_MOUSEPREFERRED=1 && $${WIN_INSTALLROOT}\\qtuitestrunner $${WIN_SRCDIR}\\$${SOURCES}
+ QMAKE_EXTRA_TARGETS+=test
+}
diff --git a/features/unittest.prf b/features/unittest.prf
new file mode 100644
index 0000000..d8fdd0c
--- /dev/null
+++ b/features/unittest.prf
@@ -0,0 +1,86 @@
+SRCDIR=$$replace(OUT_PWD, $$BUILDROOT, $$SRCROOT)
+BUILDDIR=$$OUT_PWD
+
+CONFIG += qt qtestlib console
+INCLUDEPATH += $$SRCROOT/libqtuitest
+INCLUDEPATH += $$SRCROOT/tests
+!win32:LIBS += -L$$BUILDROOT/lib -lqtuitest
+
+mac:CONFIG -= app_bundle
+
+LIBPATHVAR=LD_LIBRARY_PATH
+mac:LIBPATHVAR=DYLD_LIBRARY_PATH
+
+X11_SETUP=
+X11_TEARDOWN=
+unix:!mac:contains(QT,gui) {
+ X11_SETUP= \
+ if ! which Xephyr > /dev/null 2>&1; then \
+ echo Xephyr is not available on this machine, will not run X11 tests. 1>&2; \
+ exit 1; \
+ fi; \
+ XLOG=\$$(mktemp /tmp/maketest_x_log.XXXXXX); \
+ trap \'rm -f \$$XLOG\' EXIT; \
+ Xephyr :322 -screen 1024x900 > \$$XLOG 2>&1 & \
+ export X11_PID=\$$!; \
+ export DISPLAY=:322; \
+ sleep 2; \
+ if ! ps | egrep -q \"^ *\$${X11_PID} \"; then \
+ echo It looks like Xephyr failed to run correctly, log follows. 1>&2; \
+ cat \$$XLOG 1>&2; \
+ exit 1; \
+ fi;
+ X11_TEARDOWN=kill \$${X11_PID} >/dev/null 2>&1;
+}
+
+test.depends = $(QMAKE_TARGET)
+test.path = $$BUILDDIR
+
+unix {
+ test.commands = @\
+ $$X11_SETUP \
+ $$LIBPATHVAR=$$BUILDROOT/lib $$BUILDDIR/$(QMAKE_TARGET) $(ARGS);\
+ ret=\$$?;\
+ $$X11_TEARDOWN \
+ exit \$$ret
+}
+
+win32 {
+ CONFIG(debug,debug|release): LIBS+=-L$$BUILDROOT/libqtuitest -lqtuitestd
+ CONFIG(release,debug|release):LIBS+=-L$$BUILDROOT/libqtuitest -lqtuitest
+ test.commands = @$$BUILDDIR/$$TARGET $(ARGS)
+}
+
+debug_and_release {
+ debug: test.depends += debug
+ release:test.depends += release
+}
+
+QMAKE_EXTRA_TARGETS += test
+
+unix {
+ TESTRESULTS=$$OUT_PWD/testresults
+ XSL=$$SRCROOT/scripts/qtestxml2junitxml.xsl
+
+ junittest.depends = $(QMAKE_TARGET)
+ junittest.path = $$BUILDDIR
+ junittest.commands = @ \
+ if ! which xsltproc 2>/dev/null 1>&2; then echo "xsltproc not found, aborting"; exit 1; fi; \
+ set -e; \
+ rm -rf $$TESTRESULTS; \
+ mkdir -p $$TESTRESULTS; \
+ make -s -j1 test ARGS=\"$(ARGS) -xml > $$TESTRESULTS/testlib.xml\"; \
+ csplit -s -z -f $$TESTRESULTS/testlibsplit $$TESTRESULTS/testlib.xml \'/<?xml/\' \'{*}\'; \
+ rm $$TESTRESULTS/testlib.xml; \
+ i=0; \
+ for file in $$TESTRESULTS/testlibsplit*; do \
+ xsltproc $$XSL \$${file} > $$TESTRESULTS/junit\$${i}.xml; \
+ rm \$${file}; \
+ i=\$$(expr \$$i + 1); \
+ done; \
+ echo "JUnit-compatible test results written to $$TESTRESULTS"
+
+
+ QMAKE_EXTRA_TARGETS += junittest
+}
+
diff --git a/interpreter/DESCRIPTION b/interpreter/DESCRIPTION
new file mode 100644
index 0000000..560c597
--- /dev/null
+++ b/interpreter/DESCRIPTION
@@ -0,0 +1 @@
+Interpreter for QtUitest scripts.
diff --git a/interpreter/builtins.js b/interpreter/builtins.js
new file mode 100644
index 0000000..8759161
--- /dev/null
+++ b/interpreter/builtins.js
@@ -0,0 +1,530 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*
+ "Builtin" functions available to all tests.
+ This file gets evaluated once at the beginning of every test.
+
+ Documentation for these functions should be placed in qsystemtest.cpp.
+
+ Note, if a function exists with the same name in both here and QSystemTest,
+ the QtScript version takes precedence. To force a call to the QSystemTest
+ function, use ParentTestObject[signature], e.g. see expectMessageBox.
+*/
+
+/* called before every init() */
+function init_global()
+{
+}
+
+/* called after every cleanup() */
+function cleanup_global()
+{
+}
+
+/* called before every initTestCase() */
+function initTestCase_global()
+{
+}
+
+/* called after every cleanupTestCase() */
+function cleanupTestCase_global()
+{
+}
+
+function verify() {
+ if (arguments.length == 0) {
+ fail( "You need to specify at least a boolean expression" );
+ return false;
+ }
+ var msg = "";
+ if (arguments.length > 1) { msg = arguments[1] };
+ return ParentTestObject['verify(bool,QString)'](arguments[0],msg);
+}
+
+function print() {
+ var str = "";
+ for (var i = 0; i < arguments.length; ++i) {
+ if (arguments[i] != undefined) str = str + arguments[i];
+ }
+ ParentTestObject['print(QVariant)'](str);
+}
+
+/* Expect conditionFunction to return true after executing code, or fail with message */
+function _expect(conditionFunction, message) {
+ if (message == undefined) {
+ message = "Expected condition did not become true";
+ }
+ this.__defineSetter__("code", function(code){
+ try {
+ code.apply(this);
+ } catch (e) {
+ if (this.onFail != undefined) {
+ this.onFail.apply(this);
+ }
+ throw e;
+ }
+ if (!conditionFunction.call()) {
+ fail(message);
+ }
+ });
+}
+
+function expect(a,b) {
+ return new _expect(a,b);
+}
+
+function select( item, queryPath ) {
+ if (item != undefined) {
+ if (queryPath == undefined) queryPath = "";
+ ParentTestObject['select(QString,QString)'](item, queryPath);
+ }
+ return true;
+}
+
+function selectIndex( idx, queryPath ) {
+ if (idx instanceof Array) {
+ ParentTestObject['selectIndex(QVariantList,QString)'](idx, queryPath);
+ } else {
+ ParentTestObject['selectIndex(QVariantList,QString)']([idx, 0], queryPath);
+ }
+}
+
+function skip(text, mode) {
+ ParentTestObject['skip(QString,QSystemTest::SkipMode)'](text, mode);
+}
+
+/*
+ Wait for code to return true for up to timeout ms, with given number of intervals,
+ and message on failure
+*/
+function _waitFor(timeout, intervals, message) {
+ if (timeout == undefined) {
+ timeout = 10000;
+ }
+ if (intervals == undefined) {
+ intervals = 20;
+ }
+ if (message == undefined) {
+ message = "Waited-for condition did not become true after " + timeout + " milliseconds";
+ }
+ this.__defineSetter__("code", function(code){
+ ok = code.apply(this);
+ i = 0;
+ while (!ok && i < intervals) {
+ wait(timeout/intervals);
+ ok = code.apply(this);
+ i = i + 1;
+ }
+ if (!ok) {
+ fail(message);
+ }
+ });
+}
+function waitFor(a,b,c) {
+ return new _waitFor(a,b,c);
+}
+
+Array.prototype.isEmpty = function()
+{
+ return (this.length <= 0);
+}
+
+Array.prototype.contains = function()
+{
+ obj = arguments[0];
+ for (var i=0; i<this.length; i++) {
+ if (this[i] == obj) {
+ return true;
+ }
+ }
+ return false;
+}
+
+// Ensure we don't get the 'contains' function when using for-in on arrays
+setFlags(Array.prototype, "contains", QScriptValue.SkipInEnumeration);
+
+Array.prototype.containsOne = function()
+{
+ obj = arguments[0];
+ var count = 0;
+ for (var i=0; i<this.length; i++) {
+ if (this[i] == obj) {
+ count++;
+ }
+ }
+ return count == 1;
+}
+// Ensure we don't get the 'containsOne' function when using for-in on arrays
+setFlags(Array.prototype, "containsOne", QScriptValue.SkipInEnumeration);
+
+String.prototype.contains = function()
+{
+ var obj = arguments[0];
+ if (arguments[1] != undefined) {
+ obj = arguments[1];
+ }
+ if (obj instanceof Date) {
+ var strs = [];
+ strs.push(obj.toString("ddd, M/d/yy"));
+ strs.push(obj.toString("dddd, MMMM d, yyyy"));
+ strs.push(obj.toString("ddd, d MMM"));
+ strs.push(obj.toString("dd/MM/yyyy"));
+ for (var i = 0; i < strs.length; ++i) {
+ if (this.toString().contains(strs[i])) return true;
+ }
+ return false;
+ } else if (obj instanceof RegExp) {
+ return obj.test(this.toString());
+ } else {
+ var ref = this.toString();
+ return (-1 != ref.indexOf(obj));
+ }
+}
+
+String.prototype.toDate = function()
+{
+ var obj = this.toString();
+ return toDate(obj);
+}
+
+String.prototype.startsWith = function()
+{
+ var obj = arguments[0];
+ var ref = this.toString();
+ return ref.indexOf( obj ) == 0;
+}
+
+String.prototype.left = function()
+{
+ var start = 0;
+ var end = arguments[0];
+ var ref = this.toString();
+ return ref.slice( start, end );
+}
+
+String.prototype.right = function()
+{
+ var ref = this.toString();
+ var start = ref.length - arguments[0];
+ return ref.slice( start );
+}
+
+String.prototype.mid = function()
+{
+ var start = arguments[0];
+ var end = arguments[1]+1;
+ var ref = this.toString();
+ return ref.slice( start, end );
+}
+
+String.prototype.toValue = function()
+{
+ var ret = 0;
+ var ref = this.toString();
+ for (var i=0; i<ref.length; i++) {
+ var ch = ref.charAt(i);
+ if (ch == '-') {
+ ret = ret * -1;
+ } else {
+ ret = ret * 10;
+ if (ch == '0') {
+ } else if (ch == '1') {
+ ret = ret + 1;
+ } else if (ch == '2') {
+ ret = ret + 2;
+ } else if (ch == '3') {
+ ret = ret + 3;
+ } else if (ch == '4') {
+ ret = ret + 4;
+ } else if (ch == '5') {
+ ret = ret + 5;
+ } else if (ch == '6') {
+ ret = ret + 6;
+ } else if (ch == '7') {
+ ret = ret + 7;
+ } else if (ch == '8') {
+ ret = ret + 8;
+ } else if (ch == '9') {
+ ret = ret + 9;
+ } else {
+ fail( "ERROR: Couldn't convert '" + ref + "' into a value." );
+ return undefined;
+ }
+ }
+ }
+ return ret;
+}
+
+function anyDefined()
+{
+ for (var i = 0; i < arguments.length; ++i) {
+ if (arguments[i] != undefined) return true;
+ }
+ return false;
+}
+
+function tabBar(index)
+{
+ if (index == undefined) {
+ index = 0;
+ }
+
+ var tabBars = findByProperty( { inherits: "QTabBar" } );
+ if (tabBars[index] == undefined) {
+ fail( "ERROR: Tab widget not found." );
+ return undefined;
+ }
+ return tabBars[index];
+}
+
+function menuBar(index)
+{
+ if (index == undefined) {
+ index = 0;
+ }
+
+ var menuBars = findByProperty( { inherits: "QMenuBar" } );
+ if (menuBars[index] == undefined) {
+ fail( "ERROR: MenuBar widget not found." );
+ return undefined;
+ }
+ return menuBars[index];
+}
+
+// Convert twiki markup to HTML for display in prompts
+function twiki(text) {
+ var lines = text.split("\n");
+ var result = [];
+ var listType = [];
+ var currLevel = 0;
+ var rowNumber = 0;
+ var inListItem = false;
+ var inTable = false;
+ var inVerbatim = false;
+ var liRegExp = /((?: )+)(\*|(?:[1AaIi]).)\s*(.*)/;
+ var liContRegExp = /(?: )\s*(.*)/;
+ var tableRegExp = /\s*\|(\s*)(.*)(\s*)\|\s*$/;
+
+ for (var i=0; i < lines.length; i++) {
+ var line = lines[i];
+
+ // Verbatim
+ if (inVerbatim) {
+ if (line.match(/\<\s*\/\s*verbatim\s*\>/)) {
+ inVerbatim = false;
+ result.push("</pre>");
+ } else {
+ result.push(line);
+ }
+ continue;
+ } else if (line.match(/\<\s*verbatim\s*\>/)) {
+ inVerbatim = true;
+ result.push("<pre>");
+ continue;
+ }
+
+ // Simple replacements
+ // Headings
+ line = line.replace(/---\+(?:!!)? +(.*)/, "<h1>$1</h1>");
+ line = line.replace(/---\+\+(?:!!)? +(.*)/, "<h2>$1</h2>");
+ line = line.replace(/---\+\+\+(?:!!)? +(.*)/, "<h3>$1</h3>");
+ line = line.replace(/---\+\+\+\+(?:!!)? +(.*)/, "<h4>$1</h4>");
+ line = line.replace(/---\+\+\+\+\+(?:!!)? +(.*)/, "<h5>$1</h5>");
+ line = line.replace(/---\+\+\+\+\+\+(?:!!)? +(.*)/, "<h6>$1</h6>");
+
+ // Misc
+ line = line.replace(/---[-]*/g, "<hr />");
+ line = line.replace(/^$/, "<p />");
+ line = line.replace(/!([A-Z]\w*)/g, "$1");
+ line = line.replace(/%TOC%/g, "");
+ line = line.replace(/%BB%/g, "<br />&#8226;");
+
+ // Links and anchors
+ line = line.replace(/^\#([A-Z]\w*)/, "<a name=\"$1\"></a><p />");
+ line = line.replace(/\[\[\#([A-Z]\w*)\]\[(.*)\]\]/g, "<a href=\"#$1\">$2</a>");
+ line = line.replace(/\[\[\#([A-Z]\w*)\]\]/g, "<a href=\"#$1\">#$1</a>");
+
+// line = line.replace(/\[\[(.*?)\]\[(.*?)\]\]/g, "<a href=\"$1\">$2</a>");
+// line = line.replace(/\[\[(.*?)\]\]/g, "<a href=\"$1\">$1</a>");
+ line = line.replace(/\[\[(.*?)\]\[(.*?)\]\]/g, "$2");
+ line = line.replace(/\[\[(.*?)\]\]/g, "$1");
+
+ // Text style
+ line = line.replace(/^\*(\S.*?\S)\*(?!\w)/, "<b>$1</b>");
+ line = line.replace(/([^\w])\*(\S.*?\S)\*(?!\w)/g, "$1<b>$2</b>");
+ line = line.replace(/^__(.*?\S)__(?!\w)/g, "<b><i>$2</i></b>");
+ line = line.replace(/([^\w])__(.*?\S)__(?!\w)/g, "$1<b><i>$2</i></b>");
+ line = line.replace(/^_([^_]*?\S)_(?!\w)/, "<i>$1</i>");
+ line = line.replace(/([^\w])_([^_]*?\S)_(?!\w)/g, "$1<i>$2</i>");
+ line = line.replace(/^==(.*?\S)==(?!\w)/g, "<b><code>$1</code></b>");
+ line = line.replace(/([^\w])==(.*?\S)==(?!\w)/g, "$1<b><code>$2</code></b>");
+ line = line.replace(/^=(.*?\S)=(?!\w)/, "<code>$1</code>");
+ line = line.replace(/([^\w])=(.*?\S)=(?!\w)/g, "$1<code>$2</code>");
+ line = line.replace(/%(.*)%(.*)%ENDCOLOR%/g, "<font color=\"$1\">$2<\/font>");
+
+ // Tables
+ tableMatch = tableRegExp.exec(line);
+ if (tableMatch) {
+ if (inTable) {
+ rowNumber++;
+ if (rowNumber%2) {
+ result.push("</tr>\n<tr bgcolor=\"#f2f2f2\">");
+ } else {
+ result.push("</tr>\n<tr bgcolor=\"#e0e0e0\">");
+ }
+ } else {
+ inTable = true;
+ rowNumber = 0;
+ result.push("<table>\n<tr bgcolor=\"#e0e0e0\">");
+ }
+
+ var cellRegExp = /\|(\s*)(\<b\>)?(.*?)(\<\/b\>)?(\s*)(?=\|)/g;
+ var trLine = "";
+ while (cell = cellRegExp.exec(line)) {
+ var left = cell[1].length;
+ var right = cell[5].length;
+ var align = "left";
+ if (left > 1 && left == right) {
+ align = "center";
+ } else if (left > right) {
+ align = "right";
+ }
+ if (cell[2] && cell[4]) {
+ trLine += "<th bgcolor=\"#404040\"><font color=\"white\">" + cell[3] + "</font></th>";
+ } else {
+ trLine += "<td align=\"" + align + "\">" + cell[3] + "</td>";
+ }
+ }
+ line = trLine;
+ result.push(line);
+ continue;
+ } else {
+ if (inTable) {
+ result.push("</tr></table>");
+ inTable = false;
+ }
+ }
+
+ // List Items
+ liMatch = liRegExp.exec(line);
+ level = (liMatch ? liMatch[1].length/3 : 0);
+ liType = (level ? (liMatch[2] == "*" ? "ul" : "ol") : null);
+
+ // List item continuation
+ if (inListItem) {
+ if (!liMatch) {
+ liContMatch = liContRegExp.exec(line);
+ if (!liContMatch) {
+ inListItem = false;
+ result.push("</li>");
+ } else {
+ line = liContMatch[1];
+ level = currLevel;
+ }
+ } else {
+ inListItem = false;
+ result.push("</li>");
+ }
+ }
+
+ // Change of list indentation level
+ if (level > currLevel) {
+ for (var j = currLevel; j < level; j++) {
+ result.push("<" + liType + (liType == "ol" ? " type=\"" + liMatch[2][0] + "\"" : "") + ">");
+ listType.push(liType);
+ }
+ } else {
+ for (var j = level; j < currLevel; j++) {
+ prevLiType = listType.pop();
+ result.push("</" + prevLiType + ">");
+ }
+ if (liMatch && listType.length && listType[listType.length - 1] != liType) {
+ // Change of list item type (from unordered to ordered, or vice-versa)
+ result.push("</" + listType.pop() + ">");
+ result.push("<" + liType + (liType == "ol" ? " type=\"" + liMatch[2][0] + "\"" : "") + ">");
+ listType.push(liType);
+ }
+ }
+ currLevel = level;
+
+ if (liMatch) {
+ line = line.replace(liRegExp, "<li" + (liType == "ol" ? " type=\"" + liMatch[2][0] + "\"" : "") + ">" + liMatch[3]);
+ inListItem = true;
+ }
+
+ result.push(line);
+ }
+
+ return(result.join("\n"));
+}
+
+// Support object-oriented syntax for widget interaction
+String.prototype.focusWidget = function() { return focusWidget(this); }
+String.prototype.getSelectedText = function() { return getSelectedText(this); }
+String.prototype.getText = function() { return getText(this); }
+String.prototype.getSelectedValue = function() { return getSelectedValue(this); }
+String.prototype.getValue = function() { return getValue(this); }
+String.prototype.getList = function() { return getList(this); }
+String.prototype.getLabels = function() { return getLabels(this); }
+String.prototype.currentTitle = function() { return currentTitle(this); }
+String.prototype.getGeometry = function() { return getGeometry(this); }
+String.prototype.setProperty = function(name, value) { setProperty(this, name, value); }
+String.prototype.getProperty = function(name) { return getProperty(this, name); }
+String.prototype.keyPress = function(key) { keyPress(key, this); }
+String.prototype.keyRelease = function(key) { keyRelease(key, this); }
+String.prototype.keyClick = function(key) { keyClick(key, this); }
+String.prototype.keyClickHold = function(key, duration) { keyClickHold(key, duration, this); }
+String.prototype.mouseClick = function() { mouseClick(this); }
+String.prototype.mouseClickHold = function(duration) { mouseClickHold(this, duration); }
+String.prototype.mousePress = function() { mousePress(this); }
+String.prototype.mouseRelease = function() { mouseRelease(this); }
+String.prototype.enter = function(value, mode) { enter(value, this, mode) }
+String.prototype.select = function(item) { select(item, this); }
+String.prototype.selectIndex = function(idx) { selectIndex(idx, this); }
+String.prototype.activate = function() { activate(this); }
+String.prototype.isVisible = function() { return isVisible(this); }
+String.prototype.isEnabled = function() { return isEnabled(this); }
+String.prototype.isChecked = function() { return isChecked(this); }
+String.prototype.setChecked = function(doCheck) { setChecked(doCheck, this); }
+String.prototype.checkState = function() { return checkState(this); }
+String.prototype.setCheckState = function(state) { setCheckState(state, this); }
+String.prototype.saveScreen = function(name) { saveScreen(name, this); }
diff --git a/interpreter/config.js b/interpreter/config.js
new file mode 100644
index 0000000..8679467
--- /dev/null
+++ b/interpreter/config.js
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/* Internal configuration for QtUiTest. */
+
+/* Preprocessor configuration. */
+preprocess = {
+ /* A list of mappings from function names, to strings which should
+ * be appended after the function. */
+ functionAppends: {}
+}
+
+/* A list of files containing "builtin" functions to be made accessible
+ * to all tests. */
+builtin_files = [ "builtins.js" ];
+
+/* code_setters: a list of special functions which have syntax like:
+ * myFunction(a,b,c) {
+ * some code;
+ * }
+ * This is not valid ecmascript. In reality, the code expands to:
+ * myFunction,a,b,c).code = function() {
+ * some code;
+ * }
+ * Where a setter is defined for property "code" which makes the magic
+ * happen. The functions are implemented in builtins.js.
+ */
+code_setters = [
+ "waitFor",
+ "expect"
+]
+for (var i = 0; i < code_setters.length; ++i)
+ preprocess.functionAppends[code_setters[i]] = ".code = function() ";
+
diff --git a/interpreter/interpreter.pro b/interpreter/interpreter.pro
new file mode 100644
index 0000000..024c53f
--- /dev/null
+++ b/interpreter/interpreter.pro
@@ -0,0 +1,53 @@
+SOURCES +=\
+ main.cpp\
+ qscriptsystemtest.cpp \
+ qtscript_bindings.cpp \
+ scriptpreprocessor.cpp
+
+HEADERS +=\
+ qscriptsystemtest.h\
+ scriptpreprocessor.h\
+ qtscript_bindings.h
+
+RESOURCES += scripts.qrc
+DEFINES += QTUITESTRUNNER_TARGET
+TEMPLATE=app
+VPATH+=$$PWD
+INCLUDEPATH+=$$PWD
+INCLUDEPATH+=$$SRCROOT/libqtuitest
+INCLUDEPATH+=$$SRCROOT/libqsystemtest
+QT+=script network
+CONFIG+=qtestlib
+TARGET=qtuitestrunner
+
+!symbian {
+ MOC_DIR=$$OUT_PWD/.moc
+ OBJECTS_DIR=$$OUT_PWD/.obj
+ DESTDIR=$$BUILDROOT/bin
+}
+
+symbian {
+ TARGET.EPOCALLOWDLLDATA=1
+ TARGET.CAPABILITY += AllFiles ReadDeviceData ReadUserData SwEvent WriteUserData
+ MOC_DIR=$$OUT_PWD/moc
+ OBJECTS_DIR=$$OUT_PWD/obj
+ LIBS += -L$$OUT_PWD -lqsystemtest -lqtuitest
+}
+
+win32 {
+ CONFIG(debug,debug|release): LIBS+=-L$$BUILDROOT/libqsystemtest/debug -lqsystemtestd -L$$BUILDROOT/libqtuitest -lqtuitestd
+ CONFIG(release,debug|release):LIBS+=-L$$BUILDROOT/libqsystemtest/release -lqsystemtest -L$$BUILDROOT/libqtuitest -lqtuitest -L$$BUILDROOT/libqtslave/release -lqtslave
+ target.path=$$INSTALLROOT
+ INSTALLS+=target
+ !equals(QMAKE_CXX, "g++") {
+ DEFINES+=strcasecmp=_stricmp
+ }
+}
+
+!win32:!symbian {
+ LIBS += -L$$BUILDROOT/lib -lqsystemtest -lqtuitest
+}
+
+mac {
+ CONFIG-=app_bundle
+}
diff --git a/interpreter/main.cpp b/interpreter/main.cpp
new file mode 100644
index 0000000..58fda65
--- /dev/null
+++ b/interpreter/main.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qscriptsystemtest.h"
+#ifndef Q_OS_SYMBIAN
+# include <gracefulquit.h>
+#endif
+#include <QApplication>
+
+int main(int argc, char *argv[])
+{
+ bool guiEnabled = true;
+
+ // If in auto mode, don't need a GUI connection.
+ // This allows us to run system tests without an X server running.
+ for (int i = 1; i < argc; ++i) {
+ if (!strcasecmp(argv[i], "-auto")) {
+ guiEnabled = false;
+ }
+ }
+
+ QApplication app(argc, argv, guiEnabled);
+#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
+ GracefulQuit::install(&app);
+#endif
+ QScriptSystemTest tc;
+ return tc.exec(argc, argv);
+}
diff --git a/interpreter/qscriptsystemtest.cpp b/interpreter/qscriptsystemtest.cpp
new file mode 100644
index 0000000..4f36e26
--- /dev/null
+++ b/interpreter/qscriptsystemtest.cpp
@@ -0,0 +1,747 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qscriptsystemtest.h"
+#include "scriptpreprocessor.h"
+
+#include <QScriptEngine>
+#include <QScriptValue>
+#include <QScriptValueIterator>
+#include <QScriptContextInfo>
+
+#include <qtestprotocol_p.h>
+#include <QtTest/QtTest>
+
+#include "qtscript_bindings.h"
+
+Q_DECLARE_METATYPE(QVariant)
+Q_DECLARE_METATYPE(QList<qint64>)
+
+template <typename Tp>
+QScriptValue qScriptValueFromQObject(QScriptEngine *engine, Tp const &qobject)
+{
+ return engine->newQObject(qobject, QScriptEngine::AutoOwnership);
+}
+
+template <typename Tp>
+void qScriptValueToQObject(const QScriptValue &value, Tp &qobject)
+{ qobject = qobject_cast<Tp>(value.toQObject());
+}
+
+template <typename Tp>
+int qScriptRegisterQObjectMetaType(
+ QScriptEngine *engine,
+ const QScriptValue &prototype = QScriptValue(),
+ Tp * /* dummy */ = 0
+ )
+{
+ return qScriptRegisterMetaType<Tp>(engine, qScriptValueFromQObject,
+ qScriptValueToQObject, prototype);
+}
+
+void setupEnums(QScriptEngine *engine) {
+ QScriptValue qsvObject = engine->newObject();
+#define S(val) qsvObject.setProperty(#val, engine->toScriptValue((int)QScriptValue::val));
+ S(PropertySetter);S(ReadOnly);S(Undeletable);S(SkipInEnumeration);
+ S(PropertyGetter);S(QObjectMember);S(KeepExistingFlags);S(UserRange);
+#undef S
+ engine->globalObject().setProperty("QScriptValue", qsvObject );
+}
+
+static QScriptValue dateToString(QScriptContext *ctx, QScriptEngine *eng)
+{
+ QDateTime dt = ctx->thisObject().toDateTime();
+ QString fmt = ctx->argument(0).toString();
+
+ return eng->toScriptValue(dt.toString(fmt));
+}
+
+static QString findIncludeScript(const QString& name)
+{
+ QList<QDir> includeDirs;
+ foreach (QByteArray const& split, qgetenv("QTUITEST_INCLUDE_PATH").split(':')) {
+ if (split.isEmpty()) continue;
+ QDir dir(split);
+ if (dir.exists()) includeDirs << dir;
+ }
+
+ foreach (QDir const& dir, includeDirs) {
+ QString file = dir.canonicalPath() + "/" + name;
+ if (QFile::exists(file)) {
+ return file;
+ }
+ }
+
+ return QString();
+}
+
+// Include a single script into an engine.
+static QScriptValue includeScriptFunction
+ (QScriptEngine *engine, const QString& name)
+{
+ // Find the script, relative to the entry script.
+ QString script;
+ QtScript::getLocation(engine->currentContext(), &script, 0);
+ QString directory = QFileInfo(QFileInfo(script).canonicalFilePath()).dir().canonicalPath();
+ QDir dir(directory);
+ QFileInfo file(dir, name);
+ QString filename = name;
+ if (file.exists()) filename = file.canonicalFilePath();
+
+ // Check if the script has already been loaded.
+ static const char includesProperty[] = "_qtuitest_includes";
+ QStringList included = qscriptvalue_cast<QStringList>(engine->globalObject().property(includesProperty));
+ if (included.contains(filename)) {
+ return QScriptValue();
+ }
+
+ // Try to load the script into memory.
+ QFile scriptFile(filename);
+ if (!scriptFile.exists() || !scriptFile.open(QIODevice::ReadOnly)) {
+ int pos = directory.indexOf("/interpreter");
+ if (pos > 0) {
+ directory = directory.left(pos) + "/tests/shared";
+ QDir dir(directory);
+ QFileInfo file(dir, name);
+ filename = file.filePath();
+ scriptFile.setFileName(filename);
+ } else {
+ scriptFile.setFileName(findIncludeScript(filename));
+ }
+ }
+
+ if (!scriptFile.exists() || (!scriptFile.isOpen() && !scriptFile.open(QIODevice::ReadOnly))) {
+ return engine->currentContext()->throwError("Could not find " + name + " in either the shared or testcase directory");
+ }
+
+ QString contents = QTextStream(&scriptFile).readAll();
+ scriptFile.close();
+
+ contents.prepend("with(ParentTestMetaObject) {");
+ contents.append("\n}");
+
+ ScriptPreprocessor().preprocess(contents);
+
+ // Evaluate the contents of the script.
+ engine->pushContext()->setActivationObject(engine->globalObject());
+ // Note that we have included this script.
+ if (!engine->globalObject().property(includesProperty).isValid()) {
+ engine->globalObject().setProperty(includesProperty, engine->newArray());
+ }
+ engine->globalObject().property(includesProperty).setProperty(
+ engine->globalObject().property(includesProperty).property("length").toUInt32(),
+ qScriptValueFromValue(engine, filename));
+ QScriptValue ret = engine->evaluate(contents, filename);
+ engine->popContext();
+
+ return ret;
+}
+
+// Implementation of the "include()" function in scripts, which imports scripts.
+static QScriptValue includeFunction
+ (QScriptContext *context, QScriptEngine *engine)
+{
+ QScriptValue value;
+ if (context->argumentCount() == 0) {
+ return context->throwError
+ ("script name must be supplied to include()");
+ }
+ value = context->argument(0);
+ if (!value.isString()) {
+ return context->throwError
+ ("invalid script name supplied to include()");
+ }
+
+ QString name = value.toString();
+ if (name.contains(QChar('*'))) {
+ //FIXME: This path doesn't look in the tests/shared/ directory.
+ // Expand the wildcard and include all matching scripts.
+ QString script;
+ QtScript::getLocation(context, &script, 0);
+ QDir dir(QFileInfo(script).dir());
+ QStringList files = dir.entryList(QStringList(name));
+ foreach (QString filename, files) {
+ value = includeScriptFunction(engine, dir.filePath(filename));
+ if (engine->hasUncaughtException())
+ return value;
+ }
+ return engine->undefinedValue();
+ } else {
+ // Include a single script file.
+ return includeScriptFunction(engine, name);
+ }
+}
+
+static QScriptValue setFlags
+ (QScriptContext *context, QScriptEngine* /*engine*/)
+{
+ Q_ASSERT(context);
+ if (context->argumentCount() != 3) {
+ return context->throwError
+ ("setFlags() needs three arguments");
+ }
+ QScriptValue o = context->argument(0);
+ if (!o.isObject()) return QScriptValue();
+ QString name = context->argument(1).toString();
+ int flags = context->argument(2).toInt32();
+
+ o.setProperty(name, o.property(name), QFlag(flags));
+ return QScriptValue();
+}
+
+
+QScriptSystemTest::QScriptSystemTest()
+ : testObject(0),
+ m_checkOnly(false)
+{
+ // Ensure we process events periodically.
+ m_engine.setProcessEventsInterval(100);
+}
+
+QScriptSystemTest::~QScriptSystemTest()
+{
+}
+
+QString QScriptSystemTest::testCaseName() const
+{
+ if (testObject)
+ return testObject->metaObject()->className();
+ return QAbstractTest::testCaseName();
+}
+
+void QScriptSystemTest::loadBuiltins(QScriptEngine &engine)
+{
+ QScriptEngine configEngine;
+ QScriptSystemTest::loadInternalScript("config.js", configEngine);
+ for (int i = 0; i < configEngine.globalObject().property("builtin_files").property("length").toInt32(); ++i) {
+ QString file = configEngine.globalObject().property("builtin_files").property(i).toString();
+ QtScript::addInternalFile( QScriptSystemTest::loadInternalScript(file, engine, true) );
+ }
+}
+
+void QScriptSystemTest::importIntoGlobalNamespace(QScriptEngine& engine, QString const& object)
+{
+ QScriptValue obj = engine.globalObject().property(object);
+
+ QScriptValueIterator it(obj);
+ while (it.hasNext()) {
+ it.next();
+ QString name = it.name();
+
+ // Transform name of enter(QString,QString) to enter
+ if (it.value().isFunction() && name.contains('(')) {
+ name = name.left(name.indexOf('('));
+ }
+
+ // Import this property into the global object iff one doesn't already
+ // exist with this name
+ if (engine.globalObject().property(name).isValid()) continue;
+
+ // For functions, to keep the QObject slot resolution working right, we
+ // must wrap the property instead of simply copying it.
+ if (it.value().isFunction()) {
+ engine.evaluate(QString("%1 = function(){ return %2.%1.apply(this, arguments); };")
+ .arg(name)
+ .arg(object));
+ } else {
+ engine.globalObject().setProperty(name, it.value());
+ }
+ }
+}
+
+QString QScriptSystemTest::loadInternalScript(QString const &name, QScriptEngine &engine, bool withParentObject)
+{
+ QString filename = QFileInfo(QString::fromAscii(__FILE__)).absolutePath() + "/" + name;
+ if (!QFileInfo(filename).exists()) filename = ":/" + name;
+ QFile f(filename);
+ QString data;
+ if (!f.open(QIODevice::ReadOnly) || (data = QTextStream(&f).readAll()).isEmpty()) {
+ qWarning("QtUiTest: Couldn't load config file '%s' (using '%s')", qPrintable(name), qPrintable(filename));
+ return QString();
+ }
+
+ if (withParentObject) {
+ data.prepend("with(ParentTestMetaObject) {");
+ data.append("\n}");
+ }
+
+ QScriptValue e = engine.evaluate(data, filename);
+ if (e.isError()) {
+ QString backtrace = engine.uncaughtExceptionBacktrace().join("\n");
+ qWarning("In QtUiTest config file %s:\n%s\n%s", qPrintable(filename), qPrintable(e.toString()),
+ qPrintable(backtrace));
+ }
+ return filename;
+}
+
+QScriptValue variantToScriptValue(QScriptEngine *engine, const QVariant &v)
+{
+ QScriptValue ret;
+ if (v.isNull()) {
+ ret = QScriptValue( engine, QScriptValue::NullValue );
+ } else if (v.canConvert<QStringList>()) {
+ ret = engine->toScriptValue(v.value<QStringList>());
+ } else if (v.canConvert<qreal>()) {
+ ret = engine->toScriptValue(v.value<qreal>());
+ } else if (v.canConvert<int>()) {
+ ret = engine->toScriptValue(v.value<int>());
+ } else if (v.canConvert<QString>()) {
+ ret = engine->toScriptValue(v.value<QString>());
+ } else {
+ ret = engine->newVariant(v);
+ }
+ return ret;
+}
+
+void variantFromScriptValue(const QScriptValue &obj, QVariant &v)
+{
+ v = obj.toVariant();
+}
+
+QString QScriptSystemTest::currentFile()
+{
+ QString fileName = QString();
+ int lineNumber = 0;
+
+ QtScript::getLocation(m_engine.currentContext(), &fileName, &lineNumber);
+
+ return fileName;
+}
+
+int QScriptSystemTest::currentLine()
+{
+ QString fileName = QString();
+ int lineNumber = 0;
+
+ QtScript::getLocation(m_engine.currentContext(), &fileName, &lineNumber);
+
+ return lineNumber;
+}
+
+void QScriptSystemTest::outputBacktrace()
+{
+ QScriptContext *ctx = m_engine.currentContext();
+ QString bt("Backtrace:");
+ while (ctx) {
+ QScriptContextInfo ctxInfo(ctx);
+ QString fn = ctxInfo.fileName();
+ int ln = ctxInfo.lineNumber();
+ if (!fn.isEmpty() && ln != -1)
+ bt += "\n " + fn + "(" + QString::number(ln) + ")";
+ ctx = ctx->parentContext();
+ }
+ QDebug(QtDebugMsg) << qPrintable(bt);
+}
+
+void QScriptSystemTest::skip(QString const &message, QSystemTest::SkipMode mode)
+{
+ QSystemTest::skip(message, mode);
+ m_engine.evaluate("throw new QTestFailure('QSKIP');");
+}
+
+bool QScriptSystemTest::fail(QString const &message)
+{
+ bool ret = QSystemTest::fail( message );
+ if (!ret) {
+ outputBacktrace();
+ m_engine.evaluate("throw new QTestFailure('QFAIL');");
+ }
+ return ret;
+}
+
+void QScriptSystemTest::verify(bool statement, QString const &message)
+{
+ if (!QTest::qVerify(statement, "<statement>", qPrintable(message), qPrintable(currentFile()), currentLine() )) {
+ outputBacktrace();
+ m_engine.evaluate("throw new QTestFailure('QFAIL');");
+ }
+}
+
+void QScriptSystemTest::compare(const QString &actual, const QString &expected)
+{
+ if (!QTest::qCompare( actual, expected, qPrintable(actual), qPrintable(expected), qPrintable(currentFile()), currentLine() )) {
+ outputBacktrace();
+ m_engine.evaluate("throw new QTestFailure('QFAIL');");
+ }
+}
+
+bool QScriptSystemTest::isFailExpected()
+{
+ return (expect_fail_function == currentTestFunction() && expect_fail_datatag == currentDataTag());
+}
+
+void QScriptSystemTest::expectFail( const QString &reason )
+{
+ expect_fail_function = currentTestFunction();
+ expect_fail_datatag = currentDataTag();
+ expect_fail_reason = reason;
+ int line = currentLine();
+
+ if (testObject) {
+ testObject->setProperty("expectFailLineNumber", line);
+ }
+
+ bool ok = QTest::qExpectFail(currentDataTag().toLatin1(), reason.toLatin1(),
+ QTest::TestFailMode(1),//mode),
+ qPrintable(currentFile()), line);
+ if (!ok)
+ m_engine.evaluate("throw new QTestFailure('QFAIL');");
+}
+
+bool QScriptSystemTest::setQueryError( const QTestMessage &message )
+{
+ QString errorString = message["status"].toString();
+ QVariant response = message["_q_inResponseTo"];
+ if (response.isValid()) {
+ errorString += QString("\nIn response to message: %2").arg(response.toString());
+ }
+ return setQueryError( errorString );
+}
+
+bool QScriptSystemTest::setQueryError( const QString &errString )
+{
+ if (queryFailed()) return false;
+ QSystemTest::setQueryError(errString);
+ bool ret = fail(errString);
+ if (!ret) {
+ m_engine.evaluate("throw new QTestFailure('QFAIL');");
+ }
+ return ret;
+}
+
+int QScriptSystemTest::runTest(int argc, char *argv[])
+{
+ if (argc > 1) filename = argv[1];
+
+ if (filename.isEmpty()) qFatal("No test script specified.");
+
+ /* Consume the first argument */
+ argv[1] = argv[0];
+ char **c_argv = &argv[1];
+ int c_argc = argc-1;
+
+ {
+ QFileInfo fi(filename);
+ if (!fi.exists()) qFatal("%s doesn't exist", qPrintable(filename));
+ filename = fi.absoluteFilePath();
+ }
+
+ QFile file(filename);
+ if (!file.open(QFile::ReadOnly)) qFatal("Can't open %s", qPrintable(filename));
+ QTextStream stream(&file);
+ QString script = stream.readAll();
+
+ ScriptPreprocessor().preprocess(script);
+
+ setupEnums(&m_engine);
+
+ // include() imports scripts directly into the parent script.
+ m_engine.globalObject().setProperty
+ ("include", m_engine.newFunction(includeFunction, 1));
+ m_engine.globalObject().setProperty
+ ("setFlags", m_engine.newFunction(setFlags, 3));
+
+
+ m_engine.globalObject().setProperty("_dateToString", m_engine.newFunction(dateToString));
+ m_engine.evaluate("_old_date_toString = Date.prototype.toString;"
+ "Date.prototype.toString = function() {"
+ " if (arguments[0] == undefined)"
+ " return _old_date_toString.apply(this, arguments);"
+ " return _dateToString.apply(this, arguments);"
+ "}");
+
+ m_engine.globalObject().setProperty("ParentTestObject", m_engine.newQObject(this));
+ m_engine.globalObject().setProperty("ParentTestMetaObject", m_engine.newQMetaObject(metaObject()));
+
+ loadBuiltins(m_engine);
+ importIntoGlobalNamespace(m_engine, "ParentTestObject");
+
+ // Allow shebangs without giving syntax errors.
+ if (script.startsWith("#!")) script.prepend("//");
+ script.prepend("with(ParentTestMetaObject){");
+ script.append("\n}");
+
+ QtScriptTest tc(filename, script, &m_engine);
+ testObject = &tc;
+
+ qScriptRegisterMetaType(&m_engine, variantToScriptValue, variantFromScriptValue);
+ qScriptRegisterSequenceMetaType<QList<qint64> >(&m_engine);
+
+ // Only set up the test data path if not explicitly set by user
+ if (!QCoreApplication::arguments().contains("-data")) {
+ setupTestDataPath(qPrintable(filename));
+ }
+
+ enableQueryWarnings(false);
+
+ // If we get here, the syntax of the script is definitely OK
+ // (a syntax error causes a qFatal in the QtScriptTest ctor).
+ if (m_checkOnly)
+ return 0;
+
+ int retval = QTest::qExec(&tc, c_argc, c_argv);
+
+ testObject = 0;
+
+ // After a full test run, QTestLib sometimes returns 0 or sometimes returns
+ // the number of test failures, depending on how it was compiled. In both
+ // cases, a negative number denotes an error.
+ // We don't want test failures to affect the exit code.
+ return (retval < 0) ? retval : 0;
+}
+
+/*!
+ \internal
+ Send a raw message from within script to the connected system.
+
+ This can be used to extend the API for new messages on the target device
+ without modifying QSystemTest.
+
+ If the message doesn't elicit a response of "OK", the current test fails.
+*/
+QVariantMap QScriptSystemTest::sendRaw(const QString& event, const QScriptValue& object)
+{
+ QVariantMap ret;
+ if (object.isValid() && !object.isObject()) {
+ setQueryError("Second argument to sendRaw must be an object.");
+ return ret;
+ }
+ if (event.isEmpty()) {
+ setQueryError("First argument to sendRaw cannot be an empty string.");
+ return ret;
+ }
+
+ QTestMessage message(event);
+
+ // Treat object like a variant map and load it into message.
+ QScriptValueIterator it(object);
+ while (it.hasNext()) {
+ it.next();
+ QScriptValue v = it.value();
+ // Map must be flat; we don't handle objects within objects.
+ if (v.isObject() && !v.isArray()) {
+ setQueryError("Object passed to sendRaw must not have any child objects.");
+ return ret;
+ }
+ // toVariant appears to flatten stringlists into strings, which we don't want.
+ if (v.isArray()) {
+ QVariantList list;
+ for (int i = 0, max = qscriptvalue_cast<int>(v.property("length")); i < max; ++i)
+ list << v.property(i).toVariant();
+ message[it.name()] = list;
+ } else {
+ message[it.name()] = v.toVariant();
+ }
+ }
+
+ QTestMessage reply;
+ if (!doQuery(message, QString(), &reply)) {
+ setQueryError("Raw " + event + " message failed: " + reply["status"].toString());
+ return ret;
+ }
+
+ foreach (QString const& key, reply.keys())
+ ret[key] = reply[key];
+ return ret;
+}
+
+/*!
+ \internal
+ Print any special usage information which should be shown when test is launched
+ with -help.
+*/
+void QScriptSystemTest::printUsage(int argc, char *argv[]) const
+{
+ QSystemTest::printUsage(argc, argv);
+ qWarning(
+ " Script options:\n"
+ " -c : Check the syntax of the test only. Returns a non-zero exit code if the test\n"
+ " contains any syntax errors.\n"
+ );
+}
+
+/*!
+ \internal
+ If \a func is a function, install it as a handler for all messages received from the test
+ system.
+
+ Whenever a new message is received, \a func will be called with two arguments.
+ The first is the message event as a string.
+ The second is an object containing one property for each parameter of the message.
+
+ If \a func returns true, processing of the message ends.
+*/
+void QScriptSystemTest::installMessageHandler(const QScriptValue& func)
+{
+ if (!func.isFunction()) {
+ setQueryError("Argument to installMessageHandler must be a function.");
+ return;
+ }
+ m_messageHandlers << func;
+}
+
+
+QString qDumpScriptValue(QString const& name, QScriptValue const& v, int indent = 0)
+{
+ const QString spc = QString().fill(' ', indent);
+
+ QString ret;
+
+ ret += spc + name + ": ";
+ if (name != "global" && v.engine()->globalObject().strictlyEquals(v))
+ ret += "global";
+ else if (v.isBoolean())
+ ret += "Boolean:" + v.toString();
+ else if (v.isDate())
+ ret += "Date:" + v.toString();
+ else if (v.isFunction())
+ ret += "Function";
+ else if (v.isNull())
+ ret += "null";
+ else if (v.isNumber())
+ ret += "Number:" + v.toString();
+ else if (v.isString())
+ ret += "String:" + v.toString();
+ else if (v.isUndefined())
+ ret += "undef";
+ else {
+ QString inner;
+ QScriptValueIterator it(v);
+ QString sep;
+ while (it.hasNext()) {
+ it.next();
+ inner += sep + qDumpScriptValue(it.name(), it.value(), indent+2);
+ sep = ",\n";
+ }
+ if (inner.isEmpty()) {
+ ret += "{}";
+ } else {
+ ret += "{\n" + inner + "\n" + spc + "} /* " + name + " */";
+ }
+ }
+
+ return ret;
+}
+
+/*!
+ \internal
+ Write out most of the state of the script engine to stderr.
+*/
+void QScriptSystemTest::dumpEngine()
+{
+ QString state;
+
+ {
+ QScriptContext* ctx = m_engine.currentContext();
+ state += "context: {";
+ int i = 0;
+ QString sep;
+ while (ctx) {
+ state += QString("%1\n %2: {\n").arg(sep).arg(i++);
+ state += " toString: " + ctx->toString() + "\n";
+ state += qDumpScriptValue("activationObject", ctx->activationObject(), 4) + ",\n";
+ state += qDumpScriptValue("thisObject", ctx->thisObject(), 4) + "\n";
+ state += " }";
+ sep = ",";
+ ctx = ctx->parentContext();
+ }
+ state += "\n};\n";
+ }
+
+ state += qDumpScriptValue("global", m_engine.globalObject());
+ state += ";";
+
+ fprintf(stderr, "%s\n", qPrintable(state));
+}
+
+/*!
+ \internal
+ Passes the test message through any installed QtScript message handlers.
+ If none of them handle the message, it will be passed to the superclass.
+*/
+void QScriptSystemTest::processMessage(const QTestMessage& message)
+{
+ if (m_messageHandlers.count()) {
+ QVariantMap map;
+ foreach (QString const& key, message.keys())
+ map[key] = message[key];
+
+ QScriptValueList args;
+ args << m_engine.toScriptValue(message.event());
+ args << m_engine.toScriptValue(map);
+
+ for (int i = 0; i < m_messageHandlers.count(); ++i) {
+ QScriptValue out = m_messageHandlers[i].call(QScriptValue(), args);
+ if (out.isBoolean() && out.toBoolean())
+ return;
+ }
+ }
+
+ QSystemTest::processMessage(message);
+}
+
+/*!
+ \internal
+ Processes the command line parameters.
+*/
+void QScriptSystemTest::processCommandLine( int &argc, char *argv[] )
+{
+ int offset = 0;
+
+ for (int i=1; i<argc; ++i) {
+
+ if ( !strcasecmp(argv[i], "-c") ) {
+ argv[i] = 0;
+ offset++;
+ m_checkOnly = true;
+
+ } else {
+ if (offset > 0) {
+ argv[i-offset] = argv[i];
+ argv[i] = 0;
+ }
+ }
+ }
+ argc-=offset;
+
+ QSystemTest::processCommandLine(argc, argv);
+}
+
diff --git a/interpreter/qscriptsystemtest.h b/interpreter/qscriptsystemtest.h
new file mode 100644
index 0000000..7669c30
--- /dev/null
+++ b/interpreter/qscriptsystemtest.h
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSCRIPTSYSTEMTEST_H
+#define QSCRIPTSYSTEMTEST_H
+
+#include <qsystemtest.h>
+#include <QScriptEngine>
+#include <QVariantMap>
+
+class QTestMessage;
+
+class QTUITESTRUNNER_EXPORT QScriptSystemTest
+ : public QSystemTest
+{
+Q_OBJECT
+public:
+ QScriptSystemTest();
+ virtual ~QScriptSystemTest();
+
+ static QString loadInternalScript(QString const &name, QScriptEngine &engine, bool withParentObject = false);
+ static void loadBuiltins(QScriptEngine &engine);
+ static void importIntoGlobalNamespace(QScriptEngine&, QString const&);
+
+ virtual QString testCaseName() const;
+
+public slots:
+ virtual bool fail(QString const &message);
+ virtual void expectFail( const QString &reason );
+ virtual void skip(QString const &message, QSystemTest::SkipMode mode = QSystemTest::SkipSingle);
+ virtual void verify(bool statement, QString const &message = QString());
+ virtual void compare(const QString &actual, const QString &expected);
+
+ QVariantMap sendRaw(const QString&, const QScriptValue& = QScriptValue());
+ void installMessageHandler(const QScriptValue&);
+
+ void dumpEngine();
+
+protected:
+ virtual QString currentFile();
+ virtual int currentLine();
+ virtual void outputBacktrace();
+
+ virtual bool setQueryError( const QTestMessage &message );
+ virtual bool setQueryError( const QString &errString );
+
+ virtual int runTest(int argc, char *argv[]);
+
+ virtual bool isFailExpected();
+
+ virtual void processCommandLine(int&, char*[]);
+ virtual void printUsage(int,char*[]) const;
+
+ virtual void processMessage(const QTestMessage& message);
+
+
+private:
+ QString filename;
+ QScriptEngine m_engine;
+ QList<QScriptValue> m_messageHandlers;
+ QObject* testObject;
+ QString expect_fail_function;
+ QString expect_fail_datatag;
+ QString expect_fail_reason;
+ bool m_checkOnly;
+};
+
+#endif
diff --git a/interpreter/qtscript_bindings.cpp b/interpreter/qtscript_bindings.cpp
new file mode 100644
index 0000000..7d812e1
--- /dev/null
+++ b/interpreter/qtscript_bindings.cpp
@@ -0,0 +1,310 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+
+#include "qscriptengine.h"
+#include "qscriptvalue.h"
+#include "qscriptvalueiterator.h"
+#include "qscriptcontext.h"
+#include "qscriptcontextinfo.h"
+
+#include "qtscript_bindings.h"
+//#include "qtscript_qtcore.h"
+
+QStringList builtinFiles;
+
+void QtScript::addInternalFile(QString const &filename)
+{
+ builtinFiles << filename;
+}
+
+static QString readFile(const QString &filename)
+{
+ QFile file(filename);
+ if (!file.open(QFile::ReadOnly))
+ return QString();
+ QTextStream stream(&file);
+ return stream.readAll();
+}
+
+static void appendCString(QVector<char> *v, const char *s)
+{
+ char c;
+ do {
+ c = *(s++);
+ *v << c;
+ } while (c != '\0');
+}
+
+void QtScript::getLocation(QScriptContext *ctx, QString *fileName, int *lineNumber)
+{
+ Q_ASSERT(ctx);
+ if (fileName) *fileName = QString();
+ if (lineNumber) *lineNumber = 0;
+
+ while (ctx) {
+ QScriptContextInfo ctxInfo(ctx);
+ QString fn = ctxInfo.fileName();
+ if (!fn.isEmpty() && !builtinFiles.contains(fn)) {
+ if (fileName) *fileName = fn;
+ if (lineNumber) *lineNumber = ctxInfo.lineNumber();
+ return;
+ }
+ ctx = ctx->parentContext();
+ }
+}
+
+QMetaObject QtScriptTest::staticMetaObject;
+
+Q_GLOBAL_STATIC(QVector<uint>, qt_meta_data_QtScriptTest)
+Q_GLOBAL_STATIC(QVector<char>, qt_meta_stringdata_QtScriptTest)
+
+const QMetaObject *QtScriptTest::metaObject() const
+{
+ return &staticMetaObject;
+}
+
+void *QtScriptTest::qt_metacast(const char *_clname)
+{
+ if (!_clname) return 0;
+ if (!strcmp(_clname, qt_meta_stringdata_QtScriptTest()->constData()))
+ return static_cast<void*>(const_cast<QtScriptTest*>(this));
+ return QObject::qt_metacast(_clname);
+}
+
+int QtScriptTest::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+{
+ _id = QObject::qt_metacall(_c, _id, _a);
+ if (_id < 0)
+ return _id;
+ if (_c == QMetaObject::InvokeMetaMethod) {
+ const QMetaObject *mo = metaObject();
+ QMetaMethod method = mo->method(mo->methodOffset() + _id);
+ QByteArray sig = method.signature();
+ QString name = sig.left(sig.lastIndexOf('('));
+ QScriptValue testcase = m_engine->globalObject().property("testcase");
+ QScriptValue val = testcase.property(name);
+ if (name.endsWith("_data")) {
+ QTest::addColumn<int>("dummy");
+ QScriptValueIterator it(val);
+ while (it.hasNext()) {
+ it.next();
+ QString tag = it.name();
+ QTest::newRow(tag.toLatin1());
+ }
+ } else {
+ QScriptValue args;
+ QScriptValue data = testcase.property(name + "_data");
+ if (data.isObject()) {
+ QString tag = QTest::currentDataTag();
+ QScriptValue v = data.property(tag);
+ if (v.isValid()) {
+ if (v.isArray()) {
+ args = v;
+ } else {
+ args = m_engine->newArray();
+ args.setProperty(0, v);
+ }
+ }
+ }
+ if (!args.isArray())
+ args = m_engine->newArray();
+ QScriptValue ret;
+ if (name == "init") {
+ ret = m_engine->evaluate("init_global();");
+ }
+ else if (name == "initTestCase") {
+ ret = m_engine->evaluate("initTestCase_global();");
+ }
+ else if (name != "cleanup" && name != "cleanupTestCase") {
+ m_engine->evaluate("qtuitest_pre_test_function();");
+ }
+ if (!ret.isError() || ret.property("name").toString() == "QTestFailure") {
+ ret = val.call(m_engine->globalObject(), args);
+ QTest::compare_helper( true, "expectFail() not followed by a test statement",
+ m_testFilePath.toAscii(), property("expectFailLineNumber").toInt() );
+ }
+ if (name != "init" && name != "initTestCase" && name != "cleanup" && name != "cleanupTestCase") {
+ m_engine->evaluate("qtuitest_post_test_function();");
+ }
+ if (name == "cleanup") {
+ m_engine->evaluate("cleanup_global();");
+ }
+ else if (name == "cleanupTestCase") {
+ m_engine->evaluate("cleanupTestCase_global();");
+ }
+ if (ret.isError() && (ret.property("name").toString() != "QTestFailure")) {
+ QString backtrace = m_engine->uncaughtExceptionBacktrace().join("\n");
+ QString message = ret.toString()
+ // xxx makes the failure message look cluttered; correct fix
+ // xxx is to implement proper generic saving of backtrace info
+ // xxx in test results
+ // + "\n" + backtrace
+ ;
+ QString fileName = "unknown";
+ int lineNumber = -1;
+ QRegExp locationRe("@([^:]+):([0-9]+)");
+ if (-1 != locationRe.indexIn(backtrace)) {
+ fileName = locationRe.cap(1);
+ lineNumber = locationRe.cap(2).toInt();
+ }
+ QTest::qFail(qPrintable(message), qPrintable(fileName), lineNumber);
+ }
+ }
+
+ _id = -1;
+ }
+ return _id;
+}
+
+QtScriptTest::QtScriptTest(QString const &testFilePath, QString const &scriptData, QScriptEngine *engine)
+ : QObject(), m_testFilePath(testFilePath), m_engine(engine)
+{
+ if (m_testFilePath.isEmpty())
+ m_testFilePath = qgetenv("Q_TEST_FILE");
+ if (m_testFilePath.isEmpty())
+ m_testFilePath="testcase.js";
+
+ if (!m_engine) m_engine = new QScriptEngine(this);
+ QDir dir(QApplication::applicationDirPath());
+ dir.cdUp();
+ if (!dir.cd("qtbindings/plugins")) {
+ fprintf(stderr, "plugins folder does not exist -- did you build the bindings?\n");
+ }
+ QApplication::addLibraryPath(dir.absolutePath());
+ m_engine->importExtension("qt.core");
+
+
+ QScriptValue qtestObject = m_engine->newObject();
+ qtestObject.setProperty("SkipSingle", QScriptValue(m_engine, QTest::SkipSingle));
+ qtestObject.setProperty("SkipAll", QScriptValue(m_engine, QTest::SkipAll));
+ qtestObject.setProperty("Abort", QScriptValue(m_engine, QTest::Abort));
+ qtestObject.setProperty("Continue", QScriptValue(m_engine, QTest::Continue));
+ m_engine->globalObject().setProperty("QTest", qtestObject);
+
+ m_engine->evaluate("function QTestFailure() { Error.apply(this, arguments); }"
+ "QTestFailure.prototype = new Error();"
+ "QTestFailure.prototype.name = 'QTestFailure';");
+
+ QStringList slotNames;
+ QString script = scriptData;
+ if (script.isEmpty()) script = readFile(m_testFilePath);
+ if (!script.isEmpty()) {
+ QScriptSyntaxCheckResult synChk = m_engine->checkSyntax(script);
+ if (synChk.state() != QScriptSyntaxCheckResult::Valid) {
+ qFatal("SyntaxError: %s at %s:%d", qPrintable(synChk.errorMessage()),
+ qPrintable(m_testFilePath), synChk.errorLineNumber());
+ }
+
+ QScriptValue ret = m_engine->evaluate(script, m_testFilePath);
+ QString error;
+ if (m_engine->hasUncaughtException()) {
+ error = m_engine->uncaughtException().toString();
+ } else if (ret.isError()) {
+ error = ret.toString();
+ }
+ if (!error.isEmpty()) {
+ QString backtrace = m_engine->uncaughtExceptionBacktrace().join("\n");
+ qFatal("%s\n%s", qPrintable(error),
+ qPrintable(backtrace));
+ }
+ QScriptValue testcase = m_engine->globalObject().property("testcase");
+ QScriptValueIterator it(testcase);
+ while (it.hasNext()) {
+ it.next();
+ QScriptValue val = it.value();
+ if (val.isFunction() || (val.isObject() && it.name().endsWith("_data")))
+ slotNames << it.name();
+ }
+
+ QStringList requiredSlots;
+ requiredSlots
+ << "init"
+ << "cleanup"
+ << "initTestCase"
+ << "cleanupTestCase";
+
+ foreach (QString required, requiredSlots) {
+ if (!slotNames.contains(required)) {
+ m_engine->evaluate("testcase." + required + " = function() {}");
+ slotNames << required;
+ }
+ }
+ } else {
+ qWarning("*** Failed to read testcase!");
+ }
+
+ QVector<uint> *data = qt_meta_data_QtScriptTest();
+ // content:
+ *data << 1 // revision
+ << 0 // classname
+ << 0 << 0 // classinfo
+ << slotNames.count() << 10 // methods
+ << 0 << 0 // properties
+ << 0 << 0 // enums/sets
+ ;
+
+ QString testcaseName = QFileInfo(m_testFilePath).baseName();
+
+ QVector<char> *stringdata = qt_meta_stringdata_QtScriptTest();
+ appendCString(stringdata, testcaseName.toLocal8Bit() );
+ int namelen = stringdata->size();
+ appendCString(stringdata, "");
+
+ // slots: signature, parameters, type, tag, flags
+ foreach (QString slotName, slotNames) {
+ QString slot = slotName + QLatin1String("()");
+ *data << stringdata->size() << namelen << namelen << namelen << 0x08;
+ appendCString(stringdata, slot.toLatin1());
+ }
+ *data << 0; // eod
+
+ // initialize staticMetaObject
+ staticMetaObject.d.superdata = &QObject::staticMetaObject;
+ staticMetaObject.d.stringdata = stringdata->constData();
+ staticMetaObject.d.data = data->constData();
+ staticMetaObject.d.extradata = 0;
+}
+
+QtScriptTest::~QtScriptTest()
+{
+}
diff --git a/interpreter/qtscript_bindings.h b/interpreter/qtscript_bindings.h
new file mode 100644
index 0000000..0df2a64
--- /dev/null
+++ b/interpreter/qtscript_bindings.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTSCRIPT_BINDINGS_H
+#define QTSCRIPT_BINDINGS_H
+
+namespace QtScript {
+ void getLocation(QScriptContext*,QString*,int*);
+ void addInternalFile(QString const&);
+};
+
+class QtScriptTest : public QObject
+{
+
+public:
+ QtScriptTest(QString const &testFilePath = QString(), QString const &scriptData = QString(), QScriptEngine *engine = 0);
+ virtual ~QtScriptTest();
+
+ static QMetaObject staticMetaObject;
+ virtual const QMetaObject *metaObject() const;
+ virtual void *qt_metacast(const char *);
+ virtual int qt_metacall(QMetaObject::Call, int, void **argv);
+
+ QString testFilePath() const { return m_testFilePath; }
+
+ QScriptEngine* engine() { return m_engine; }
+
+private:
+ QString m_testFilePath;
+ QScriptEngine* m_engine;
+};
+
+#endif
+
diff --git a/interpreter/scriptpreprocessor.cpp b/interpreter/scriptpreprocessor.cpp
new file mode 100644
index 0000000..d89f176
--- /dev/null
+++ b/interpreter/scriptpreprocessor.cpp
@@ -0,0 +1,256 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "scriptpreprocessor.h"
+#include "qscriptsystemtest.h"
+
+#include <QScriptEngine>
+#include <QScriptValue>
+#include <QScriptValueIterator>
+#include <QByteArray>
+
+ScriptPreprocessor::ScriptPreprocessor()
+{
+ QScriptEngine engine;
+ QScriptSystemTest::loadInternalScript("config.js", engine);
+
+ QScriptValue settings = engine.globalObject().property("preprocess");
+ if (!settings.isObject()) return;
+
+ /* The documentation for the following settings objects is in config.js */
+
+ {
+ QScriptValueIterator it(settings.property("functionAppends"));
+ while (it.hasNext()) {
+ it.next();
+ functionAppends[it.name()] = it.value().toString();
+ }
+ }
+}
+
+void ScriptPreprocessor::preprocess(QString &script)
+{
+ QString out;
+ out.reserve(script.size());
+
+ bool in_singleline_comment = false;
+ bool in_multiline_comment = false;
+ bool in_singlequote_literal = false;
+ bool in_doublequote_literal = false;
+
+ const char singlequote = '\'';
+ const char doublequote = '"';
+ const char brace_open = '(';
+ const char brace_close = ')';
+ const char curlybrace_open = '{';
+ const char curlybrace_close = '}';
+ const char newline = '\n';
+ const char cr = '\r';
+ const char backslash = '\\';
+ const char forwardslash = '/';
+ const char asterisk = '*';
+
+ QString identifier_chars = "_";
+ for (char c = '0'; c <= '9'; ++c) identifier_chars.append(c);
+ for (char c = 'a'; c <= 'z'; ++c) identifier_chars.append(c);
+ for (char c = 'A'; c <= 'Z'; ++c) identifier_chars.append(c);
+
+ int braces = 0;
+ int curlybraces = 0;
+
+ QString function_append;
+ int function_append_braces = 0;
+
+ for (int i = 0; i < script.count(); ++i) {
+ QChar c1 = script[i];//.toLatin1();
+ QChar c2 = script[i+1];//.toLatin1(); // OK; QByteArray is always null-terminated.
+
+ if (in_singleline_comment) {
+ if (newline == c1) {
+ in_singleline_comment = false;
+ out.append(c1);
+ continue;
+ }
+ out.append(c1);
+ continue;
+ }
+
+ if (in_multiline_comment) {
+ if (asterisk == c1 && forwardslash == c2) {
+ in_multiline_comment = false;
+ out.append(c1);
+ out.append(c2);
+ ++i;
+ continue;
+ }
+ out.append(c1);
+ continue;
+ }
+
+ if (in_singlequote_literal) {
+ if (backslash == c1) {
+ out.append(c1);
+ out.append(c2);
+ ++i;
+ continue;
+ }
+ if (singlequote == c1) {
+ in_singlequote_literal = false;
+ out.append(c1);
+ continue;
+ }
+ if (cr == c1 && newline == c2) {
+ out.append("\\n\'+\r\n\'");
+ ++i;
+ continue;
+ }
+ if (newline == c1) {
+ out.append("\\n\'+\n\'");
+ continue;
+ }
+ out.append(c1);
+ continue;
+ }
+
+ if (in_doublequote_literal) {
+ if (backslash == c1) {
+ out.append(c1);
+ out.append(c2);
+ ++i;
+ continue;
+ }
+ if (doublequote == c1) {
+ in_doublequote_literal = false;
+ out.append(c1);
+ continue;
+ }
+ if (cr == c1 && newline == c2) {
+ out.append("\\n\"+\r\n\"");
+ ++i;
+ continue;
+ }
+ if (newline == c1) {
+ out.append("\\n\"+\n\"");
+ continue;
+ }
+ out.append(c1);
+ continue;
+ }
+
+ switch(c1.toLatin1()) {
+
+ case singlequote:
+ in_singlequote_literal = true;
+ out.append(c1);
+ continue;
+
+ case doublequote:
+ in_doublequote_literal = true;
+ out.append(c1);
+ continue;
+
+ case forwardslash:
+ out.append(c1);
+ if (c2 == forwardslash) {
+ in_singleline_comment = true;
+ out.append(c2);
+ ++i;
+ }
+ if (c2 == asterisk) {
+ in_multiline_comment = true;
+ out.append(c2);
+ ++i;
+ }
+ continue;
+
+ case brace_open:
+ ++braces;
+ out.append(c1);
+ continue;
+
+ case brace_close:
+ --braces;
+ out.append(c1);
+ if (!function_append.isEmpty() && function_append_braces == braces) {
+ out.append(function_append);
+ function_append = QString();
+ }
+ continue;
+
+ case curlybrace_open:
+ ++curlybraces;
+ out.append(c1);
+ continue;
+
+ case curlybrace_close:
+ --curlybraces;
+ out.append(c1);
+ continue;
+
+ default:
+ // Look ahead to next non-identifier character
+ int tok_len;
+ for (tok_len = 0; i + tok_len < script.count() && identifier_chars.contains(script[i+tok_len]); ++tok_len) {}
+ if (tok_len < 2) {
+ out.append(c1);
+ continue;
+ }
+ QString tok = script.mid(i, tok_len);
+
+ // Apply preprocessing rules
+
+ // 1. Function appends - text placed immediately after the closing
+ // bracket of a function invocation.
+ if (functionAppends.contains(tok)) {
+ function_append = functionAppends[tok];
+ function_append_braces = braces;
+ }
+
+ out.append(tok);
+ i += tok_len - 1;
+ continue;
+ }
+ }
+
+ out.squeeze();
+
+ script = out;
+}
diff --git a/interpreter/scriptpreprocessor.h b/interpreter/scriptpreprocessor.h
new file mode 100644
index 0000000..31046f9
--- /dev/null
+++ b/interpreter/scriptpreprocessor.h
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SCRIPTPREPROCESSOR_H
+#define SCRIPTPREPROCESSOR_H
+
+#include <QMap>
+#include <QString>
+
+class ScriptPreprocessor
+{
+public:
+ ScriptPreprocessor();
+ void preprocess(QString &script);
+
+private:
+ QMap<QString, QString> functionAppends;
+};
+
+#endif
diff --git a/interpreter/scripts.qrc b/interpreter/scripts.qrc
new file mode 100644
index 0000000..3baa62e
--- /dev/null
+++ b/interpreter/scripts.qrc
@@ -0,0 +1,6 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource>
+ <file>builtins.js</file>
+ <file>config.js</file>
+</qresource>
+</RCC>
diff --git a/libqsystemtest/DESCRIPTION b/libqsystemtest/DESCRIPTION
new file mode 100644
index 0000000..04f1e0e
--- /dev/null
+++ b/libqsystemtest/DESCRIPTION
@@ -0,0 +1 @@
+Core functionality of the QtUitest script interpreter.
diff --git a/libqsystemtest/failuredlg.ui b/libqsystemtest/failuredlg.ui
new file mode 100644
index 0000000..b8089d4
--- /dev/null
+++ b/libqsystemtest/failuredlg.ui
@@ -0,0 +1,95 @@
+<ui version="4.0" >
+ <class>FailureDlg</class>
+ <widget class="QDialog" name="FailureDlg" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>482</width>
+ <height>302</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Failure Message</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <layout class="QVBoxLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Please describe how the test failed. Where relevant, refer to the manual verification steps. Your message will be appended to the test log.</string>
+ </property>
+ <property name="textFormat" >
+ <enum>Qt::PlainText</enum>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTextEdit" name="failureEdit" />
+ </item>
+ <item>
+ <widget class="QDialogButtonBox" name="buttonBox" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons" >
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>FailureDlg</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>258</x>
+ <y>291</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>FailureDlg</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>326</x>
+ <y>291</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/libqsystemtest/gracefulquit.cpp b/libqsystemtest/gracefulquit.cpp
new file mode 100644
index 0000000..a50fb94
--- /dev/null
+++ b/libqsystemtest/gracefulquit.cpp
@@ -0,0 +1,192 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "gracefulquit.h"
+
+#ifdef Q_OS_UNIX
+
+#include <QTimer>
+#include <QSocketNotifier>
+
+#include <signal.h>
+#include <errno.h>
+#include <unistd.h>
+
+int graceful_quit_fds[2];
+sighandler_t graceful_quit_old_handlers[32];
+int graceful_quit_signal;
+
+void graceful_quit_alarm_handler(int)
+{
+ ::kill(::getpid(), graceful_quit_signal);
+ qFatal("Terminated.");
+}
+
+void graceful_quit_signal_handler(int sig)
+{
+ graceful_quit_signal = sig;
+
+ // Replace the old handlers.
+ signal(SIGINT, graceful_quit_old_handlers[SIGINT]);
+ signal(SIGQUIT, graceful_quit_old_handlers[SIGQUIT]);
+ signal(SIGTERM, graceful_quit_old_handlers[SIGTERM]);
+ signal(SIGHUP, graceful_quit_old_handlers[SIGHUP]);
+
+ /*
+ Write to the monitored pipe to wake up any watching socket notifiers.
+ */
+ char byte = 0x01;
+ write(graceful_quit_fds[1], &byte, sizeof(byte));
+}
+
+/*
+ This class ensures that the process really dies if it fails to gracefully
+ quit (e.g., it's stuck in a nested event loop).
+*/
+class QKillTimer : public QObject
+{
+Q_OBJECT
+public:
+ QKillTimer(QSocketNotifier*);
+
+private slots:
+ void on_activated();
+
+private:
+ QSocketNotifier* m_notifier;
+};
+
+QKillTimer::QKillTimer(QSocketNotifier* parent)
+ : QObject(parent),
+ m_notifier(parent)
+{
+ connect(m_notifier, SIGNAL(activated(int)), this, SLOT(on_activated()));
+}
+
+void QKillTimer::on_activated()
+{
+ m_notifier->setEnabled(false);
+ signal(SIGALRM, graceful_quit_alarm_handler);
+ ::alarm(1);
+}
+
+/*!
+ \class GracefulQuit
+ \inpublicgroup QtUiTestExtension
+ \brief The GracefulQuit class provides a method for quitting applications
+ gracefully when a terminating unix signal is received.
+*/
+
+/*!
+ Installs a graceful quit handler on \a object.
+
+ \a object must have a quit() slot, such as QCoreApplication.
+ When a Unix signal occurs which would normally cause a termination, such
+ as SIGINT or SIGTERM, the quit() slot will be invoked on \a object.
+
+ Example:
+ \code
+ int main(int argc, char** argv)
+ {
+ QApplication app(argc, argv);
+
+ // Ensure we shut down sanely upon receiving SIGINT etc.
+ GracefulQuit::install(&app);
+
+ // Do regular stuff...
+ MyWidget widget;
+ widget.show();
+
+ // If we get a signal, all objects will be destroyed as they should be.
+ return app.exec();
+ }
+ \endcode
+*/
+void GracefulQuit::install(QObject* object)
+{
+ Q_ASSERT(object);
+
+ /*
+ Create a pipe for internal use.
+ When the pipe is written into, that means we've received an exit
+ signal.
+ */
+ static bool made_pipe = false;
+ if (!made_pipe) {
+ if (-1 == pipe(graceful_quit_fds)) {
+ qWarning("GracefulQuit::install(): pipe() failed: %s", strerror(errno));
+ return;
+ } else {
+ made_pipe = true;
+
+ /*
+ Install the signal handler.
+ */
+ graceful_quit_old_handlers[SIGINT] = signal(SIGINT, graceful_quit_signal_handler);
+ graceful_quit_old_handlers[SIGQUIT] = signal(SIGQUIT, graceful_quit_signal_handler);
+ graceful_quit_old_handlers[SIGTERM] = signal(SIGTERM, graceful_quit_signal_handler);
+ graceful_quit_old_handlers[SIGHUP] = signal(SIGHUP, graceful_quit_signal_handler);
+ }
+ }
+
+ /*
+ Watch the readable fd. When it can be read from, it's time for us
+ to quit.
+ */
+ static QSocketNotifier* sn = new QSocketNotifier
+ (graceful_quit_fds[0], QSocketNotifier::Read, object);
+
+ // Give the application 1 second to gracefully quit.
+ static QKillTimer* kt = new QKillTimer(sn);
+ Q_UNUSED(kt);
+
+ if (!object->connect(sn, SIGNAL(activated(int)), SLOT(quit())))
+ Q_ASSERT(0);
+
+}
+
+#else
+void GracefulQuit::install(QObject*)
+{}
+#endif
+
+#include "gracefulquit.moc"
+
diff --git a/libqsystemtest/gracefulquit.h b/libqsystemtest/gracefulquit.h
new file mode 100644
index 0000000..25eeb04
--- /dev/null
+++ b/libqsystemtest/gracefulquit.h
@@ -0,0 +1,53 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef GRACEFULQUIT_P_H
+#define GRACEFULQUIT_P_H
+#include <qtuitestglobal.h>
+
+class QObject;
+struct QSYSTEMTEST_EXPORT GracefulQuit
+{
+ static void install(QObject*);
+};
+
+#endif
+
diff --git a/libqsystemtest/libqsystemtest.pro b/libqsystemtest/libqsystemtest.pro
new file mode 100644
index 0000000..677fd97
--- /dev/null
+++ b/libqsystemtest/libqsystemtest.pro
@@ -0,0 +1,67 @@
+DEFINES += QSYSTEMTEST_TARGET
+
+FORMS +=\
+ manualverificationdlg.ui \
+ failuredlg.ui \
+ recorddlg.ui
+
+SEMI_PRIVATE_HEADERS += \
+# qcircularbuffer_p.h \
+ qsystemtestmaster_p.h \
+ qsystemtest_p.h \
+ qtestremote_p.h \
+ qtestverifydlg_p.h
+
+HEADERS +=\
+ gracefulquit.h \
+ qabstracttest.h \
+ qsystemtest.h
+
+SOURCES +=\
+ gracefulquit.cpp \
+ qabstracttest.cpp \
+ qtestremote.cpp \
+ qtestverifydlg.cpp \
+ qsystemtest.cpp \
+ qsystemtest_p.cpp \
+ qsystemtestmaster.cpp
+
+VPATH+=$$PWD
+INCLUDEPATH+=$$PWD
+INCLUDEPATH+=$$SRCROOT
+DEPENDPATH+=$$SRCROOT
+
+TEMPLATE=lib
+TARGET=qsystemtest
+TARGET=$$qtLibraryTarget($$TARGET)
+HEADERS*=$$SEMI_PRIVATE_HEADERS $$PRIVATE_HEADERS
+INCLUDEPATH+=$$SRCROOT/libqtuitest
+CONFIG+=qtestlib
+QT+=network
+
+unix:!symbian:DESTDIR=$$BUILDROOT/lib
+
+symbian {
+ TARGET.EPOCALLOWDLLDATA=1
+ TARGET.CAPABILITY += AllFiles ReadDeviceData ReadUserData SwEvent WriteUserData
+ SOURCES-=gracefulquit.cpp
+ HEADERS-=gracefulquit.h
+ LIBS+=-L$$OUT_PWD -lqtuitest -lws32 -leuser -lcone
+}
+
+win32 {
+ SOURCES-=gracefulquit.cpp
+ HEADERS-=gracefulquit.h
+ CONFIG(debug,debug|release): LIBS+=-L$$BUILDROOT/libqtuitest -lqtuitestd
+ CONFIG(release,debug|release):LIBS+=-L$$BUILDROOT/libqtuitest -lqtuitest
+ target.path=$$INSTALLROOT
+ INSTALLS+=target
+ !equals(QMAKE_CXX, "g++") {
+ DEFINES+=strcasecmp=_stricmp
+ }
+}
+
+mac {
+ LIBS+=-L$$BUILDROOT/lib/ -lqtuitest
+ DEFINES+=sighandler_t=sig_t
+}
diff --git a/libqsystemtest/manualverificationdlg.ui b/libqsystemtest/manualverificationdlg.ui
new file mode 100644
index 0000000..77c7456
--- /dev/null
+++ b/libqsystemtest/manualverificationdlg.ui
@@ -0,0 +1,111 @@
+<ui version="4.0" >
+ <class>ManualVerificationDlg</class>
+ <widget class="QDialog" name="ManualVerificationDlg" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>720</width>
+ <height>540</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Manual Verification Step</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Please follow the indicated steps and click Pass or Fail depending on the outcome. </string>
+ </property>
+ <property name="scaledContents" >
+ <bool>true</bool>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTextBrowser" name="test_steps" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="MinimumExpanding" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="readOnly" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QPushButton" name="abort_button" >
+ <property name="text" >
+ <string>Abort</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>121</width>
+ <height>31</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="okButton" >
+ <property name="text" >
+ <string>Pass</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="cancelButton" >
+ <property name="text" >
+ <string>Fail</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="learnButton" >
+ <property name="text" >
+ <string>Record</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>okButton</sender>
+ <signal>clicked()</signal>
+ <receiver>ManualVerificationDlg</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>403</x>
+ <y>406</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>96</x>
+ <y>254</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/libqsystemtest/qabstracttest.cpp b/libqsystemtest/qabstracttest.cpp
new file mode 100644
index 0000000..0b0a5a5
--- /dev/null
+++ b/libqsystemtest/qabstracttest.cpp
@@ -0,0 +1,774 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qabstracttest.h>
+#include <QDir>
+#include <QFileInfo>
+#include <QMetaMethod>
+#include <QThread>
+#include <QTimer>
+
+#ifdef Q_OS_UNIX
+# include <unistd.h>
+# include <time.h>
+# include <signal.h>
+# include <setjmp.h>
+#endif
+
+/*!
+ \enum QAbstractTest::LearnMode
+
+ This enum specifies the learn mode setting.
+
+ The learn mode affects the behavior of certain functions in QSystemTest, such as verifyImage().
+ Additionally, a test may choose to use the current learn mode to determine how to handle
+ a test failure.
+
+ \value LearnNone
+ Learn mode is off. Any mismatches encountered will cause a test failure.
+ \value LearnNew
+ The test should attempt to learn data which does not match existing test data.
+ \value LearnAll
+ The test should attempt to learn all data, even if it matches existing test data.
+
+ \sa learnMode(), setLearnMode(), verifyImage()
+*/
+
+bool Autotest_QLog::m_enabled = false;
+
+QDebug Autotest_QLog::log(const char* category)
+{
+ QDebug r = QDebug(QtDebugMsg);
+ if ( category )
+ r << category << ": ";
+ return r;
+}
+
+class FatalTimeoutThread : public QThread
+{
+Q_OBJECT
+public:
+ FatalTimeoutThread();
+ bool inEventLoop() const { return m_inEventLoop; }
+ void setTimeout(int timeout) { m_timeout = timeout; }
+
+ void startTimer();
+ void stopTimer();
+ void stopThread();
+
+protected:
+ void run();
+
+private slots:
+ void enteredEventLoop();
+ void _startTimer();
+ void _stopTimer();
+ void _stopThread();
+
+private:
+ enum ExitCodes { TimedOut = 0, DidNotTimeOut, StartTimer, Exit };
+ int m_timeout;
+ bool m_inEventLoop;
+};
+
+class QAbstractTestPrivate
+{
+public:
+ QAbstractTest::LearnMode learnMode;
+ QString baseDataPath;
+ bool failEmptyTest;
+};
+
+static QString noslash(QString const &in)
+{
+ QString out(in);
+ while (out.endsWith("/")) out.chop(1);
+ return out;
+}
+
+/*
+ \internal
+ \class QAbstractTest
+ \inpublicgroup QtUiTestExtension
+ \mainclass
+ \brief The QAbstractTest class is the base class for all QtUiTest System Tests.
+
+ \ingroup qtuitest_unittest
+ \ingroup qtuitest_systemtest
+ \internal
+
+ QAbstractTest provides some functionality helpful for all kinds of tests.
+
+ In practice, a test class will almost always subclass QSystemTest.
+
+ \sa QSystemTest, QtUiTest, QTestLib
+*/
+
+/*
+ \internal
+ Construct the test with the specified \a parent.
+*/
+QAbstractTest::QAbstractTest(QString const &srcdir, QObject *parent)
+ : QTimedTest(parent)
+{
+ d = new QAbstractTestPrivate;
+ d->baseDataPath = noslash(QDir::homePath()) + "/.qtest";
+ d->learnMode = LearnNone;
+ d->failEmptyTest = false;
+ if (!srcdir.isEmpty())
+ setupTestDataPath(qPrintable(srcdir + "/tst_phonytest.cpp"));
+}
+
+/*
+ \internal
+*/
+QAbstractTest::~QAbstractTest()
+{
+ delete d;
+}
+
+/*!
+ Returns the current learn mode.
+*/
+QAbstractTest::LearnMode QAbstractTest::learnMode() const
+{
+ return d->learnMode;
+}
+
+/*!
+ Sets the current learn \a mode.
+*/
+void QAbstractTest::setLearnMode(QAbstractTest::LearnMode mode)
+{
+ d->learnMode = mode;
+}
+
+bool QAbstractTest::failEmptyTest() const
+{
+ return d->failEmptyTest;
+}
+
+/*!
+ Returns the path in which data for the current test function will be saved to/retrieved from.
+
+ The path follows the format \c baseDataPath/testCaseName/testFunctionName/dataTag,
+ where \c baseDataPath is the path returned by \l baseDataPath().
+
+ Internally, the current data path does not affect the behaviour of QAbstractTest.
+ However, subclasses may use the value returned by this function to decide where to
+ store learned data.
+
+ \sa baseDataPath(), learnMode()
+*/
+QString QAbstractTest::currentDataPath() const
+{
+ return d->baseDataPath + "/" + currentTestFunction() + "/" + currentDataTag();
+}
+
+
+/*!
+ Returns the path which functions as the root directory to all the test data.
+
+ This path defaults to the "testdata" subdirectory of the directory in which the source file of
+ the current test is located; if the source file no longer exists, the path defaults to
+ \c $HOME/.qtest/ . In either case, it can be overridden by the user with the \c -data command line switch.
+
+ The base data path contains the test data for functions such as verifyImage().
+ It can also be used within a test to use testdata stored in files.
+
+ \sa currentDataPath(), learnMode()
+*/
+QString QAbstractTest::baseDataPath() const
+{
+ return d->baseDataPath + "/";
+}
+
+/*!
+ Set the \a path which functions as the root directory to all of the test data.
+
+ The base data path contains the test data for functions such as verifyImage().
+ It can also be used within a test to use testdata stored in files.
+
+ \sa baseDataPath()
+*/
+void QAbstractTest::setBaseDataPath(QString const &path)
+{
+ d->baseDataPath = path;
+}
+
+#ifdef TESTS_SHARED_DIR
+/*!
+ Returns the path which functions as the shared directory available to tests.
+
+ The shared data path contains scripts and other functions available to tests. This is the default search
+ location for the \c include feature.
+
+*/
+QString QAbstractTest::sharedDataPath() const
+{
+ return noslash(TESTS_SHARED_DIR);
+}
+#endif
+/*!
+ Returns the current data tag, or an empty string if the test function has no test data associated
+ with it. The data tag is the string used to identify each row in the test data table.
+
+ Example:
+ \code
+ walkTheDog: function(street) {
+ // At the moment, application crashes if we walk on concrete; this is
+ // a known failure
+ if (currentDataTag().startsWith("concrete sidewalk"))
+ expectFail("concrete is known to break");
+
+ enter( street, "Destination" );
+ select( "Walk the Dog" );
+ compare( getText("Status"), "Walked" );
+ }
+ walkTheDog_data: {
+ "concrete sidewalk 1": [ "East St." ],
+ "concrete sidewalk 2": [ "West St." ],
+ grassy: [ "North St." ],
+ muddy: [ "South St." ]
+ }
+ \endcode
+*/
+QString QAbstractTest::currentDataTag() const
+{
+ return QTest::currentDataTag();
+}
+
+/*!
+ Returns the name of the currently executing test case.
+
+ \sa currentTestFunction()
+*/
+QString QAbstractTest::testCaseName() const
+{
+ return metaObject()->className();
+}
+
+/*!
+ Returns the name of the testfunction that is currently being executed.
+ If \a fullName is true, the fully qualified name (including the test case name) will be returned.
+
+ Example, in a file named sys_mytest:
+ \code
+ testYoyo: function() {
+ currentTestFunction(); // returns "testYoyo"
+ currentTestFunction(true); // returns "sys_mytest::testYoyo"
+ }
+ \endcode
+
+ \sa testCaseName()
+*/
+QString QAbstractTest::currentTestFunction( bool fullName ) const
+{
+ return fullName ? (testCaseName() + "::" + QTest::currentTestFunction()) : (QTest::currentTestFunction());
+}
+
+/*
+ \internal
+ Executes all test functions as specified on the command line, while running the
+ application event loop.
+
+ The \a argc and \a argv parameters should be passed in from the main()
+ function of the application and are used to parse command-line arguments
+ specific to QAbstractTest. Also, subclasses may override the runTest(),
+
+ The \a filename parameter contains the full path to the source file containing the
+ test in question. It is used to determine where test data should be located.
+
+*/
+int QAbstractTest::exec( int argc, char* argv[], char* filename )
+{
+ setupTestDataPath(filename);
+ QByteArray defOpt = qgetenv("QTUITEST_DEFAULT_OPTIONS");
+ QList<QByteArray> defaultOptions;
+ if (defOpt.length()) {
+ defaultOptions = defOpt.split(' ');
+ }
+ int defArgc = defaultOptions.length();
+
+ int _argc(argc+defArgc);
+ char **_argv = new char*[argc+defArgc + 1];
+ for (int i = 0; i < argc; ++i) _argv[i] = argv[i];
+ for (int j = 0; j < defArgc; ++j) _argv[argc+j] = defaultOptions[j].data();
+ processCommandLine(_argc, _argv);
+ int ret = runTest(_argc, _argv);
+ delete[] _argv;
+ return ret;
+}
+
+/*
+ \internal
+ Print a usage message.
+ \a argc and \a argv are command-line arguments.
+ Any subclass which overrides processCommandLine() should also override this
+ function and provide documentation for their arguments.
+*/
+void QAbstractTest::printUsage( int argc, char* argv[] ) const
+{
+ qWarning( " Usage:\n"
+ " %s [file] [options] [testfunction[:datatag]]...\n"
+ "\n"
+ " 'file' is a QtScript file containing the testcase.\n"
+ " 'testfunctions' is a list of functions to execute (separated by spaces).\n"
+ " If no testfunctions are specified, ALL functions will be executed.\n"
+ "\n"
+ " basic test options:\n"
+ " -functions : Returns a list of current testfunctions\n"
+ " -xunitxml : Outputs results as XML XUnit document\n"
+ " -xml : Outputs results as XML document\n"
+ " -lightxml : Outputs results as stream of XML tags\n"
+ " -flush : Flushes the results (use with -xml or -lightxml)\n"
+ " -o filename : Writes all output into a file\n"
+ " -silent : Only outputs warnings and failures\n"
+ " -v : Print 'Autotest' log messages\n"
+ " -v1 : Also print enter messages for each testfunction\n"
+ " -v2 : Also print out each QVERIFY/QCOMPARE/QTEST\n"
+ " -vs : Print every signal emitted\n"
+ " -timed : Print time elapsed (in milliseconds) for each testfunction\n"
+ " -maxtime ms : Maximum time allowed per test, in milliseconds (implies -timed).\n"
+ " If this time is reached, a fatal error occurs and subsequent tests will not run.\n"
+ " -maxwarnings n : Sets the maximum amount of messages to output.\n"
+ " 0 means unlimited, default: 2000\n"
+ " -failempty : Test functions that test nothing will FAIL\n"
+ " -help : This help\n"
+ "\n"
+ " learn mode options:\n"
+ " -learn : All 'learnable' new and changed data may be added/updated.\n"
+ " -learn-all : All 'learnable' data may be added/updated, even if it has not changed.\n"
+ " -data d : The location of the testdata; this value is used for dynamic data loading (i.e. dynamic\n"
+ " data that can't be hardcoded in the testcase itself).\n"
+ " If -data is not specified the testcase will first look in the testdata subdirectory\n"
+ " of the directory containing the test source file, then in $HOME/.qtest\n"
+ , (argc) ? argv[0] : "test");
+}
+
+/*
+ \internal
+ Processes the command line parameters specified by \a argc, \a argv.
+ Subclasses may reimplement this function to handle specific arguments.
+*/
+void QAbstractTest::processCommandLine( int &argc, char* argv[] )
+{
+ int offset = 0;
+ for (int i = 1; i < argc; ++i) {
+ if ( !strcasecmp(argv[i], "-data") ) {
+ argv[i] = 0;
+ offset += 2;
+ ++i;
+ if ( i < argc ) {
+ setBaseDataPath(QString(argv[i]));
+ argv[i] = 0;
+ }
+
+ } else if ( !strcasecmp(argv[i], "-v") ||
+ !strcasecmp(argv[i], "-v1") ||
+ !strcasecmp(argv[i], "-v2") ) {
+ // Don't consume -v1 or -v2
+ if (!strcasecmp(argv[i], "-v")) {
+ argv[i] = 0;
+ offset++;
+ }
+ Autotest_QLog::m_enabled = true;
+
+ } else if ( !strcasecmp(argv[i], "-learn") ) {
+ argv[i] = 0;
+ offset++;
+ setLearnMode(LearnNew);
+
+ } else if ( !strcasecmp(argv[i], "-learn-all") ) {
+ argv[i] = 0;
+ offset++;
+ setLearnMode(LearnAll);
+
+ } else if ( !strcasecmp(argv[i], "-failempty") ) {
+ argv[i] = 0;
+ offset++;
+ d->failEmptyTest = true;
+
+ } else if ( !strcasecmp(argv[i], "-timed") ) {
+ argv[i] = 0;
+ offset++;
+ QTimedTest::pass_through = false;
+ QTimedTest::print_times = true;
+
+ } else if ( !strcasecmp(argv[i], "-maxtime") ) {
+ argv[i] = 0;
+ offset += 2;
+ ++i;
+ if ( i < argc ) {
+ QTimedTest::pass_through = false;
+ bool ok;
+ timeout_thread = new FatalTimeoutThread;
+ timeout_thread->setTimeout(QString::fromAscii(argv[i]).toInt(&ok));
+ if (!ok) qFatal("Invalid parameter to -maxtime");
+ argv[i] = 0;
+ }
+
+ } else if ( !strcasecmp(argv[i], "-help") ||
+ !strcasecmp(argv[i], "--help") ||
+ !strcasecmp(argv[i], "-h") ) {
+ argv[i] = 0;
+ offset++;
+ printUsage(argc-offset, argv);
+ exit(0);
+
+ // Silently ignore a few system test specific arguments.
+ // For compatibility, we'll silently ignore these so that
+ // the same arguments can be specified for unit and system tests.
+ } else if ( !strcasecmp(argv[i], "-autip")
+ || !strcasecmp(argv[i], "-authost")
+ || !strcasecmp(argv[i], "-autport")
+ || !strcasecmp(argv[i], "-remote") ) {
+ argv[i] = 0;
+ offset += 2;
+ ++i;
+ argv[i] = 0;
+
+ } else if ( !strcasecmp(argv[i], "-keepaut")
+ || !strcasecmp(argv[i], "-silentaut")
+ || !strcasecmp(argv[i], "-auto")
+ || !strcasecmp(argv[i], "-demomode") ) {
+ argv[i] = 0;
+ offset++;
+
+ } else {
+ if (offset > 0) {
+ argv[i-offset] = argv[i];
+ argv[i] = 0;
+ }
+ }
+ }
+ argc-=offset;
+}
+
+#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
+jmp_buf segfault_jmp;
+
+void handle_segfault(int signum)
+{
+ signal(signum, SIG_DFL);
+ QTest::qFail("A segmentation fault occurred.", "Unknown file", 0);
+ longjmp(segfault_jmp, 1);
+ _exit(0);
+}
+#endif
+
+/*
+ \internal
+ Run test with arguments \a argc, \a argv, and return an exit code.
+ The base implementation executes private slots as testfunctions
+ using QTest::qExec(). Subclasses may reimplement this function to provide
+ other behaviour.
+*/
+int QAbstractTest::runTest(int argc, char *argv[])
+{
+#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
+ signal(SIGSEGV, handle_segfault);
+ if (!setjmp(segfault_jmp))
+#endif
+ return QTest::qExec( this, argc, argv );
+ return -1;
+}
+
+/*!
+ \internal
+ Set up the test data path, where \a filename is the name of the test source file.
+*/
+void QAbstractTest::setupTestDataPath(const char *filename)
+{
+ d->baseDataPath = noslash(QDir::homePath()) + "/.qtest/" + testCaseName();
+
+ if (filename) {
+ // If we are given a filename, try to use it as test path
+ QFileInfo sourceFile( filename );
+ QString sfPath = sourceFile.canonicalPath();
+ QString dirPath = sourceFile.dir().canonicalPath();
+ QString path = sfPath.isEmpty() ? dirPath : sfPath;
+ if (!path.isEmpty()) {
+ d->baseDataPath = noslash(path) + "/testdata";
+ }
+ }
+
+ // Try to ensure the data directory exists
+ QDir dir;
+ dir.mkpath(d->baseDataPath);
+}
+
+class Timer
+{
+public:
+ virtual ~Timer() {}
+ virtual void start() = 0;
+ virtual int elapsed() const = 0;
+};
+
+class RealTimeTimer : public Timer
+{
+public:
+ void start() { t.start(); }
+ int elapsed() const { return t.elapsed(); }
+private:
+ QTime t;
+};
+
+#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
+class ProcessorTimeTimer : public Timer
+{
+public:
+ void start() { s = clock(); }
+ int elapsed() const { return (int)(((double)(clock() - s))/((double)CLOCKS_PER_SEC)*1000.0); }
+private:
+ clock_t s;
+};
+#endif
+
+
+QTimedTest::QTimedTest(QObject *parent)
+ : QObject(parent), pass_through(true), print_times(false),
+ timeout_thread(0), realTimer(0), cpuTimer(0)
+{}
+
+QTimedTest::~QTimedTest()
+{
+ if (timeout_thread) {
+ timeout_thread->stopThread();
+ timeout_thread->wait();
+ delete timeout_thread;
+ }
+ delete realTimer;
+ delete cpuTimer;
+}
+
+static bool isTimeableSlot(const QMetaMethod &sl)
+{
+ if (sl.access() != QMetaMethod::Private || !sl.parameterTypes().isEmpty()
+ || qstrlen(sl.typeName()) || sl.methodType() != QMetaMethod::Slot)
+ return false;
+ const char *sig = sl.signature();
+ int len = qstrlen(sig);
+ if (len < 2)
+ return false;
+ if (sig[len - 2] != '(' || sig[len - 1] != ')')
+ return false;
+ if (len > 7 && strcmp(sig + (len - 7), "_data()") == 0)
+ return false;
+/*
+ It makes sense to time init() etc also.
+ if (strcmp(sig, "initTestCase()") == 0 || strcmp(sig, "cleanupTestCase()") == 0
+ || strcmp(sig, "cleanup()") == 0 || strcmp(sig, "init()") == 0)
+ return false;
+*/
+
+ return true;
+}
+
+FatalTimeoutThread::FatalTimeoutThread() : QThread()
+{
+ m_timeout = 0;
+ m_inEventLoop = false;
+}
+
+void FatalTimeoutThread::enteredEventLoop()
+{
+ m_inEventLoop = true;
+}
+
+void FatalTimeoutThread::startTimer()
+{
+ QMetaObject::invokeMethod(this, "_startTimer");
+}
+
+void FatalTimeoutThread::stopTimer()
+{
+ QMetaObject::invokeMethod(this, "_stopTimer");
+}
+
+void FatalTimeoutThread::stopThread()
+{
+ QMetaObject::invokeMethod(this, "_stopThread");
+}
+
+void FatalTimeoutThread::_startTimer()
+{
+ exit(StartTimer);
+}
+
+void FatalTimeoutThread::_stopTimer()
+{
+ exit(DidNotTimeOut);
+}
+
+void FatalTimeoutThread::_stopThread()
+{
+ exit(Exit);
+}
+
+void FatalTimeoutThread::run()
+{
+ QTimer t;
+ connect(&t, SIGNAL(timeout()), this, SLOT(quit()));
+ QTimer::singleShot(0, this, SLOT(enteredEventLoop()));
+
+ int code;
+ do {
+ code = exec();
+ switch (code) {
+ case TimedOut:
+ QTest::qFail(qPrintable(QString("Test did not finish within the allowed %1 ms").arg(m_timeout)), "Unknown file", 0);
+#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
+ longjmp(segfault_jmp, 1);
+#endif
+ _exit(0);
+ case DidNotTimeOut:
+ t.stop();
+ break;
+ case StartTimer:
+ t.setInterval(m_timeout);
+ t.start();
+ break;
+ default: break;
+ }
+ } while(code != Exit);
+}
+
+int QTimedTest::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+{
+ if (!realTimer) {
+ have_init = isTimeableSlot(metaObject()->method(metaObject()->indexOfMethod("init()")));
+ have_cleanup = isTimeableSlot(metaObject()->method(metaObject()->indexOfMethod("cleanup()")));
+ realTimer = new RealTimeTimer;
+#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
+ cpuTimer = new ProcessorTimeTimer;
+#endif
+ }
+
+ if (pass_through)
+ return real_qt_metacall(_c, _id, _a);
+
+ bool timed = isTimeableSlot(metaObject()->method(_id));
+ bool is_init = (_id == metaObject()->indexOfMethod("init()"));
+ bool is_cleanup = (_id == metaObject()->indexOfMethod("cleanup()"));
+ bool is_single = (_id == metaObject()->indexOfMethod("initTestCase()") ||
+ _id == metaObject()->indexOfMethod("cleanupTestCase()"));
+
+ bool should_start_timer = timed && (is_single || is_init || (!have_init && !is_cleanup));
+ bool should_stop_timer = timed && (is_single || (!is_init && (!have_cleanup || is_cleanup)));
+
+ if (should_start_timer) {
+ if (timeout_thread) {
+ if (timeout_thread != timeout_thread->thread()) {
+ timeout_thread->moveToThread(timeout_thread);
+ timeout_thread->start();
+ while (!timeout_thread->inEventLoop()) {
+ timeout_thread->wait(50);
+ }
+ }
+ timeout_thread->startTimer();
+ }
+ realTimer->start();
+ if (cpuTimer) cpuTimer->start();
+ }
+
+ pass_through = true;
+ int ret = this->qt_metacall(_c, _id, _a);
+ pass_through = false;
+
+ if (should_stop_timer) {
+ if (print_times) QDebug(QtDebugMsg) <<
+ qPrintable(
+ QString("Test time: %1 ms CPU, %2 ms real")
+ .arg(cpuTimer ? cpuTimer->elapsed() : -1)
+ .arg(realTimer->elapsed())
+ );
+ if (timeout_thread) timeout_thread->stopTimer();
+ }
+
+ return ret;
+}
+
+static const uint qt_meta_data_QTimedTest[] = {
+
+ // content:
+ 1, // revision
+ 0, // classname
+ 0, 0, // classinfo
+ 0, 0, // methods
+ 0, 0, // properties
+ 0, 0, // enums/sets
+
+ 0 // eod
+};
+
+static const char qt_meta_stringdata_QTimedTest[] = {
+ "QTimedTest\0"
+};
+
+const QMetaObject QTimedTest::staticMetaObject = {
+ { &QObject::staticMetaObject, qt_meta_stringdata_QTimedTest,
+ qt_meta_data_QTimedTest, 0 }
+};
+
+const QMetaObject *QTimedTest::metaObject() const
+{
+ return &staticMetaObject;
+}
+
+void *QTimedTest::qt_metacast(const char *_clname)
+{
+ if (!_clname) return 0;
+ if (!strcmp(_clname, qt_meta_stringdata_QTimedTest))
+ return static_cast<void*>(const_cast< QTimedTest*>(this));
+ return QObject::qt_metacast(_clname);
+}
+
+int QTimedTest::real_qt_metacall(QMetaObject::Call _c, int _id, void **_a)
+{
+ _id = QObject::qt_metacall(_c, _id, _a);
+ if (_id < 0)
+ return _id;
+ return _id;
+}
+
+#include "qabstracttest.moc"
diff --git a/libqsystemtest/qabstracttest.h b/libqsystemtest/qabstracttest.h
new file mode 100644
index 0000000..69ee0ee
--- /dev/null
+++ b/libqsystemtest/qabstracttest.h
@@ -0,0 +1,144 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QABSTRACTTEST_H
+#define QABSTRACTTEST_H
+
+#if ! defined Q_QDOC
+
+#include <QObject>
+#include <QTest>
+#include <qtuitestglobal.h>
+#include <qdebug.h>
+
+class QSYSTEMTEST_EXPORT Autotest_QLog {
+public:
+ static inline bool enabled() { return m_enabled; }
+ static QDebug log(const char* category);
+private:
+ static bool m_enabled;
+ friend class QAbstractTest;
+};
+
+class QAbstractTestPrivate;
+class FatalTimeoutThread;
+class Timer;
+
+class QSYSTEMTEST_EXPORT QTimedTest : public QObject
+{
+#ifndef Q_MOC_RUN
+ Q_OBJECT
+#endif
+public:
+ QTimedTest(QObject *parent=0);
+ virtual ~QTimedTest();
+
+ int real_qt_metacall(QMetaObject::Call, int, void **);
+
+protected:
+ bool pass_through;
+ bool print_times;
+ bool have_init;
+ bool have_cleanup;
+ FatalTimeoutThread *timeout_thread;
+ Timer *realTimer;
+ Timer *cpuTimer;
+};
+
+#ifdef Q_QDOC
+namespace QAbstractTest
+#else
+class QSYSTEMTEST_EXPORT QAbstractTest : public QTimedTest
+#endif
+{
+ Q_OBJECT
+
+public:
+ enum LearnMode
+ {
+ LearnNone,
+ LearnNew,
+ LearnAll
+ };
+
+#ifndef Q_QDOC
+ QAbstractTest(QString const &srcdir =
+#ifdef QTUITEST_SRCDIR
+ QTUITEST_SRCDIR
+#else
+ QString()
+#endif
+ , QObject *parent = 0);
+ virtual ~QAbstractTest();
+
+ int exec( int argc, char* argv[], char* filename = 0 );
+#endif
+
+public slots:
+ LearnMode learnMode() const;
+ void setLearnMode(LearnMode mode);
+ bool failEmptyTest() const;
+
+ QString currentDataPath() const;
+ QString baseDataPath() const;
+ void setBaseDataPath(QString const &path);
+#ifdef TESTS_SHARED_DIR
+ QString sharedDataPath() const;
+#endif
+ QString currentDataTag() const;
+ virtual QString testCaseName() const;
+ QString currentTestFunction( bool fullName = false ) const;
+
+#ifndef Q_QDOC
+protected:
+ virtual int runTest(int argc, char *argv[]);
+ virtual void printUsage( int argc, char *argv[] ) const;
+ virtual void processCommandLine( int &argc, char *argv[] );
+ virtual void setupTestDataPath(const char *filename);
+#endif
+
+private:
+ QAbstractTestPrivate *d;
+};
+
+#endif
+
+#endif
diff --git a/libqsystemtest/qsystemtest.cpp b/libqsystemtest/qsystemtest.cpp
new file mode 100644
index 0000000..5f57584
--- /dev/null
+++ b/libqsystemtest/qsystemtest.cpp
@@ -0,0 +1,3310 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qsystemtest.h>
+
+#include "qsystemtestmaster_p.h"
+
+#include "qtuitest_config.h"
+#include "qsystemtest_p.h"
+#include "gracefulquit.h"
+#include "ui_recorddlg.h"
+#include "ui_manualverificationdlg.h"
+#include "ui_failuredlg.h"
+
+#include <QDir>
+#include <QProcess>
+#include <QMessageBox>
+#include <QTemporaryFile>
+#include <QTextEdit>
+#include <QSignalSpy>
+#include <QSettings>
+
+#include <sys/types.h>
+#include <signal.h>
+#include <errno.h>
+
+#undef qLog
+#define qLog(A) if (0); else (QDebug(QtDebugMsg) << #A ":")
+#define OBJECT_EXIST_TIMEOUT 1000
+
+#define BT(message) (\
+ message["location"] = QString("%1:%2%3").arg(__FILE__).arg(__LINE__).arg(!message["location"].toString().isEmpty() ? "\n" + message["location"].toString() : ""),\
+ message)
+
+#undef QFAIL
+#define QFAIL(message) \
+do {\
+ setQueryError(message);\
+ return;\
+} while(0)
+
+
+/*!
+ \enum QSystemTest::EnterMode
+
+ This enum specifies whether enter() should commit the entered value (eg, by simulating a Select
+ keypress) or not.
+
+ \value Commit Commit the value (default).
+ \value NoCommit Do not commit the value.
+*/
+
+/*!
+ \enum QSystemTest::StartApplicationFlag
+
+ This enum describes additional behaviour to use when starting applications
+ by startApplication().
+
+ \value NoFlag Don't apply any of the below flags.
+ \value WaitForFocus Wait for the application to gain keyboard focus before returning.
+ \value BackgroundCurrentApplication Use multitasking to background the current application.
+ The default behaviour is to exit the current application.
+*/
+
+/*!
+ \enum QSystemTest::SkipMode
+
+ This enum describes the modes for skipping tests during execution of the test data.
+ \value SkipSingle Skip the rest of this test function for the current test data entry, but continue execution of the remaining test data.
+ \value SkipAll Skip the rest of this test function, and do not process any further test data for this test function.
+
+ \sa skip(), QTest::SkipMode
+*/
+
+/*!
+ \enum QSystemTest::LabelOrientation
+
+ This enum is used to indicate the expected position of a label relative to the widget it is
+ associated with. Use setLabelOrientation() to change the expected layout.
+
+ \value LabelLeft Label is located to left of widget.
+ \value LabelRight Label is located to right of widget.
+ \value LabelAbove Label is located above widget.
+ \value LabelBelow Label is located below widget.
+
+ \sa labelOrientation(), setLabelOrientation()
+*/
+
+/*!
+ \preliminary
+ \namespace QSystemTest
+ \brief The QSystemTest namespace provides script based system test functionality for Qt.
+
+ \ingroup qtuitest_systemtest
+ \inpublicgroup QtUiTestModule
+
+ This documentation describes the API reference for the QtUiTest scripting language. Please read the \l{QtUiTest Manual} for a full description of the system test tool.
+
+*/
+
+/*! \internal */
+QMap<QString, int> QSystemTest::filteredMessages() const
+{
+ return d->filteredMessages;
+}
+
+/*! \internal */
+void QSystemTest::clearFilteredMessages()
+{
+ d->filteredMessages.clear();
+}
+
+/*! \internal */
+bool QSystemTest::shouldFilterMessage(char const *msg)
+{
+ static QList<QRegExp> filters;
+ if (filters.isEmpty()) {
+ QStringList defaultFilters;
+// defaultFilters
+// << "^Connected to VFB server"
+// << "^QTimeLine::start: already running$" // Bug
+// ;
+ QStringList stringFilters = QSettings("Trolltech", "QtUitest")
+ .value("Logging/Filters", defaultFilters)
+ .toStringList();
+ foreach (QString s, stringFilters) {
+ filters << QRegExp(s);
+ }
+ }
+
+ QString message = QString::fromLocal8Bit(msg);
+ foreach (QRegExp r, filters) {
+ if (-1 != r.indexIn(message)) {
+ ++d->filteredMessages[message];
+ return true;
+ }
+ }
+ return false;
+}
+
+/*!
+ \internal
+ Creates the test class.
+ Generally you would use the \l {QTest}{QTEST_MAIN()} macro rather than create the class directly.
+*/
+QSystemTest::QSystemTest()
+ : QAbstractTest()
+ , d(new QSystemTestPrivate(this))
+{
+ QSystemTestPrivate::singleton = this;
+ qRegisterMetaType<QTestMessage>("QTestMessage");
+ qRegisterMetaType<QTestMessage*>("QTestMessage*");
+}
+
+/*!
+ \internal
+ Destroys the test class.
+*/
+QSystemTest::~QSystemTest()
+{
+ delete d;
+ QSystemTestPrivate::singleton = 0;
+}
+
+/*!
+ Returns the signature of the currently active window.
+
+ \sa {Query Paths}
+*/
+QString QSystemTest::activeWindow()
+{
+ QString ret;
+ return queryWithReturn(ret, "activeWindow", "");
+}
+
+/*!
+ Returns the signature of the widget that has keyboard focus.
+
+ Example:
+ \code
+ // Get the currently focused widget in the current app
+ print( focusWidget() );
+ \endcode
+
+ \sa {Query Paths}
+*/
+QString QSystemTest::focusWidget()
+{
+ QString ret;
+ return queryWithReturn(ret, "focusWidget", "");
+}
+
+
+/*!
+ Returns the currently selected text from the widget specified by \a {queryPath}.
+ If no text is selected, returns all text.
+ For list-type widgets, returns the text for the currently selected item.
+
+ Example:
+ \code
+ // Enter text in two fields, then go back to the first
+ // and make sure it still has the right text
+ enter("Australia", "Home");
+ enter("dog walker", "Occupation");
+ compare( getSelectedText("Home"), "Australia" );
+ \endcode
+
+ \sa {Query Paths}, {Querying Objects}
+*/
+QString QSystemTest::getSelectedText( const QString &queryPath )
+{
+ QString ret = "";
+ return queryWithReturn(ret, "getSelectedText", queryPath);
+}
+
+/*!
+ Returns all text from the widget specified by \a {queryPath}, or the current
+ focus widget if \a {queryPath} is not specified.
+ For list-type widgets, returns the text for all items separated by newlines.
+
+ Example:
+ \code
+ // Get current content of "address" field
+ print( getText("Address") );
+ \endcode
+
+ \sa {Query Paths}, {Querying Objects}
+*/
+QString QSystemTest::getText( const QString &queryPath )
+{
+ QString ret;
+ return queryWithReturn(ret, "getText", queryPath);
+}
+
+/*!
+ Returns the currently selected value from the widget specified by \a {queryPath}.
+ If no value is selected, returns all data in a single value.
+ For list-type widgets, returns the currently selected value.
+
+ \sa getSelectedText(), {Query Paths}, {Querying Objects}
+*/
+QVariant QSystemTest::getSelectedValue( const QString &queryPath )
+{
+ QVariant ret;
+ QString msg("getSelectedValue");
+ QTestMessage reply;
+ QTestMessage testMessage(msg);
+ if (!doQuery(testMessage, queryPath, &reply)) return ret;
+ if (!reply[msg].isValid()) {
+ reply["status"] = "ERROR: no data in reply to " + msg + "; status: " + reply["status"].toString();
+ setQueryError(reply);
+ return ret;
+ }
+ return reply[msg];
+}
+
+/*!
+ Returns the value from the widget specified by \a {queryPath}.
+ For list-type widgets, returns a list containing all values.
+
+ \sa getText(), {Query Paths}, {Querying Objects}
+*/
+QVariant QSystemTest::getValue( const QString &queryPath )
+{
+ QVariant ret;
+ QString msg("getValue");
+ QTestMessage reply;
+ QTestMessage testMessage(msg);
+ if (!doQuery(testMessage, queryPath, &reply)) return ret;
+ if (!reply[msg].isValid()) {
+ reply["status"] = "ERROR: no data in reply to " + msg + "; status: " + reply["status"].toString();
+ setQueryError(reply);
+ return ret;
+ }
+ return reply[msg];
+}
+
+/*!
+ Returns true if the primary input method is mouse/touchscreen.
+
+ \sa setMousePreferred()
+*/
+bool QSystemTest::mousePreferred()
+{
+ bool ret;
+ return queryWithReturn(ret, "mousePreferred", "");
+}
+
+/*!
+ If \a useMouse is true, indicates that QtUiTest should use mouse/touchscreen
+ events to select items on the screen. If false, the keyboard will be used.
+
+ The setting will remain active until the application under test closes, or
+ until the value is changed by another call to setMousePreferred().
+
+ \sa mousePreferred()
+*/
+void QSystemTest::setMousePreferred(bool useMouse)
+{
+ QTestMessage message("setMousePreferred");
+ message["useMouse"] = useMouse;
+ d->queryPassed( "OK", "", BT(message));
+}
+
+/*!
+ Returns the label orientation, used by QtUiTest to assign labels to
+ widgets.
+
+ \sa setLabelOrientation()
+*/
+QSystemTest::LabelOrientation QSystemTest::labelOrientation()
+{
+ int ret;
+ return static_cast<LabelOrientation>(queryWithReturn(ret, "labelOrientation", ""));
+}
+
+/*!
+ Set the expected label orientation to \a orientation. This value is used by
+ QtUiTest to work out which labels refer to which widgets. By default, this
+ value is LabelLeft (on left-to-right locales) or LabelRight (on right-to-left
+ locales).
+
+ The setting will remain active until the application under test closes, or
+ until the value is changed by another call to setLabelOrientation().
+
+ \sa labelOrientation()
+*/
+void QSystemTest::setLabelOrientation(LabelOrientation orientation)
+{
+ QTestMessage message("setLabelOrientation");
+ message["orientation"] = orientation;
+ d->queryPassed( "OK", "", BT(message));
+}
+
+/*!
+ Returns a list of all items from the list-type widget specified by \a {queryPath}.
+
+ The items will be returned in the order they are stored in the widget (for example,
+ for a simple list view the items will be returned from top to bottom).
+
+ Example:
+ \code
+ // Verify that "gender" combobox contains male and female only
+ var g = getList("Gender");
+ compare( g.length == 2 );
+ verify( g.contains("Male") );
+ verify( g.contains("Female") );
+ \endcode
+
+ \sa {Query Paths}, {Querying Objects}
+*/
+QStringList QSystemTest::getList( const QString &queryPath )
+{
+ QStringList ret;
+ return queryWithReturn(ret, "getList", queryPath);
+}
+
+QPoint QSystemTest::getCenter( const QString &item, const QString &queryPath )
+{
+ if (item.isNull()) return QPoint();
+ QTestMessage message("getCenter");
+ message["item"] = item;
+ d->queryPassed("OK", "", BT(message), queryPath);
+ QTestMessage reply;
+ if (!d->queryPassed( "OK", "", BT(message), queryPath, &reply )) return QPoint();
+ if (!reply["getCenter"].isValid()) {
+ fail("Failed to get center for item");
+ return QPoint();
+ }
+ return reply["getCenter"].value<QPoint>();
+}
+/*!
+ Returns a list of all the labels that are visible in the current active window or the widget specified by \a {queryPath}.
+ A label is usually a non-editable widget (such as a QLabel) that is associated with an editable field. The label is used to
+ give the user a visual clue of the meaning of the editable field. Labels are used by the user, and by QtUitest, to
+ navigate to fields.
+
+ The items will be returned in the order they are displayed, i.e. from top left to bottom right.
+
+ Example:
+ \code
+ // Verify that the current dialogs contains Labels named 'Name' and 'Email'
+ var g = getLabels();
+ verify( g.length == 2 );
+ verify( g.contains("Name") );
+ verify( g.contains("Email") );
+ \endcode
+
+ \sa {Query Paths}, {Querying Objects}
+*/
+QStringList QSystemTest::getLabels( const QString &queryPath )
+{
+ QStringList ret;
+ return queryWithReturn(ret, "getLabels", queryPath);
+}
+
+/*!
+ Returns text stored in the clipboard, or an empty string if the clipboard does not contain any text.
+
+ \sa setClipboardText()
+*/
+QString QSystemTest::getClipboardText( )
+{
+ QString ret;
+ return queryWithReturn(ret, "getClipboardText", "");
+}
+
+/*!
+ Copies \a {text} into the clipboard.
+
+ \sa getClipboardText()
+*/
+void QSystemTest::setClipboardText( const QString& text )
+{
+ QTestMessage message("setClipboardText");
+ message["text"] = text;
+ d->queryPassed( "OK", "", BT(message));
+}
+
+/*!
+ Returns the current window title for the application specified by \a {queryPath}.
+ If \a queryPath contains a widget component, it will be ignored.
+
+ Example:
+ \code
+ startApplication("Contacts") );
+
+ ...
+
+ // Make sure we are still in contacts
+ compare( currentTitle(), "Contacts" );
+ \endcode
+
+ \sa {Query Paths}
+*/
+QString QSystemTest::currentTitle( const QString &queryPath )
+{
+ QString ret;
+ return queryWithReturn(ret, "currentTitle", queryPath);
+}
+
+/*!
+ Returns the window titles for all top level windows in the application.
+*/
+QStringList QSystemTest::getWindowTitles()
+{
+ QStringList ret;
+ return queryWithReturn(ret, "getWindowTitles", "");
+}
+
+/*!
+ Brings the window specified by \a titleOrSignature to the foreground.
+*/
+void QSystemTest::activateWindow( const QString &titleOrSignature )
+{
+ QTestMessage message("activateWindow");
+ message["window"] = titleOrSignature;
+ d->queryPassed( "OK", "", BT(message));
+}
+
+/*!
+ Returns the name of the application which currently has keyboard focus.
+ The name will be the name returned by QCoreApplication::applicationName(),
+ which may be an empty string.
+
+ Example:
+ \code
+ compare( currentApplication(), "addressbook" );
+ \endcode
+
+ \sa applicationVersion()
+*/
+QString QSystemTest::currentApplication()
+{
+ return d->test_app->appName();
+}
+
+/*!
+ Returns the version of the application under test. This is the value
+ returned by QCoreApplication::applicationVersion(), which may be an
+ empty string.
+
+ \sa applicationName()
+*/
+QString QSystemTest::applicationVersion()
+{
+ return d->test_app->appVersion();
+}
+
+/*!
+ Returns the version of Qt used by the application under test.
+
+ \sa applicationName()
+*/
+QString QSystemTest::qtVersion()
+{
+ return d->test_app->qtVersion();
+}
+
+/*!
+ \internal
+ Returns the value of the environment variable for \a key set on the test
+ system.
+*/
+QString QSystemTest::getenv(QString const& key)
+{
+ QTestMessage message("getenv");
+ message["key"] = key;
+
+ QTestMessage reply;
+ if (!d->queryPassed( "OK", "", BT(message), "", &reply )) return QString();
+ if (!reply["getenv"].isValid()) {
+ fail("No data in reply to getenv");
+ return QString();
+ }
+ return reply["getenv"].toString();
+}
+
+/*!
+ Returns true if the test system is running the operating system specified by \a os.
+
+ The supported values are: UNIX, LINUX, MAC, WIN32, WINCE and SYMBIAN.
+*/
+bool QSystemTest::checkOS(QString const& os)
+{
+ QTestMessage message("checkOS");
+ message["os"] = os;
+
+ QTestMessage reply;
+ if (!d->queryPassed( "OK", "", BT(message), "", &reply )) return false;
+ if (!reply["checkOS"].isValid()) {
+ fail("Failed to get details of OS");
+ return false;
+ }
+ return reply["checkOS"].toBool();
+}
+
+/*!
+ \internal
+ Grabs a snapshot of the widget specified by \a {queryPath}, optionally excluding \a maskedWidgets from the snapshot. Each masked widget is replaced by a black rectangle, and any overlapping widgets will also be concealed.
+
+ To get a snapshot of the entire application window, use the query path "".
+
+ Example:
+ \code
+ // Get current screenshot and save to disk
+ QImage img = grabImage("");
+ verify( img.save(currentDataPath() + "/snapshot.png", "PNG") );
+ \endcode
+
+ \sa {Query Paths}, verifyImage(), saveScreen()
+*/
+QImage QSystemTest::grabImage(const QString &queryPath, const QStringList &maskedWidgets )
+{
+ QImage im;
+
+ QTestMessage message("grabPixmap");
+ message["mask"] = maskedWidgets;
+
+ QTestMessage reply = d->query( BT(message), queryPath );
+ if (reply["status"] != "OK" || queryFailed()) {
+ fail( "Couldn't grab image: " + reply.toString());
+ } else {
+ if (!reply["grabPixmap"].isValid()) {
+ fail( "Test slave returned no image" );
+ } else {
+ im = reply["grabPixmap"].value<QImage>();
+ }
+ }
+
+ return im;
+}
+
+/*!
+ Grabs a snapshot of the widget specified by \a {queryPath}, and compares it against the reference snapshot \a expectedName.
+
+ New snapshots are gathered by running the test in \l {Learn Mode}{learn mode}, and are stored in the \c testdata subdirectory of the directory containing the test script. When learn mode is used, a failed image comparison will result in a tester being presented with a manual verification dialog.
+
+ If there is a mismatch between the images, the current test fails.
+
+ When in learn mode, if \a comment is provided it will be shown to the user to help in determining whether or not the pixmap should be accepted.
+
+ \a maskedWidgets is a list of query paths specifying widgets to be excluded from the snapshot. This allows constantly changing widgets to be hidden from view while the snapshot is taken. Each masked widget is replaced by a black rectangle, and any overlapping widgets will also be concealed.
+
+ Example:
+ \code
+ verifyImage( "task_completed", "", "Verify that the current task is shown with a green tick indicating completion" );
+ \endcode
+
+ \sa saveScreen()
+*/
+void QSystemTest::verifyImage( const QString &expectedName, const QString &queryPath, const QString &comment, const QStringList &maskedWidgets )
+{
+ // Determine the filename
+ // If the function was passed an explicit filename (indicated by an extension) it will be used directly
+ // otherwise system specific values are prepended to the name.
+ QString expectedFilename = currentDataPath();
+ if ( expectedName.endsWith( ".png" ) ) {
+ expectedFilename += "/" + expectedName;
+ } else {
+ expectedFilename += QString("/%1_%2.png")
+ .arg( d->config_id )
+ .arg( expectedName );
+ }
+
+ // The reference snapshot should exist in the data directory for this testcase.
+ // If it's not there, and we're not in learn mode, we will fail.
+ if ( (learnMode() == LearnNone || d->auto_mode) && !QFile::exists(expectedFilename) ) {
+ fail(QString("Reference snapshot '%1' doesn't exist yet. Please manually run test in learn mode.").arg(expectedFilename));
+ return;
+ }
+
+ // Now query AUT for the current snapshot
+ QImage actualIm( grabImage(queryPath, maskedWidgets) );
+ if (actualIm.isNull()) return;
+
+ bool snapshotOk = false;
+ QDir("/").mkpath(currentDataPath());
+ QImage expectedIm(expectedFilename);
+
+ // Now do the actual comparisons.
+ // If we are not in learn mode, a difference in snapshots will cause a failure.
+ // If we are in learn mode, a difference will cause a user prompt to accept the new snapshot.
+ // If we are in learn-all mode, the prompt will be displayed every time.
+
+ if ( (learnMode() != LearnAll || d->auto_mode) && QFile::exists(expectedFilename) ) {
+ snapshotOk = d->imagesAreEqual(actualIm, expectedIm);
+ }
+
+ if ( !d->auto_mode && !snapshotOk && learnMode() != LearnNone ) {
+ if ( d->learnImage(actualIm, expectedIm, comment) ) {
+ QFile::remove(expectedFilename);
+ if ( !actualIm.save(expectedFilename, "PNG", 0) ) {
+ QWARN(QString("Failed to save image to %1!").arg(expectedFilename).toLatin1());
+ } else {
+ if (d->qtest_ide.isConnected()) {
+ QTestMessage msg("NEW_TESTDATA");
+ msg["filename"] = expectedFilename;
+ d->qtest_ide.postMessage(msg);
+ }
+ }
+ snapshotOk = true;
+ } else {
+ fail( "New image not accepted by tester" );
+ return;
+ }
+ }
+
+ if (!snapshotOk) {
+ // Failure, so rename the snapshot to identify it for future reference
+ expectedFilename.replace(".png", "_failure.png");
+ if ( !actualIm.save(expectedFilename, "PNG", 0) ) {
+ QWARN(QString("Failed to save failure pixmap to %1!").arg(expectedFilename).toLatin1());
+ }
+ fail( "Snapshots are not the same" );
+ return;
+ }
+
+ /* By using compare, we go through the "expected failure" processing. */
+ /* Without this, we won't get XPASS */
+ QTest::compare_helper( true, "Snapshots are the same", qPrintable(currentFile()), currentLine() );
+}
+
+/*!
+ Compares the widget specified by \a {queryPath} against the reference snapshot \a expectedName.
+
+ \a maskedWidgets is a list of query paths specifying widgets to be excluded from the snapshot. This allows constantly changing widgets to be hidden from view while the snapshot is taken. Each masked widget is replaced by a black rectangle, and any overlapping widgets will also be concealed.
+
+ Returns true if the images match, or false otherwise.
+
+ The reference snapshot can be one previously learned using verifyImage(), or an image saved using saveScreen(), in which case
+ the .png filename extension must be specified.
+
+ \sa verifyImage(), saveScreen()
+*/
+bool QSystemTest::compareImage( const QString &expectedName, const QString &queryPath, const QStringList &maskedWidgets )
+{
+ // Determine the filename
+ // If the function was passed an explicit filename (indicated by an extension) it will be used directly
+ // otherwise system specific values are prepended to the name.
+ QString expectedFilename = currentDataPath();
+ if ( expectedName.endsWith( ".png" ) ) {
+ expectedFilename += "/" + expectedName;
+ } else {
+ expectedFilename += QString("/%1_%2.png")
+ .arg( d->config_id )
+ .arg( expectedName );
+ }
+
+ // The reference snapshot should exist in the data directory for this testcase.
+ if ( !QFile::exists(expectedFilename) ) {
+ fail(QString("Reference snapshot '%1' doesn't exist.").arg(expectedFilename));
+ return false;
+ }
+
+ // Now query AUT for the current snapshot
+ QImage actualIm( grabImage(queryPath, maskedWidgets) );
+ if (queryFailed()) return false;
+
+ QImage expectedIm(expectedFilename);
+
+ // Now do the actual comparisons.
+ return d->imagesAreEqual(actualIm, expectedIm);
+}
+
+/*!
+ Reads \a srcFile from the test system and returns its contents.
+ if \a srcFile contains environment variables, they will be expanded on the test system.
+
+ \sa {File Management}, getFile(), putData(), putFile()
+*/
+QString QSystemTest::getData( const QString &srcFile )
+{
+ QTestMessage message("getFile");
+ message["path"] = srcFile;
+
+ QTestMessage reply;
+ if (!d->queryPassed( "OK", "", BT(message), "", &reply )) return QString();
+ if (!reply["getFile"].isValid()) {
+ fail("No data in reply to getData");
+ return QString();
+ }
+ return reply["getFile"].toString();
+}
+
+/*!
+ \internal
+ Returns image size of image specified in \a srcFile.
+ if \a srcFile contains environment variables, they will be expanded on the test system.
+
+ Note: QSize does not have toString(), see QSize docs for methods returning common types.
+
+ Example:
+ \code
+ // Find the image size of specified image
+ var imgSize = getImageSize( documentsPath() + "image/foo.jpg" );
+ prompt( "Image size is: " + imgSize.width() + " by " + imgSize.height() + ".\n" );
+ \endcode
+*/
+QSize QSystemTest::getImageSize( const QString &srcFile)
+{
+ QTestMessage message("getImageSize");
+ message["path"] = srcFile;
+
+ QTestMessage reply;
+ if (!d->queryPassed( "OK", "", BT(message), "", &reply )) return QSize();
+ if (!reply["getImageSize"].isValid()) {
+ fail("No data in reply to getImageSize");
+ return QSize();
+ }
+ return reply["getImageSize"].value<QSize>();
+}
+/*!
+ Returns geometry of the widget specified in \a queryPath, with position (x,y) co-ordinates being global.
+ Note: QRect does not have toString() method, refer to QRect docs for methods returning common types.
+
+ Example:
+ \code
+ // pass the test if widgets do not overlap
+ var first_widget = getGeometry("Button1");
+ var second_widget = getGeometry("Button2");
+ // intersects returns true on overlap, false when not; verify causes test to fail on false
+ verify( !first_widget.intersects(second_widget), "Specified widgets overlap.");
+ \endcode
+ Example two - a non-mainstream situation:
+
+ select() may work in an undefined manner with custom widgets/items, implementing custom select() methods isn't ideal - each would require writing and testing.
+ On a device with a primary input method of mouse/touchscreen there may not be key code mapping for keys which don't exist - therefore mouse events should be used. However devices may have different geometry, and widget geometry can change between invocations. The example below uses mouseClick() without prior geometry knowledge, though a way is needed to determine where to click, the example shows mouseClick() in the middle of an area defined by the 4th col and 4th row in a uniform grid of the area of the active widget.
+ \code
+ // mouseClick() a widget or item with a fixed position inside its parent widget
+ var geo = getGeometry();
+ var select_x = geo.x() + (( geo.width() / 8) * 7);
+ var select_y = geo.y() + (( geo.height() / 8) * 7);
+ mouseClick(select_x, select_y);
+ \endcode
+
+ \sa select(), mouseClick(), QRect
+*/
+QRect QSystemTest::getGeometry( const QString &queryPath )
+{
+ QRect ret;
+ return queryWithReturn(ret, "getGeometry", queryPath);
+}
+
+/*!
+ Retrieves \a srcFile from the test system and copies it to \a destFile on the local machine.
+ if \a srcFile contains environment variables, they will be expanded on the test system.
+
+ Example:
+ \code
+ // Copy a settings file to the local machine
+ getFile("$HOME/Settings/foo.conf", "/tmp/foo.conf" );
+ \endcode
+
+ \sa {File Management}, getData(), putData(), putFile()
+*/
+void QSystemTest::getFile( const QString &srcFile, const QString &destFile )
+{
+ QTestMessage message("getFile");
+ message["path"] = srcFile;
+
+ QTestMessage reply;
+ if (!d->queryPassed( "OK", "", BT(message), "", &reply )) return;
+ if (!reply["getFile"].isValid()) {
+ reply["status"] = "ERROR_MISSING_DATA";
+ QFAIL(reply);
+ }
+ QByteArray data = reply["getFile"].toByteArray();
+ QFile out(destFile);
+ if (!out.open(QIODevice::WriteOnly|QIODevice::Truncate))
+ QFAIL( "Couldn't open local file '" + destFile + "'");
+ qint64 b;
+ for (b = out.write(data); b < data.size() && -1 != b; ++b) {
+ qint64 this_b = out.write(data.mid(b));
+ if (-1 == this_b) b = -1;
+ else b += this_b;
+ }
+ if (-1 == b)
+ QFAIL( "Couldn't write to local file '" + destFile + "'");
+}
+
+/*!
+ Transfers \a srcFile from the local machine and copies it to \a destFile on the test system.
+ if \a destFile contains environment variables, they will be expanded on the test system.
+
+ By default, the file permissions of the destination file will be set to those of the source
+ file. This can be overridden by specifying \a permissions.
+
+ Example:
+ \code
+ // Force test system to use certain settings
+ putFile("testdata/my_settings.conf", "$HOME/Settings/foo.conf");
+
+ // Specify file permissions
+ putFile("testdata/my_file", "$HOME/my_file", QFile.WriteOwner | QFile.ReadOwner | QFile.ReadOther);
+ \endcode
+
+ \sa {File Management}, putData()
+*/
+void QSystemTest::putFile( const QString &srcFile, const QString &destFile, QFile::Permissions permissions )
+{
+ QFile f(srcFile);
+ if (!f.open(QIODevice::ReadOnly))
+ QFAIL( "Couldn't open '" + srcFile + "'" );
+
+ putData(f.readAll(), destFile, permissions ? permissions : f.permissions());
+}
+
+/*!
+ Reads text from the specified \a file and returns the contents as a QString.
+
+ This can be useful when prompting the user with larger amounts of text.
+
+ \sa {File Management}, prompt()
+*/
+QString QSystemTest::readLocalFile( const QString &file )
+{
+ QFile f(file);
+ QString ret;
+ if (!f.open(QIODevice::ReadOnly)) {
+ setQueryError( "Couldn't open '" + file + "'" );
+ return ret;
+ }
+ ret = f.readAll();
+ return ret;
+}
+
+/*!
+ Transfers \a data from the local machine and copies it to \a destFile on the test system.
+ if \a destFile contains environment variables, they will be expanded on the test system.
+ The file permissions of the destination file can be specified using \a permissions.
+
+ \sa {File Management}, putFile()
+*/
+void QSystemTest::putData( const QByteArray &data, const QString &destFile, QFile::Permissions permissions )
+{
+ QTestMessage message("putFile");
+ message["path"] = destFile;
+ message["data"] = data;
+ if (permissions) {
+ message["permissions"] = static_cast<int>(permissions);
+ }
+ d->queryPassed("OK", "", BT(message));
+}
+
+/*!
+ Delete \a path from the test system. Can be a file, or can be a directory
+ tree, in which case the entire tree is recursively deleted.
+ If \a path contains environment variables, they will be expanded on the
+ test system.
+
+ Example:
+ \code
+ // Force test system to start with clean settings
+ deletePath("$HOME/Settings");
+ \endcode
+
+ \sa {File Management}
+*/
+void QSystemTest::deletePath( const QString &path )
+{
+ QTestMessage message("deletePath");
+ message["path"] = path;
+ d->queryPassed( "OK", "", BT(message) );
+}
+
+/*!
+ Invoke method \a method on object \a queryPath on the test system.
+ Invokable methods include only Qt signals and slots.
+
+ The method will be invoked using the Qt connection type \a type. This can
+ almost always be Qt::AutoConnection, but in a few cases Qt.QueuedConnection may
+ be necessary.
+
+ The optional arguments \a arg0, \a arg1, \a arg2, \a arg3, \a arg4, \a arg5, \a arg6,
+ \a arg7, \a arg8 and \a arg9 will be passed to the method if given.
+
+ Returns true if the method could be invoked, false otherwise.
+
+ Example:
+ \code
+ // Hide this field because it keeps changing and we want a snapshot
+ verify( invokeMethod("Time", "setVisible(bool)", Qt.AutoConnection, false) );
+ verifyImage("good_snapshot");
+ // Put the field back
+ verify( invokeMethod("Time", "setVisible(bool)", Qt.AutoConnection, true) );
+ \endcode
+
+ \sa {Query Paths}, {Querying Objects}
+*/
+bool QSystemTest::invokeMethod( const QString &queryPath, const QString &method, Qt::ConnectionType type,
+ const QVariant &arg0, const QVariant &arg1, const QVariant &arg2,
+ const QVariant &arg3, const QVariant &arg4, const QVariant &arg5,
+ const QVariant &arg6, const QVariant &arg7, const QVariant &arg8,
+ const QVariant &arg9 )
+{
+ QTestMessage message("invokeMethod");
+ message["method"] = method;
+ message["returns"] = false;
+ message["conntype"] = (int)type;
+
+ QVariantList argList;
+ if (arg0.isValid()) argList << arg0;
+ if (arg1.isValid()) argList << arg1;
+ if (arg2.isValid()) argList << arg2;
+ if (arg3.isValid()) argList << arg3;
+ if (arg4.isValid()) argList << arg4;
+ if (arg5.isValid()) argList << arg5;
+ if (arg6.isValid()) argList << arg6;
+ if (arg7.isValid()) argList << arg7;
+ if (arg8.isValid()) argList << arg8;
+ if (arg9.isValid()) argList << arg9;
+
+ message["args"] = argList;
+
+ QTestMessage reply;
+ if (!d->queryPassed( QStringList("OK"), QStringList()
+ << "ERROR_NO_METHOD"
+ << "ERROR_METHOD_NOT_INVOKABLE"
+ << "ERROR_WRONG_ARG_COUNT"
+ << "ERROR_NO_RETURN"
+ << "ERROR_IN_INVOKE", BT(message), queryPath, &reply)) return false;
+
+ return true;
+}
+
+/*!
+ \overload
+ Invokes the given method using connection type Qt.AutoConnection.
+*/
+bool QSystemTest::invokeMethod( const QString &queryPath, const QString &method,
+ const QVariant &arg0, const QVariant &arg1, const QVariant &arg2,
+ const QVariant &arg3, const QVariant &arg4, const QVariant &arg5,
+ const QVariant &arg6, const QVariant &arg7, const QVariant &arg8,
+ const QVariant &arg9 )
+{
+ return invokeMethod(queryPath, method, Qt::AutoConnection, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 );
+}
+
+/*!
+ Set the Qt property named \a name on object \a queryPath to value \a value
+ on the test system.
+
+ Errors can occur in this function.
+
+ Example:
+ \code
+ // Set the text of this field without simulating key presses
+ setProperty("Name", "text", "Billy Jones");
+ \endcode
+
+ \sa {Query Paths}, {Querying Objects}
+*/
+void QSystemTest::setProperty( const QString &queryPath, const QString &name, const QVariant &value )
+{
+ QTestMessage message("setProperty");
+ message["property"] = name;
+ message["value"] = value;
+
+ d->queryPassed( "OK", "", BT(message), queryPath );
+}
+
+/*!
+ Get the value of the Qt property named \a name on object \a queryPath on the test system.
+
+ Example:
+ \code
+ // Get the text of this field without using getText()
+ var t = getProperty("Name", "text").toString();
+ \endcode
+
+ \sa {Query Paths}, {Querying Objects}
+*/
+QVariant QSystemTest::getProperty( const QString &queryPath, const QString &name )
+{
+ QTestMessage message("getProperty");
+ message["property"] = name;
+
+ QVariant out;
+
+ QTestMessage reply;
+ if (!d->queryPassed( "OK", "", BT(message), queryPath, &reply)) return out;
+
+ return reply["getProperty"];
+}
+
+/*!
+ Returns the signatures of the widgets that have \a property matching \a value.
+ This can be used to identify widgets that do not have an associated label text.
+
+ In addition to normal QObject properties, "inherits" and "className" may also
+ be used, with the class specified as a string.
+
+ Example:
+ \code
+ // Select the button with the tool tip "Quit"
+ // assumes that only one widget will match
+ var button = findByProperty("toolTip", "Quit");
+ activate(button);
+ \endcode
+
+ If more than one widget matches, the list returned is sorted by widget position.
+ If no matching widgets are found, the list returned is empty, but the test does
+ not fail. Use findWidget() to cause a test failure when no matching widgets are found.
+
+ \sa findWidget(), signature(), {Query Paths}, {Querying Objects}
+*/
+QStringList QSystemTest::findByProperty( const QString &property, const QVariant &searchValue )
+{
+ QTestMessage message("findByProperty");
+ message["property"] = property;
+ message["searchValue"] = searchValue;
+
+ QStringList out;
+ QTestMessage reply;
+ if (!d->queryPassed( "OK", "", BT(message), "", &reply)) return out;
+ out = reply["findByProperty"].toStringList();
+ return out;
+}
+
+/*!
+ Returns the signatures of the widgets that match all of the property values
+ specified in \a searchValues.
+
+ This can be used to identify widgets that do not have an associated label text.
+
+ Example:
+ \code
+ // Select the button with the tool tip "Quit"
+ // assumes that only one widget will match
+ var button = findByProperty( {className: "QToolButton",
+ toolTip: "Quit"} );
+ activate(button);
+ \endcode
+
+ If more than one widget matches, the list returned is sorted by widget position.
+ If no matching widgets are found, the list returned is empty, but the test does
+ not fail. Use findWidget() to cause a test failure when no matching widgets are found.
+
+ \sa findWidget(), signature(), {Query Paths}, {Querying Objects}
+*/
+QStringList QSystemTest::findByProperty( const QVariantMap &searchValues )
+{
+ QTestMessage message("findByProperties");
+ message["searchValues"] = searchValues;
+
+ QStringList out;
+ QTestMessage reply;
+ if (!d->queryPassed( "OK", "", BT(message), "", &reply)) return out;
+ out = reply["findByProperties"].toStringList();
+ return out;
+}
+
+/*!
+ Returns the signatures of the widgets that have \a property matching \a value.
+
+ This function is the same as findByProperty(), but results in a test failure
+ if no matching widgets are found.
+
+ \sa findByProperty()
+*/
+QStringList QSystemTest::findWidget( const QString &property, const QVariant &searchValue )
+{
+ QStringList ret = findByProperty(property, searchValue);
+ if (ret.isEmpty()) {
+ fail("No widget found with specified property.");
+ }
+ return ret;
+}
+
+/*!
+ Returns the signatures of the widgets that match all of the property values
+ specified in \a searchValues.
+
+ This function is the same as findByProperty(), but results in a test failure
+ if no matching widgets are found.
+
+ \sa findByProperty()
+*/
+QStringList QSystemTest::findWidget( const QVariantMap &searchValues )
+{
+ QStringList ret = findByProperty(searchValues);
+ if (ret.isEmpty()) {
+ fail("No widget found with specified properties.");
+ }
+ return ret;
+}
+
+/*!
+ Retrieves a QSettings settings value from the test system located in \a file, settings group \a group, key \a key.
+ If \a file contains environment variables, they will be expanded on the test system.
+
+ Example:
+ \code
+ // What's our primary input mode?
+ var primaryInput = getSetting("$QPEDIR/etc/defaultbuttons.conf", "Device", "PrimaryInput");
+ \endcode
+
+ \sa setSetting(), QSettings
+*/
+QVariant QSystemTest::getSetting( const QString &file, const QString &group, const QString &key )
+{
+ return d->getSetting(QString(), QString(), file, group, key);
+}
+
+/*!
+ Retrieves a QSettings settings value from the test system located in the settings file for
+ organization \a organization and application \a application, as passed to the QSettings
+ constructor. The settings value retrieved will be group \a group, key \a key.
+
+ \sa setSetting(), QSettings
+*/
+QVariant QSystemTest::getSetting( const QString &organization, const QString &application, const QString &group, const QString &key )
+{
+ return d->getSetting(organization, application, QString(), group, key);
+}
+
+/*!
+ Set a QSettings settings \a value on the test system located in \a file, settings group \a group, key \a key.
+
+ Example:
+ \code
+ // Turn on english and deutsch input languages
+ setSetting("$HOME/Settings/Trolltech/locale.conf", "Language", "InputLanguages", "en_US de" );
+ \endcode
+
+ \sa getSetting(), QSettings
+*/
+void QSystemTest::setSetting( const QString &file, const QString &group, const QString &key, const QVariant &value )
+{
+ d->setSetting(QString(), QString(), file, group, key, value);
+}
+
+/*!
+ Set a QSettings settings \a value on the test system located in the settings file
+ for the given \a organization and \a application, as passed to a QSettings constructor.
+ The value set will be in settings group \a group, key \a key.
+
+ \sa getSetting(), QSettings
+*/
+void QSystemTest::setSetting( const QString &organization, const QString &application, const QString &group, const QString &key, const QVariant &value )
+{
+ d->setSetting(organization, application, QString(), group, key, value);
+}
+
+static QStringList filter = QStringList();
+
+class TestProcess : public QProcess
+{
+ Q_OBJECT
+ public:
+ TestProcess(QObject *parent = 0)
+ : QProcess(parent)
+ , env()
+ , test(0)
+ {
+ connect(this,SIGNAL(readyReadStandardError()),this,SLOT(error()));
+ connect(this,SIGNAL(readyReadStandardOutput()),this,SLOT(output()));
+ connect(this,SIGNAL(finished(int,QProcess::ExitStatus)),
+ this,SLOT(deleteLater()));
+ }
+
+ QStringList env;
+ QSystemTest* test;
+
+ private slots:
+ void output()
+ {
+ QByteArray text = readAllStandardOutput();
+ if (!test) return;
+
+ while (text.endsWith("\n")) text.chop(1);
+ QList<QByteArray> lines = text.split('\n');
+ test->applicationStandardOutput(lines);
+ }
+
+ void error()
+ {
+ QByteArray text = readAllStandardError();
+ if (!test) return;
+
+ while (text.endsWith("\n")) text.chop(1);
+ QList<QByteArray> lines = text.split('\n');
+ test->applicationStandardError(lines);
+ }
+
+ protected:
+ virtual void setupChildProcess()
+ {
+#if defined Q_OS_UNIX
+ // Get the base path from the environment.
+ static QString basePath = qgetenv("QTUITEST_BUILD_PATH");
+ static QString libPath = QString("%1/lib:%1/qtslave").arg(basePath);
+ prependToEnv("LD_LIBRARY_PATH", libPath.toLocal8Bit());
+#endif
+ foreach (QString const& e, env) {
+ int equals = e.indexOf('=');
+ if (equals == -1) continue;
+ QString key = e.left(equals);
+ QString value = e.mid(equals+1);
+ prependToEnv(key.toLocal8Bit(), value.toLocal8Bit());
+ }
+ }
+
+ private:
+ void prependToEnv(QByteArray const& key, QByteArray const& value)
+ {
+ // Environment variables which are a colon-separated list (like PATH)
+ static const QList<QByteArray> pathlike = QList<QByteArray>()
+ << "LD_LIBRARY_PATH"
+ ;
+
+ // Environment variables which can be silently clobbered
+ static const QList<QByteArray> clobber = QList<QByteArray>()
+ << "DISPLAY"
+ ;
+
+ QByteArray current = qgetenv(key.constData());
+ QByteArray set = value;
+ if (!current.isEmpty()) {
+ if (pathlike.contains(key)) {
+ set = set + ":" + current;
+ } else if (clobber.contains(key)) {
+ } else {
+ // Cannot use qWarning because we are in a child process and we will pass
+ // through message handlers twice
+ fprintf(stderr, "Environment variable %s is already set (to \"%s\"); "
+ "qtuitestrunner will clobber it (with \"%s\") when starting test "
+ "process!"
+ ,key.constData()
+ ,current.constData()
+ ,set.constData()
+ );
+ }
+ }
+#ifndef Q_OS_WIN
+ setenv(key.constData(), set.constData(), 1);
+#endif
+ }
+};
+
+/*! \internal */
+void QSystemTest::applicationStandardOutput(QList<QByteArray> const& lines)
+{
+ foreach (QByteArray const& line, lines)
+ QDebug(QtDebugMsg) << line;
+}
+
+/*! \internal */
+void QSystemTest::applicationStandardError(QList<QByteArray> const& lines)
+{
+ foreach (QByteArray const& line, lines)
+ QDebug(QtDebugMsg) << line;
+}
+
+/*!
+ Switches the 'strict syntax' checking mode for the System test to \a on.
+
+ In strict mode the following commands are no longer allowed and will cause an immediate failure:
+ \list
+ \i keyClick()
+ \i keyPress()
+ \i keyRelease()
+ \i keyClickHold()
+ \endlist
+
+ Strict mode also verifies that every 'Title' change is covered by a call to waitForTitle(): any
+ action that results in a Dialog to be shown (with a different title) will cause a test failure
+ unless a waitForTitle() is called on the next line of the test script.
+*/
+void QSystemTest::strict( bool on )
+{
+ d->strict_mode = on;
+}
+
+/*!
+ Simulates a \a key press for the application specified by \a queryPath.
+ \a key is a Qt::Key describing the key to be pressed.
+
+ Example:
+ \code
+ // Press (do not release) F23 key in current app
+ keyPress( Qt.Key_F23 );
+ \endcode
+
+ \sa {Query Paths}, {Keypad Simulation}
+*/
+void QSystemTest::keyPress( Qt::Key key, const QString &queryPath )
+{
+ if (d->strict_mode) QFAIL( "ERROR: keyPress is not allowed in strict mode" );
+
+ QTestMessage message("keyPress");
+ message["key"] = (int)key;
+ QString qp = queryPath;
+ if (qp.isEmpty()) qp = "";
+ d->queryPassed( "OK", "", BT(message), qp );
+}
+
+/*!
+ Simulates a \a key release for the application specified by \a queryPath.
+ \a key is a Qt::Key describing the key to be released.
+
+ Example:
+ \code
+ // Release Up key in current app
+ keyRelease( Qt.Key_Up );
+ \endcode
+
+ \sa {Query Paths}, {Keypad Simulation}
+*/
+void QSystemTest::keyRelease( Qt::Key key, const QString &queryPath )
+{
+ if (d->strict_mode) QFAIL( "ERROR: keyRelease is not allowed in strict mode" );
+
+ QTestMessage message("keyRelease");
+ message["key"] = (int)key;
+ QString qp = queryPath;
+ if (qp.isEmpty()) qp = "";
+ d->queryPassed( "OK", "", BT(message), qp );
+}
+
+/*!
+ Simulates a \a key click (press and release) for the application specified by \a queryPath.
+ \a key is a string describing the key to be released.
+
+ Example:
+ \code
+ // Go right 5 times, then select
+ for (int i = 0; i < 5; ++i) keyClick( Qt.Key_Right );
+ keyClick( Qt.Key_Select );
+ \endcode
+
+ \sa {Query Paths}, {Keypad Simulation}
+*/
+void QSystemTest::keyClick( Qt::Key key, const QString &queryPath )
+{
+ if (d->strict_mode) QFAIL( "ERROR: keyClick is not allowed in strict mode" );
+
+ QTestMessage message("keyClick");
+ message["key"] = (int)key;
+ QString qp = queryPath;
+ if (qp.isEmpty()) qp = "";
+ d->queryPassed( "OK", "", BT(message), qp );
+}
+
+/*!
+ Simulates a \a key click and hold (press + wait + release) for \a queryPath.
+ The interval between press and release is set in milliseconds by \a duration.
+
+ Example:
+ \code
+ // Hold hangup key to bring up shutdown app
+ keyClickHold(Qt.Key_Hangup, 3000);
+ \endcode
+
+ \sa {Query Paths}, {Keypad Simulation}
+*/
+void QSystemTest::keyClickHold( Qt::Key key, int duration, const QString &queryPath )
+{
+ if (d->strict_mode) QFAIL( "ERROR: keyClickHold is not allowed in strict mode" );
+
+ d->keyclickhold_key = key;
+ d->keyclickhold_path = queryPath;
+
+ QTestMessage message("keyPress");
+ message["key"] = (int)key;
+ message["duration"] = duration;
+ QString qp = queryPath;
+ if (qp.isEmpty()) qp = "";
+ d->queryPassed( "OK", "", BT(message), qp );
+
+ if (queryFailed()) return;
+
+ QTest::qWait(duration);
+
+ if (d->keyclickhold_key) {
+ d->keyclickhold_key = (Qt::Key)0;
+ d->keyclickhold_path = "";
+
+ keyRelease(key, queryPath);
+ }
+}
+
+/*!
+ Simulates a mouse click / touchscreen tap at co-ordinates ( \a x, \a y ).
+
+ Example:
+ \code
+ mouseClick(200, 300);
+ \endcode
+
+ \sa {Query Paths}, {Mouse / Touchscreen Simulation}
+*/
+void QSystemTest::mouseClick( int x, int y, QFlags<Qt::MouseButton> buttons )
+{
+ mouseClick(QPoint(x, y), buttons);
+}
+
+/*!
+ Simulates a mouse click / touchscreen tap at \a point.
+
+ Example:
+ \code
+ mouseClick( new QPoint(200, 300) );
+ \endcode
+
+ \sa {Query Paths}, {Mouse / Touchscreen Simulation}
+*/
+void QSystemTest::mouseClick( const QPoint &point, QFlags<Qt::MouseButton> buttons )
+{
+ if (d->strict_mode) QFAIL( "ERROR: mouseClick is not allowed in strict mode" );
+ QTestMessage message("mouseClick");
+ message["pos"] = point;
+ message["buttons"] = (int)buttons;
+ d->queryPassed( "OK", "", BT(message) );
+}
+
+/*!
+ Simulates a mouse click / touchscreen tap at the center of the widget
+ specified by \a queryPath.
+
+ Example:
+ \code
+ // Click on Accept button
+ mouseClick("Accept");
+ \endcode
+
+ \sa {Query Paths}, {Mouse / Touchscreen Simulation}
+*/
+void QSystemTest::mouseClick( const QString &queryPath, QFlags<Qt::MouseButton> buttons )
+{
+ if (d->strict_mode) QFAIL( "ERROR: mouseClick is not allowed in strict mode" );
+ QTestMessage message("mouseClick");
+ message["buttons"] = (int)buttons;
+ d->queryPassed( "OK", "", BT(message), queryPath );
+ wait(200);
+}
+
+/*!
+ Simulates a mouse click / touchscreen tap at co-ordinates ( \a x, \a y ),
+ with a custom \a duration in milliseconds between press and release.
+
+ Example:
+ \code
+ // Hold at (200, 300) for three seconds
+ mouseClickHold(200, 300, 3000);
+ \endcode
+
+ \sa {Query Paths}, {Mouse / Touchscreen Simulation}
+*/
+void QSystemTest::mouseClickHold( int x, int y, int duration, QFlags<Qt::MouseButton> buttons )
+{
+ mouseClickHold(QPoint(x, y), duration, buttons);
+}
+
+/*!
+ Simulates a mouse click / touchscreen tap at \a point,
+ with a custom \a duration in milliseconds between press and release.
+
+ Example:
+ \code
+ // Hold at (200, 300) for three seconds
+ mouseClickHold( new QPoint(200, 300), 3000 );
+ \endcode
+
+ \sa {Query Paths}, {Mouse / Touchscreen Simulation}
+*/
+void QSystemTest::mouseClickHold( const QPoint &point, int duration, QFlags<Qt::MouseButton> buttons )
+{
+ if (d->strict_mode) QFAIL( "ERROR: mouseClickHold is not allowed in strict mode" );
+
+ mousePress(point, buttons);
+ QTest::qWait(duration);
+ mouseRelease(point, buttons);
+}
+
+/*!
+ Simulates a mouse click / touchscreen tap at the center of the widget
+ specified by \a queryPath, with a custom \a duration in milliseconds
+ between press and release.
+
+ Example:
+ \code
+ // Hold on the "Shutdown" button for three seconds
+ mouseClickHold("Shutdown", 3000);
+ \endcode
+
+ \sa {Query Paths}, {Mouse / Touchscreen Simulation}
+*/
+void QSystemTest::mouseClickHold( const QString &queryPath, int duration, QFlags<Qt::MouseButton> buttons )
+{
+ if (d->strict_mode) QFAIL( "ERROR: mouseClickHold is not allowed in strict mode" );
+
+ mousePress(queryPath, buttons);
+ QTest::qWait(duration);
+ mouseRelease(queryPath, buttons);
+}
+
+/*!
+ Simulates a mouse / touchscreen press at co-ordinates ( \a x, \a y ).
+
+ Example:
+ \code
+ mousePress(200, 300);
+ \endcode
+
+ \sa {Query Paths}, {Mouse / Touchscreen Simulation}
+*/
+void QSystemTest::mousePress( int x, int y, QFlags<Qt::MouseButton> buttons )
+{
+ mousePress(QPoint(x, y), buttons);
+}
+
+/*!
+ Simulates a mouse / touchscreen press at \a point.
+
+ Example:
+ \code
+ mousePress( new QPoint(200, 300) );
+ \endcode
+
+ \sa {Query Paths}, {Mouse / Touchscreen Simulation}
+*/
+void QSystemTest::mousePress( const QPoint &point, QFlags<Qt::MouseButton> buttons )
+{
+ if (d->strict_mode) QFAIL( "ERROR: mousePress is not allowed in strict mode" );
+
+ QTestMessage message("mousePress");
+ message["pos"] = point;
+ message["buttons"] = (int)buttons;
+ d->queryPassed( "OK", "", BT(message) );
+}
+
+/*!
+ Simulates a mouse / touchscreen press at the center of the widget
+ specified by \a queryPath.
+
+ Example:
+ \code
+ // Press "Edit" button
+ mousePress("Edit");
+ \endcode
+
+ \sa {Query Paths}, {Mouse / Touchscreen Simulation}
+*/
+void QSystemTest::mousePress( const QString &queryPath, QFlags<Qt::MouseButton> buttons )
+{
+ if (d->strict_mode) QFAIL( "ERROR: mousePress is not allowed in strict mode" );
+
+ QTestMessage message("mousePress");
+ message["buttons"] = (int)buttons;
+ d->queryPassed( "OK", "", BT(message), queryPath );
+}
+
+/*!
+ Simulates a mouse / touchscreen release at co-ordinates ( \a x, \a y ).
+
+ Example:
+ \code
+ mouseRelease(200, 300);
+ \endcode
+
+ \sa {Query Paths}, {Mouse / Touchscreen Simulation}
+*/
+void QSystemTest::mouseRelease( int x, int y, QFlags<Qt::MouseButton> buttons )
+{
+ mouseRelease(QPoint(x, y), buttons);
+}
+
+/*!
+ Simulates a mouse / touchscreen release at \a point.
+
+ Example:
+ \code
+ mouseRelease( new QPoint(200, 300) );
+ \endcode
+
+ \sa {Query Paths}, {Mouse / Touchscreen Simulation}
+*/
+void QSystemTest::mouseRelease( const QPoint &point, QFlags<Qt::MouseButton> buttons )
+{
+ if (d->strict_mode) QFAIL( "ERROR: mouseRelease is not allowed in strict mode" );
+
+ QTestMessage message("mouseRelease");
+ message["buttons"] = (int)buttons;
+ message["pos"] = point;
+ d->queryPassed( "OK", "", BT(message) );
+}
+
+/*!
+ Simulates a mouse / touchscreen release at the center of the widget
+ specified by \a queryPath.
+
+ Example:
+ \code
+ // Release mouse over "Edit" button
+ mouseRelease("Edit");
+ \endcode
+
+ \sa {Query Paths}, {Mouse / Touchscreen Simulation}
+*/
+void QSystemTest::mouseRelease( const QString &queryPath, QFlags<Qt::MouseButton> buttons )
+{
+ if (d->strict_mode) QFAIL( "ERROR: mouseRelease is not allowed in strict mode" );
+
+ QTestMessage message("mouseRelease");
+ message["buttons"] = (int)buttons;
+ d->queryPassed( "OK", "", BT(message), queryPath );
+}
+
+/*!
+ Simulates \a value being entered into the widget specified by \a queryPath.
+
+ Some widgets go into an editing mode when entering text and need to be taken
+ out of the editing mode by e.g. a Qt::Key_Select or by navigating to
+ another field in the dialog. By default, enter() will automatically take whatever
+ action is necessary to commit the text and leave edit mode. Set \a mode to NoCommit to
+ override this.
+
+ Example:
+ \code
+ // Enter my job in "Occupation" field
+ enter( "Dog Walker", "Occupation" );
+
+ // Enter date of birth in "Birthday" field
+ enter( new Date(1985, 11, 10), "Birthday" );
+
+ // Enter start time in "Start" field
+ enter( new QTime(11, 30), "Start" );
+ \endcode
+
+ \sa {Query Paths}, {Keypad Simulation}
+*/
+void QSystemTest::enter( const QVariant &value, const QString &queryPath, EnterMode mode )
+{
+ if (value.isNull()) return;
+ QTestMessage message("enter");
+ message["value"] = value;
+
+ switch (mode)
+ {
+ case NoCommit: message["mode"] = "NoCommit"; break;
+ default: message["mode"] = "Commit"; break;
+ }
+
+ d->queryPassed( "OK", "", BT(message), queryPath );
+}
+
+/*!
+ Selects the \a item from the application/widget specified by \a queryPath.
+ This can be used to, e.g., select a certain item from a list widget or combo box.
+ select() works with widgets which are conceptually a list, including
+ list views, combo boxes and menus.
+
+ When used with a list widget, the specified item is navigated to and no further
+ action is taken.
+
+ When used with a combo box, the drop-down list is opened,
+ the item is selected, and the drop-down list is closed again.
+
+ Items in submenus are denoted using '/' delimiters (e.g., "View/All" means
+ navigate to the "View" submenu, then the "All" item). Menu items which
+ have a '/' in their name can be escaped using '\' (e.g. "Add\\/Remove Words").
+
+ Example:
+ \code
+ // Select "Female" from "Gender" field
+ select("Female", "Gender");
+ \endcode
+
+ \sa {Query Paths}, {Keypad Simulation}
+*/
+void QSystemTest::select( const QString &item, const QString &queryPath )
+{
+ if (item.isNull()) return;
+ QTestMessage message("select");
+ message["text"] = item;
+ d->queryPassed("OK", "", BT(message), queryPath);
+
+ /* FIXME: this wait should be able to be put in the test widgets.
+ * Currently it can't because of the new bop problem (bug 194361).
+ */
+ wait((d->demo_mode) ? 1500 : 150);
+}
+
+/*!
+ Selects the item with \a index from an indexed widget (such as a QAbstractItemView)
+ specified by \a queryPath.
+
+ This function is lower level than using select(), but is more appropriate when there
+ are large numbers of items in the view, or the view contains unnamed or ambiguously
+ named items.
+
+ The \a index is specified as a list of row and column values.
+
+ Example:
+ \code
+ // Select item (row 2, column 3) from table view
+ select( [2, 3], table );
+ \endcode
+
+ The index may be hierarchical, in which case the row and column values should be
+ specified as [row, column, parentRow, parentColumn, ...].
+
+ \sa select(), selectedIndex()
+*/
+void QSystemTest::selectIndex( const QVariantList &index, const QString &queryPath )
+{
+ QTestMessage message("selectIndex");
+ message["index"] = index;
+ d->queryPassed("OK", "", BT(message), queryPath);
+
+ /* FIXME: this wait should be able to be put in the test widgets.
+ * Currently it can't because of the new bop problem (bug 194361).
+ */
+ wait((d->demo_mode) ? 1500 : 150);
+}
+
+
+/*!
+ Returns the currently selected index of an indexed widget specified by \a queryPath.
+ The index is returned as an array to QtScript, in the format required for selectIndex().
+
+ \sa selectIndex()
+*/
+QVariantList QSystemTest::getSelectedIndex( const QString &queryPath )
+{
+ QVariantList ret;
+ return queryWithReturn(ret, "getSelectedIndex", queryPath);
+}
+
+/*!
+ Activate the widget specified by \a queryPath.
+ This is typically used to activate button widgets.
+
+ \sa {Query Paths}
+*/
+void QSystemTest::activate( const QString &queryPath )
+{
+ QTestMessage message("activate");
+ d->queryPassed("OK", "", BT(message), queryPath);
+
+ /* FIXME: this wait should be able to be put in the test widgets.
+ * Currently it can't because of the new bop problem (bug 194361).
+ */
+ wait((d->demo_mode) ? 1500 : 150);
+}
+
+/*!
+ Make sure the specified \a item is visible in the widget specified by \a queryPath.
+ The action taken depends on the widget, but may for example involve moving the
+ widget's scrollbars.
+
+ \sa {Query Paths}
+*/
+void QSystemTest::ensureVisible( const QString &item, const QString &queryPath )
+{
+ if (item.isNull()) return;
+ QTestMessage message("ensureVisible");
+ message["item"] = item;
+ d->queryPassed("OK", "", BT(message), queryPath);
+
+ /* FIXME: this wait should be able to be put in the test widgets.
+ * Currently it can't because of the new bop problem (bug 194361).
+ */
+ wait((d->demo_mode) ? 1500 : 150);
+}
+
+/*!
+ Start the specified \a application.
+
+ \a application is the combined path and arguments of a program to launch.
+ The application must connect to the test framework within \a timeout ms or
+ the test fails.
+
+ \a flags specifies additional behaviour.
+
+ \sa {Application Management}
+*/
+void QSystemTest::startApplication( const QString &application, const QStringList &arguments, int timeout, StartApplicationFlags flags )
+{
+ QString app = d->processEnvironment(application);
+ QStringList args = d->processEnvironment(arguments);
+
+ if (!runsOnDevice()) {
+ // Running locally
+ if (!(flags & BackgroundCurrentApplication)) {
+ // If we aren't backgrounding the current app, then we want to kill it.
+ while (d->aut.count()) {
+ QPointer<QProcess> aut = d->aut.takeFirst();
+ if (aut) {
+ aut->terminate();
+ if (!aut->waitForFinished(5000)) {
+ aut->kill();
+ aut->waitForFinished(5000);
+ }
+ delete aut;
+ }
+ }
+ }
+
+ TestProcess* proc = new TestProcess(this);
+ proc->test = this;
+ proc->env = d->env;
+ proc->env << QString("QTUITEST_PORT=%1").arg(d->aut_port);
+
+ #ifdef Q_OS_MAC
+ args << QString("-style=qtuitest");
+ #elif defined Q_OS_WIN
+ args << QString("-style=qtuitest");
+ #elif defined Q_OS_UNIX
+ args << QString("-style=qtuitest");
+ #endif
+
+ QByteArray defArgs = qgetenv("QTUITEST_DEFAULT_AUT_ARGS");
+ if (defArgs.length()) {
+ QList<QByteArray> defaultArgs = defArgs.split(' ');
+ foreach (QByteArray arg, defaultArgs) {
+ args << arg;
+ }
+ }
+ // For WinCE it does not support env variables
+ args << "-autport" << QString::number(d->aut_port);
+
+ proc->start(app, args);
+ if (!proc->waitForStarted()) {
+ fail(QString("Failed to start process '%1': %2").arg(app).arg(proc->errorString()));
+ delete proc;
+ return;
+ }
+
+ // Give it a little time for the slave to come up.
+ wait(3000);
+
+ if (!connectToAut(timeout)) {
+ fail(QString("Could not connect to process '%1'.").arg(app));
+ proc->terminate();
+ proc->waitForFinished(5000);
+ proc->kill();
+ delete proc;
+ return;
+ }
+
+ d->aut << QPointer<QProcess>(proc);
+
+ } else {
+ // Running on device
+ qLog(QtUitest) << "Running on device...";
+
+ QProcess proc;
+
+ if (!(flags & BackgroundCurrentApplication)) {
+ // If we aren't backgrounding the current app, then we want to kill it.
+ while (d->remote_aut.count()) {
+ QString aut = d->remote_aut.takeFirst();
+ QStringList args;
+ args << aut;
+ qWarning(QString("Stopping remote process %1").arg(aut).toLatin1().constData());
+ static QByteArray stopProcess = qgetenv("QTUITEST_STOP_PROCESS");
+ if (stopProcess.isEmpty()) {
+ fail(QString("Could not stop remote process '%1', QTUITEST_STOP_PROCESS not defined.").arg(app));
+ }
+ proc.start(stopProcess, args);
+ if (!proc.waitForFinished(10000)) {
+ proc.kill();
+ proc.waitForFinished(5000);
+ }
+ d->test_app->disconnect();
+ }
+ }
+
+ args.prepend(app);
+ static QByteArray startProcess = qgetenv("QTUITEST_START_PROCESS");
+ if (startProcess.isEmpty()) {
+ fail(QString("Could not start remote process '%1', QTUITEST_START_PROCESS not defined.").arg(app));
+ }
+ proc.start(startProcess, args);
+ if (!proc.waitForFinished(10000)) {
+ proc.kill();
+ proc.waitForFinished(5000);
+ }
+
+ if (!connectToAut(timeout)) {
+ fail(QString("Could not connect to remote process '%1'.").arg(app));
+ }
+ d->remote_aut << app;
+ }
+}
+
+/*!
+ Returns true if the widget specified by \a queryPath exists and is currently visible
+ to the user.
+
+ The widget is considered to be visible to the user if QWidget::visibleRegion() returns
+ a non-empty region. Thus, isVisible() will return true if even a single pixel of the
+ widget is unobscured.
+
+ \sa {Query Paths}, {Querying Objects}
+*/
+bool QSystemTest::isVisible( const QString &queryPath )
+{
+ bool ret = false;
+ return queryWithReturn(ret, "isVisible", queryPath);
+}
+
+/*!
+ The function returns whether the widget specified by \a queryPath is enabled.
+
+ Example:
+ \code
+ // Verify the AM/PM field is disabled when using 24 hour format
+ select("24 hour", "Time format");
+ verify( !isEnabled("AM-PM"), "AM-PM field still enabled." );
+ \endcode
+
+ \sa {Query Paths}, {Querying Objects}
+*/
+bool QSystemTest::isEnabled( const QString &queryPath )
+{
+ return getProperty( queryPath, "enabled" ).toBool();
+}
+
+/*!
+ \internal
+ Returns a string of all the visible widgets that are children of the object specified by \a queryPath.
+ If only the application part of \a queryPath is defined, then all visible widgets for that application
+ are listed. The string is organized in a tree type hierarchy showing the relationship between
+ widgets.
+
+ This function is intended to help with the development of testcases.
+
+ \sa {Query Paths}
+*/
+QString QSystemTest::activeWidgetInfo()
+{
+ QString ret;
+ return queryWithReturn(ret, "activeWidgetInfo", "");
+}
+
+/*!
+ Returns the checked state of the checkbox-like widget specified by \a queryPath.
+ Checkbox-like widgets include QCheckBox and anything inheriting QAbstractButton.
+
+ \sa {Query Paths}, {Querying Objects}, setChecked(), checkState()
+*/
+bool QSystemTest::isChecked( const QString &queryPath )
+{
+ bool ret = false;
+ return queryWithReturn(ret, "isChecked", queryPath);
+}
+
+/*!
+ Returns the checked state of \a item in the widget specified by \a queryPath.
+
+ \sa {Query Paths}, {Querying Objects}, setChecked(), checkState()
+*/
+bool QSystemTest::isChecked( const QString &item, const QString &queryPath )
+{
+ if (item.isNull()) return false;
+ QTestMessage message("isChecked");
+ QTestMessage reply;
+ message["item"] = item;
+ if (!d->queryPassed("OK", "", BT(message), queryPath, &reply)) return false;
+ return reply["isChecked"].toBool();
+}
+
+/*!
+ Based on the value of \a doCheck checks or un-checks a checkbox-like widget specified by \a queryPath.
+ Checkbox-like widgets include QCheckBox and anything inheriting QAbstractButton.
+
+ \sa {Query Paths}, {Querying Objects}, isChecked(), setCheckState()
+*/
+void QSystemTest::setChecked( bool doCheck, const QString &queryPath)
+{
+ QTestMessage message("setChecked");
+ message["doCheck"] = doCheck;
+ d->queryPassed("OK", "", BT(message), queryPath);
+}
+
+/*!
+ Based on the value of \a doCheck checks or un-checks \a item in the widget specified by \a queryPath.
+
+ \sa {Query Paths}, {Querying Objects}, isChecked(), setCheckState()
+*/
+void QSystemTest::setChecked( bool doCheck, const QString &item, const QString &queryPath)
+{
+ QTestMessage message("setChecked");
+ message["doCheck"] = doCheck;
+ message["item"] = item;
+ d->queryPassed("OK", "", BT(message), queryPath);
+}
+
+/*!
+ Returns the checked state of the checkbox-like widget specified by \a queryPath.
+ Checkbox-like widgets include QCheckBox and anything inheriting QAbstractButton.
+
+ \sa {Query Paths}, {Querying Objects}, isChecked(), setCheckState()
+*/
+int QSystemTest::checkState( const QString &queryPath )
+{
+ int ret = Qt::Unchecked;
+ return queryWithReturn(ret, "checkState", queryPath);
+}
+
+/*!
+ Sets the check state of a checkbox-like widget specified by \a queryPath to \a state.
+ Checkbox-like widgets include QCheckBox and anything inheriting QAbstractButton.
+
+ Example:
+ \code
+ // Set tri-state button to partially checked state
+ setCheckState(Qt.PartiallyChecked, "Tri-state button");
+ \endcode
+
+ \sa {Query Paths}, {Querying Objects}, checkState(), setChecked()
+*/
+void QSystemTest::setCheckState( int state, const QString &queryPath)
+{
+ QTestMessage message("setCheckState");
+ message["state"] = state;
+ d->queryPassed("OK", "", BT(message), queryPath);
+}
+
+/*!
+ Returns the signature of the widget that is associated with \a labelText.
+
+ If \a offset is a number != 0 the query will return the n'th next or previous widget (excluding labels). The widgets are ordered from
+ top to bottom, left to right. A positive offset indicates a widget to the right or below, a negative offset indicates a widget to
+ the left or above the label.
+
+ This function can be used for situations where a field doesn't have a label associated with it.
+
+ \sa {Query Paths}, {Querying Objects}, {QObject::inherits()}
+*/
+QString QSystemTest::signature( const QString &labelText, int offset )
+{
+ QTestMessage message("widget");
+ message["offset"] = offset;
+ QTestMessage reply;
+ if (!d->queryPassed("OK", "", BT(message), labelText, &reply)) return "";
+ return reply["widget"].toString();
+}
+
+/*!
+ List the contents of directory \a dir on the test system, applying \a filters to the listing.
+ If \a dir contains environment variables, they will be expanded on the test system.
+
+ The returned listing will be relative to \a dir.
+
+ Example:
+ \code
+ // Delete entire contents of Documents directory on the test system
+ var list = getDirectoryEntries( documentsPath(), QDir.AllEntries);
+ for (var i = 0; i < list.length; ++i) {
+ deletePath( documentsPath() + list[i]);
+ }
+ \endcode
+
+ \sa QDir::entryList(), {File Management}
+*/
+QStringList QSystemTest::getDirectoryEntries( const QString &dir, QDir::Filters filters )
+{
+ QTestMessage message("getDirectoryEntries");
+ message["path"] = dir;
+ message["filters"] = (int)filters;
+
+ QStringList out;
+ QTestMessage reply;
+ if (!d->queryPassed( "OK", "", BT(message), "", &reply)) return out;
+ if (reply["getDirectoryEntries"].isNull()) {
+ setQueryError("Got no data in response to getDirectoryEntries");
+ return out;
+ }
+ out = reply["getDirectoryEntries"].toStringList();
+ return out;
+}
+
+/*!
+ Returns the current date and time of the test system.
+*/
+QDateTime QSystemTest::getDateTime()
+{
+ QDateTime ret;
+ return queryWithReturn(ret, "systemTime", "");
+}
+
+/*!
+ Returns true if the test is running on an actual device, and false if it is running locally.
+*/
+bool QSystemTest::runsOnDevice()
+{
+ return d->aut_host != "127.0.0.1";
+}
+
+/*!
+ Wait for \a msecs milliseconds, while still processing events from the event loop.
+*/
+void QSystemTest::wait(int msecs)
+{
+ QTest::qWait(msecs);
+}
+
+/*!
+ Returns the currently set Visual Response Time. This time is used in QtUiTest to decide whether the User
+ Interface is responsive to user events. For instance, after selecting "New Event" from the options menu a user
+ expects a dialog in which a new event can be entered. If the Application Under Test does not respond in some
+ visible way within the visual response time, the test will fail.
+
+ By default the visual response time is set to 4 seconds, i.e. any UI that doesn't respond to events within this time
+ is considered at fault.
+
+ The visibleResponseTime is also used as the default value for some queries such as waitForTitle().
+
+ \sa setVisibleResponseTime(), waitForTitle()
+*/
+int QSystemTest::visibleResponseTime()
+{
+ return d->visible_response_time;
+}
+
+/*!
+ Sets the Visual Response Time to \a time.
+
+ \sa visibleResponseTime(), waitForTitle()
+*/
+void QSystemTest::setVisibleResponseTime( int time )
+{
+ if (d->visible_response_time != time) {
+ qLog(QtUitest) << "Need to set a new visual response time" ;
+ }
+ d->visible_response_time = time;
+}
+
+/*!
+ Take a full screenshot and save it as \a name.
+ The screenshot will be placed in the test data directory in PNG format,
+ and will automatically have .png appended to the name.
+
+ This function is intended to be used as a simple way to automate the
+ gathering of screenshots, i.e. to be used in documentation and such.
+
+ If a \a queryPath is specified the snapshot will be limited to the Widget
+ that is identified by the queryPath.
+
+ \sa verifyImage()
+*/
+void QSystemTest::saveScreen(const QString &name, const QString &queryPath)
+{
+ QString cdp = currentDataPath();
+ if (!QDir("/").exists(cdp) && !QDir("/").mkpath(cdp)) QFAIL(QString("Path '' didn't exist and I couldn't create it").arg(cdp));
+ QImage img;
+ img = grabImage(queryPath);
+ if (queryFailed()) return;
+ if (img.isNull()) QFAIL( "AUT returned a null screenshot." );
+ if (!img.save(cdp + "/" + name + ".png", "PNG")) QFAIL(QString("Couldn't save image '%1' to '%2'").arg(name).arg(cdp) );
+}
+
+
+/*!
+ \fn QSystemTest::expectMessageBox(String title, String text, String option, Number timeout)
+ Denotes the start of a block of code which, immediately after or during execution, should
+ cause a message box to pop up with the given \a title and \a text. When the message box
+ appears, the given menu \a option will be chosen from the message box softmenu bar (if one exists).
+
+ If the message box hasn't appeared by the end of the block of code, the test will
+ wait until the \a timeout expires. If it still doesn't appear, the current test fails.
+
+ If a message box appears which hasn't been marked as expected, the current test fails.
+
+ Example:
+ \code
+ // Delete a contact - select "Yes" on the popped-up message box
+ // If the message box doesn't pop up, the test fails.
+ expectMessageBox("Contacts", "Are you sure you want to delete: " + contact_name + "?", "Yes") {
+ select("Delete contact", optionsMenu());
+ }
+ \endcode
+*/
+
+/*!
+ Indicate to the test framework if the application under test is expected to close.
+
+ If \a value is true, the test framework will not report a failure when it loses its connection to the application.
+ If \a value is false, unexpected application terminations will result in a test failure.
+
+ Example:
+ \code
+ expectApplicationClose( true );
+ select( "Close" ); // Selecting this causes the current application to close
+ expectApplicationClose( false ); // Resume normal checking
+ \endcode
+*/
+void QSystemTest::expectApplicationClose( bool value )
+{
+ d->expect_app_close = value;
+}
+
+/*!
+ \internal
+ Processes the command line parameters.
+*/
+void QSystemTest::processCommandLine( int &argc, char *argv[] )
+{
+ int offset = 0;
+
+ // Whenever we discover an option that 'we' understand, eat away the option (and its parameters) so that QTest doesn't get
+ // confused by them.
+ for (int i=1; i<argc; ++i) {
+
+ if ( !strcasecmp(argv[i], "-remote") ) {
+ argv[i] = 0;
+ ++offset;
+
+ if ( i+1 >= argc || !strlen(argv[i+1]) )
+ qFatal("Expected a host:port argument after -remote");
+
+ QString host_port( argv[i+1] );
+ QStringList host_port_parts = host_port.split(":");
+
+ bool ok = (host_port_parts.count() == 2);
+ int port = -1;
+ QString host;
+ if (ok) port = host_port_parts[1].toInt(&ok);
+ if (ok) host = host_port_parts[0];
+ ok = ok && port > 0 && port < 65536 && !host.isEmpty();
+
+ if (!ok)
+ qFatal("'%s' is not a valid host:port argument", qPrintable(host_port));
+
+ argv[i+1] = 0;
+ ++offset;
+ ++i;
+
+ d->qtest_ide.openRemote( host, port );
+ connect(&d->qtest_ide, SIGNAL(abort()), this, SLOT(abortTest()));
+
+ } else if ( !strcasecmp(argv[i], "-autip") || !strcasecmp(argv[i], "-authost") ) {
+ char *given_arg = argv[i]; // so we can output 'autip' or 'authost' in error messages
+
+ argv[i] = 0;
+ ++offset;
+ if ( i+1 >= argc || !strlen(argv[i+1]) )
+ qFatal("Expected a host specifier after %s", given_arg);
+
+ d->aut_host = argv[i+1];
+ argv[i+1] = 0;
+ ++offset;
+ ++i;
+
+ } else if ( !strcasecmp(argv[i], "-autport") ) {
+ argv[i] = 0;
+ ++offset;
+ if ( i+1 >= argc || !strlen(argv[i+1]) )
+ qFatal("Expected a port specifier after -autport");
+
+ bool ok;
+ d->aut_port = QString(argv[i+1]).toUShort( &ok );
+ if (!ok)
+ qFatal("%s is not a valid port specifier", argv[i+1]);
+
+ argv[i+1] = 0;
+ ++offset;
+ ++i;
+
+ } else if ( !strcasecmp(argv[i], "-keepaut") ) {
+ argv[i] = 0;
+ ++offset;
+ d->keep_aut = true;
+
+ } else if ( !strcasecmp(argv[i], "-silentaut") ) {
+ argv[i] = 0;
+ offset++;
+ d->silent_aut = true;
+
+ } else if ( !strcasecmp(argv[i], "-noaut") ) {
+ argv[i] = 0;
+ offset++;
+ d->no_aut = true;
+
+ } else if ( !strcasecmp(argv[i], "-auto") ) {
+ argv[i] = 0;
+ offset++;
+ d->auto_mode = true;
+
+ } else if ( !strcasecmp(argv[i], "-env") ) {
+ argv[i] = 0;
+ offset++;
+
+ if ( i+1 >= argc || !strlen(argv[i+1]) )
+ qFatal("Expected a string after -env");
+
+ d->env << QString::fromLocal8Bit(argv[i+1]);
+ argv[i+1] = 0;
+ ++offset;
+ ++i;
+
+ } else if ( !strcasecmp(argv[i], "-demomode") ) {
+ argv[i] = 0;
+ offset++;
+ d->demo_mode = true;
+
+ } else if ( !strcasecmp(argv[i], "-verbose-perf") ) {
+ argv[i] = 0;
+ offset++;
+ d->verbose_perf = true;
+
+ } else if ( !strcasecmp(argv[i], "-v") ) {
+ argv[i] = 0;
+ offset++;
+ d->verbose = true;
+
+ } else {
+ if (offset > 0) {
+ argv[i-offset] = argv[i];
+ argv[i] = 0;
+ }
+ }
+ }
+ argc-=offset;
+
+ QAbstractTest::processCommandLine(argc, argv);
+
+ if (d->auto_mode && learnMode() != LearnNone) {
+ qWarning("Can't learn in auto mode; learn options ignored.");
+ }
+ if (!d->auto_mode && learnMode() == LearnNone) {
+ setLearnMode(LearnNew);
+ }
+}
+
+/*!
+ \internal
+ Starts event recording. While event recording is busy a dialog will be visible that shows all recorded events and also
+ enables the user to stop the recording session. \a file and \a line specifies the location in a source file where event
+ recording commenced.
+
+ If \a manualSteps are specified the dialog will have an additional field showing all the manual steps.
+
+ Don't use this, use prompt() instead.
+*/
+bool QSystemTest::recordEvents( const QString &manualSteps, bool gui )
+{
+ if (d->auto_mode && gui) {
+ skip("Can't record events in auto mode.", SkipSingle );
+ return false;
+ }
+
+ d->recorded_events_edit = 0;
+ d->recorded_code = QString();
+ if (!d->queryPassed( "OK", "", QTestMessage("startEventRecording"))) return false;
+ if (gui) {
+ if (d->qtest_ide.isConnected()) {
+ QTestMessage message("EVENT_RECORDING_STARTED");
+ message["file"] = currentFile();
+ message["line"] = currentLine();
+ message["steps"] = manualSteps;
+ d->qtest_ide.postMessage( message );
+ d->qtest_ide.must_stop_event_recording = false;
+ d->qtest_ide.event_recording_aborted = false;
+ d->recording_events = true;
+ while (!d->qtest_ide.must_stop_event_recording) {
+ QTest::qWait( 50 );
+ }
+ d->recording_events = false;
+ if (d->qtest_ide.event_recording_aborted) {
+ skip("Event recording aborted.", SkipSingle );
+ }
+ } else {
+ QDialog recordWindow;
+ Ui::RecordDialog ui;
+ ui.setupUi(&recordWindow);
+
+ if (!manualSteps.isEmpty()) {
+ ui.steps_view->setPlainText( manualSteps );
+ } else {
+ ui.steps_view->hide();
+ ui.steps_label->hide();
+ }
+
+ d->recorded_events_edit = ui.codeEdit;
+
+ connect( ui.abort_button, SIGNAL(clicked()), &recordWindow, SLOT(close()) );
+ connect( ui.abort_button, SIGNAL(clicked()), this, SLOT(abortPrompt()) );
+ abort_prompt = false;
+
+ d->recording_events = true;
+ recordWindow.exec();
+ d->recording_events = false;
+ if (abort_prompt) {
+ return false;
+ }
+
+ }
+ return d->queryPassed( "OK", "", QTestMessage("stopEventRecording"));
+ }
+ return true;
+}
+
+/*!
+ \internal
+ Stops recording events, returning the generated code from event recording.
+ Used internally for testing event recording.
+*/
+QString QSystemTest::stopRecordingEvents()
+{
+ d->queryPassed( "OK", "", QTestMessage("stopEventRecording"));
+ return d->recorded_code;
+}
+
+/*!
+ Displays a dialog with the \a promptText and Pass/Fail/Record buttons, then waits for a response from the user.
+ If Pass is clicked, the test will continue.
+ If Fail is clicked, a failure will be generated and the current testcase will abort.
+ If Record is clicked, event recording will start and recorded events can be appended to the testcase once recording is
+ finished.
+
+ This function is intended to be used for verification of testcases that cannot be fully automated. Testcases containing
+ this function will be skipped if the test is run with the \c -auto option.
+
+ Example:
+ \code
+ prompt( "Did something totally amazing just happen?" );
+ \endcode
+*/
+void QSystemTest::prompt( const QString &promptText )
+{
+ d->prompt_count++;
+
+ if (d->auto_mode) {
+ skip("Manual test skipped", SkipSingle);
+ return;
+ }
+
+ if (promptText.isEmpty()) {
+ recordEvents( "" );
+ return;
+ }
+
+ int level1_count = 0;
+ int level2_count = 0;
+ int level3_count = 0;
+ QStringList prompt_text = promptText.split("\n");
+ for (int i=0; i<prompt_text.count(); i++) {
+ if (prompt_text[i].startsWith("* ")) {
+ prompt_text[i] = QString("%1. %2").arg(++level1_count).arg(prompt_text[i].mid(1));
+ level2_count=0;
+ } else if (prompt_text[i].startsWith("** ")) {
+ prompt_text[i] = QString(" %1. %2").arg(++level2_count).arg(prompt_text[i].mid(2));
+ level3_count=0;
+ } else if (prompt_text[i].startsWith("*** ")) {
+ prompt_text[i] = QString(" %1. %2").arg(++level2_count).arg(prompt_text[i].mid(3));
+ }
+ }
+
+ QDialog promptWindow(0, Qt::WindowStaysOnTopHint);
+ Ui::ManualVerificationDlg promptUi;
+ promptUi.setupUi(&promptWindow);
+
+ if (!isConnected()) {
+ promptUi.learnButton->hide();
+ }
+
+ promptUi.test_steps->setText( prompt_text.join("\n") );
+ if (currentTestFunction() != NULL) {
+ if (currentDataTag() != NULL) {
+ promptWindow.setWindowTitle( "Manual Verification: "+ currentTestFunction() + "(" + currentDataTag() + ")" );
+ } else {
+ promptWindow.setWindowTitle( "Manual Verification: "+ currentTestFunction() );
+ }
+ }
+
+ QDialog failureWindow;
+ Ui::FailureDlg failureUi;
+ failureUi.setupUi(&failureWindow);
+ connect( promptUi.cancelButton, SIGNAL(clicked()), &failureWindow, SLOT(exec()) );
+ connect( promptUi.learnButton, SIGNAL(clicked()), d, SLOT(recordPrompt()) );
+ connect( promptUi.learnButton, SIGNAL(clicked()), &promptWindow, SLOT(close()) );
+ connect( promptUi.abort_button, SIGNAL(clicked()), &promptWindow, SLOT(close()) );
+ connect( promptUi.abort_button, SIGNAL(clicked()), this, SLOT(abortPrompt()) );
+
+ connect( failureUi.buttonBox, SIGNAL(accepted()), &promptWindow, SLOT(reject()) );
+
+ d->record_prompt = false;
+ abort_prompt = false;
+ promptWindow.exec();
+
+ if (abort_prompt) {
+ skip( "Manual verification step has been aborted", SkipSingle );
+ return;
+ }
+
+ if (d->record_prompt) {
+ recordEvents( prompt_text.join("\n") );
+ return;
+ }
+ bool ret = (promptWindow.result() == QDialog::Accepted);
+
+ /* If we fail with no text, encourage user to enter text */
+ if (learnMode() == LearnNone) {
+ while (!ret && failureUi.failureEdit->toPlainText().isEmpty() ) {
+ int clicked = QMessageBox::warning( 0, "No message entered",
+ "You have not entered a failure message. This may make it difficult to determine "
+ "the reason for failure from the test logs. Continue without entering a message?",
+ QMessageBox::Ok, QMessageBox::Cancel );
+ if (clicked == QMessageBox::Ok) break;
+ QMetaObject::invokeMethod(promptUi.cancelButton, "click", Qt::QueuedConnection);
+ promptWindow.exec();
+ ret = (promptWindow.result() == QDialog::Accepted);
+ }
+ }
+
+ QString failureMessage = failureUi.failureEdit->toPlainText();
+
+ if (ret) return;
+
+ QString message = "Manual verification steps failed";
+ if (!failureMessage.isEmpty()) {
+ message += "; " + failureMessage;
+ }
+ fail( message );
+}
+
+/*! \internal */
+void QSystemTest::abortPrompt()
+{
+ abort_prompt = true;
+}
+
+/*!
+ \internal
+ This function is called when the test IDE wants to abort the current test.
+*/
+void QSystemTest::abortTest()
+{
+#ifndef Q_OS_SYMBIAN
+ ::raise(SIGINT);
+#endif
+}
+
+/*!
+ \internal
+ Print any special usage information which should be shown when test is launched
+ with -help.
+*/
+void QSystemTest::printUsage(int argc, char *argv[]) const
+{
+ QAbstractTest::printUsage(argc, argv);
+ qWarning(
+ " System test options:\n"
+ " -authost <host> : Specify the IP address or host name of the machine on which the AUT is running.\n"
+ " By default, the system test will connect to 127.0.0.1.\n"
+ " -autport <port> : Use QTUITEST_DEFAULT_OPTIONS environment variable to specify autport option and value.\n"
+ " Specify the port on which the AUT is listening for a system test connection.\n"
+ " Defaults to %d. \n"
+ " -keepaut : Leave the AUT running after the system test finishes.\n"
+ " By default, if the system test launches the AUT, it will kill the AUT when testing\n"
+ " completes.\n"
+ " -silentaut : Hide the output of the AUT. By default, if the system test launches the AUT, the AUT's\n"
+ " standard output and standard error will be mixed with that of the test itself.\n"
+ "\n"
+ " -auto : Run in fully-automated mode. Any tests which require the presence of a manual\n"
+ " tester will be skipped.\n"
+ "\n"
+ " -verbose-perf : Output all performance messages from the AUT to the console. This may be used to run\n"
+ " a post-processing script on performance logs.\n"
+ "\n"
+ " -remote <host:port> : Specify the host and port of a QtUiTest-compatible test IDE, used for manual\n"
+ " verification steps. The default is to not use an IDE.\n"
+ " -env VAR=VALUE : Specify additional environment variables to be applied to tested \n"
+ " applications. For example, pass -env DISPLAY=:123 to run tested \n"
+ " applications on a different X server.\n"
+ , DEFAULT_AUT_PORT
+ );
+}
+
+#ifndef Q_QDOC
+/*
+ Fail returning a bool is for internal use only.
+ Hide from documentation.
+*/
+/*!
+ \internal
+ Cause a test failure with the given \a message.
+ Returns true if the test should continue (e.g., because the failure was expected), false otherwise.
+*/
+bool QSystemTest::fail(QString const &message)
+{
+ if (d->expect_app_close &&
+ (message.startsWith("ERROR: Connection lost") ||
+ message.startsWith("ERROR: no data in reply to") ||
+ message.startsWith("reply was missing return value") ||
+ message.startsWith("ERROR_NO_CONNECTION")) ) {
+ return true;
+ }
+
+ static bool saving_screen = false;
+ static bool saving_info = false;
+ static QString saving_screen_failed;
+ static QString saving_info_failed;
+ /* Prevent recursive failure on saving screen/widget info */
+ if (saving_screen) {
+ saving_screen_failed = "Failed to save failure screenshot: " + message;
+ return true;
+ }
+ if (saving_info) {
+ saving_info_failed = "Failed to save widget info on failure: " + message;
+ return true;
+ }
+
+ bool ret = QTest::compare_helper( false, qPrintable(message), qPrintable(currentFile()), currentLine() );
+ if (!ret) {
+ saving_screen = true;
+ saving_screen_failed = QString();
+
+ QString config = configurationIdentifier();
+ saveScreen("failure_" + config);
+
+ saving_screen = false;
+
+ if (saving_screen_failed.isEmpty()) {
+ // If we saved it, let the IDE know.
+ QFileInfo info(currentDataPath() + "/failure_" + config + ".png");
+ if (info.exists()) {
+ QTestMessage msg("failure_screenshot");
+ msg["screenshot"] = info.canonicalFilePath();
+ msg["filename"] = currentFile();
+ msg["line"] = currentLine();
+ msg["testfunction"] = QTest::currentTestFunction();
+ d->qtest_ide.postMessage(msg);
+ }
+ }
+
+ saving_info = true;
+ saving_info_failed = QString();
+
+ QString info = activeWidgetInfo();
+
+ saving_info = false;
+ if (!info.isEmpty()) {
+ QFile f(currentDataPath() + "/failure_" + config + ".txt");
+ if (!f.exists() && f.open(QIODevice::WriteOnly)) {
+ QTextStream(&f)
+ << message << "\n"
+ << "Location: " << currentFile() << ":" << currentLine() << "\n"
+ << (saving_screen_failed.isEmpty()
+ ? "Also see failure_" + config + ".png for a screenshot."
+ : saving_screen_failed)
+ << "\n"
+ << (saving_info_failed.isEmpty()
+ ? info
+ : saving_info_failed)
+ << "\n";
+ }
+ }
+ }
+ return ret;
+}
+#endif
+
+/*!
+
+ Cause a test to skip with the given \a message and \a mode.
+
+*/
+void QSystemTest::skip(const QString& message, SkipMode mode)
+{
+ d->skip_current_function = true;
+ QTest::qSkip(qPrintable(message), QTest::SkipMode(mode), qPrintable(currentFile()), currentLine());
+}
+
+/*!
+ \internal
+ Returns true if the last executed query has failed.
+ If \a message is not null, a failure message is returned in \a message.
+ If \a sent is not null, the message sent from the system test which
+ caused the failure is returned in \a sent.
+*/
+bool QSystemTest::queryFailed( QTestMessage *message, QTestMessage *sent )
+{
+ if (message != 0)
+ *message = d->error_msg;
+ if (sent != 0)
+ *sent = d->error_msg_sent;
+ return d->query_failed;
+}
+
+/*!
+ \internal
+ Informs the testframework that error situations need to be reported as warnings.
+*/
+void QSystemTest::enableQueryWarnings( bool enable, const QString &file, int line )
+{
+ setLocation( file, line );
+
+ if (!enable) {
+ d->error_msg = QTestMessage();
+ d->query_failed = false;
+ }
+ d->query_warning_mode = enable;
+}
+
+/*!
+ \internal
+ Saves the \a file and \a line information for internal usage. Whenever an error situation occurs this data is appended to the error message to improve traceability of the error.
+
+ It is usually not necessery to call this function directly.
+*/
+void QSystemTest::setLocation( const QString &file, int line )
+{
+ d->loc_fname = file;
+ d->loc_line = line;
+}
+
+/*!
+ \internal
+ Returns the current filename, i.e. the file that was being executed when the error situation occurred.
+*/
+QString QSystemTest::currentFile()
+{
+ return d->loc_fname;
+}
+
+/*!
+ \internal
+ Returns the current line number, i.e. the line number that presumably caused the error situation.
+*/
+int QSystemTest::currentLine()
+{
+ return d->loc_line;
+}
+
+/*!
+ \internal
+ Saves the error string \a errString for future processing. If warning mode is enabled the error is written directly to std out as a warning.
+ Base implementation returns false; subclasses may return true to indicate that the error is not considered "fatal".
+*/
+bool QSystemTest::setQueryError( const QString &errString )
+{
+ d->query_failed = true;
+ d->error_msg["status"] = errString;
+ d->error_msg_sent = d->last_msg_sent;
+ if (d->query_warning_mode)
+ qWarning( errString.toLatin1() );
+ return false; // query is NOT successfull
+}
+
+/*!
+ \internal
+ Saves the error specified in the test \a message for future processing. If warning mode is enabled the error is written directly to std out as a warning.
+ Base implementation returns false; subclasses may return true to indicate that the error is not considered "fatal".
+*/
+bool QSystemTest::setQueryError( const QTestMessage &message )
+{
+ d->query_failed = true;
+ d->error_msg = message;
+ d->error_msg_sent = d->last_msg_sent;
+ if (d->query_warning_mode)
+ qWarning( QString("%1 %2").arg(message.event()).arg(message.toString()).toLatin1().constData() );
+ return false; // query is NOT successfull
+}
+
+/*!
+ \internal
+ Launch AUT and run the test.
+*/
+int QSystemTest::runTest(int argc, char *argv[]) {
+ // Try to launch the aut script, and if successful, start executing the test.
+ // QTest::qExec will also start the application event loop, and will not return until the tests have finished.
+
+ return QAbstractTest::runTest(argc, argv);
+}
+
+/*!
+ \internal
+ Attempts to launch the aut script, and returns whether it was successful.
+ The \c -remote command line argument is appended to the script with the IP set to the address of the
+ local machine. This is to allow the test system to connect to the machine the test is running on.
+
+ Any scripts used should support this.
+*/
+bool QSystemTest::connectToAut(int timeout)
+{
+ if (!d->test_app)
+ d->test_app = new QSystemTestMaster( d );
+
+ QTime t;
+ t.start();
+ while (t.elapsed() < timeout && !isConnected()) {
+ d->test_app->connect( d->aut_host, d->aut_port );
+ d->test_app->waitForConnected(2000);
+ if (!d->test_app->isConnected()) {
+ if (d->test_app->error() == QAbstractSocket::ConnectionRefusedError) {
+ qLog(QtUitest) << qPrintable(QString("Connection refused while trying to connect to test app on %1:%2").arg(d->aut_host).arg(d->aut_port)) ;
+ }
+ QTest::qWait(100);
+ }
+ }
+
+ if (!d->test_app->isConnected()) {
+ return false;
+ }
+ d->test_app->enableReconnect(true, 10000);
+ if (d->demo_mode) setDemoMode(true);
+
+ return true;
+}
+
+/*!
+ \internal
+*/
+void QSystemTest::disconnectFromAut()
+{ d->test_app->disconnect(); }
+
+/*!
+ \internal
+*/
+bool QSystemTest::isConnected() const
+{ return (d && d->test_app && d->test_app->isConnected()); }
+
+/*!
+ \internal
+*/
+QSystemTest* QSystemTest::lastInstance()
+{
+ return QSystemTestPrivate::singleton;
+}
+
+/*!
+ Returns the username that is running the test on the desktop machine.
+*/
+QString QSystemTest::userName()
+{
+ QString user_name;
+
+#if defined Q_OS_TEMP
+ user_name = "WinCE";
+#elif defined Q_OS_WIN32
+ user_name = ::getenv("USERNAME");
+#elif defined Q_OS_UNIX
+ user_name = ::getenv("USER");
+ if (user_name == "")
+ user_name = ::getenv( "LOGNAME" );
+#elif defined Q_OS_MAC
+ user_name = ::getenv();
+#endif
+
+ return user_name.toLower();
+}
+
+/*!
+ Runs \a application with arguments \a args on the local machine,
+ with \a input given as standard input. The combined stderr and stdout text will be returned.
+
+ If the process fails to run or returns a non-zero exit code, the current test fails.
+*/
+QString QSystemTest::runProcess( const QString &application, const QStringList &args, const QString &input )
+{
+ QString output;
+ QProcess p;
+ p.setReadChannelMode(QProcess::MergedChannels);
+ p.setReadChannel(QProcess::StandardOutput);
+ p.start(application, args);
+ if (p.waitForStarted()) {
+ if (!input.isEmpty()) {
+ p.write( input.toLatin1() );
+ }
+ p.closeWriteChannel();
+ while (p.state() == QProcess::Running) {
+ while (p.canReadLine()) {
+ output += p.readLine();
+ }
+ wait(10); //important
+ }
+ while (p.canReadLine()) {
+ output += p.readLine();
+ }
+ if (p.exitStatus() != QProcess::NormalExit) {
+ setQueryError("Process didn't exit normally\n" + output);
+ return QString();
+ }
+ int ec = p.exitCode();
+ if (0 != ec) {
+ QString err_str = QString("Process exited with exit code: %1\n%2").arg(ec).arg(output);
+ setQueryError(err_str);
+ return QString();
+ }
+ return output;
+ }
+ setQueryError("Process didn't start");
+ return output;
+}
+
+/******************************************************************************
+* DOCUMENTATION FOR FUNCTIONS IN builtins.js
+******************************************************************************/
+
+/*!
+ Compares the \a actual string with the \a expected string and reports a fail
+ with a nicely formatted error message in case the strings are not equal.
+
+ Example:
+ \code
+ var my_variable1 = "Test";
+ var my_variable2 = "Test2";
+ compare( my_variable1, "Test" ); // passes
+ compare( my_variable2, "Test" ); // will fail the test, and test execution will stop at this line
+ \endcode
+
+ \sa verify()
+*/
+#ifdef Q_QDOC
+void QSystemTest::compare( const QString &actual, const QString &expected )
+{
+ // This code is implemented in the QtUiTestrunner bindings
+}
+#endif
+
+/*!
+ Aborts the test with a failure message if \a statement is false.
+ The failure messages returned by compare() are generally speaking better readable (more informative) and is preferred when working with strings.
+
+ Example:
+ \code
+ var my_variable1 = "Test";
+ var my_variable2 = "Test2";
+ verify( my_variable1 == "Test" ); // passes
+ verify( my_variable2 == "Test" ); // will fail the test, and test execution will stop at this line
+ \endcode
+
+ \sa compare()
+*/
+#ifdef Q_QDOC
+void QSystemTest::verify( bool statement )
+{
+ // This code is implemented in the QtUiTestrunner bindings
+}
+#endif
+
+/*!
+ \fn QSystemTest::waitFor(Number timeout, Number intervals, String message)
+
+ Denotes the start of a block of code which should be repeatedly executed
+ until it returns true. If the block of code doesn't return true within
+ \a timeout milliseconds, the current test fails with the given \a message.
+
+ \a intervals is the maximum amount of times the block of code should be
+ executed; i.e., the code will be executed every \a timeout / \a intervals
+ milliseconds.
+
+ Example:
+ \code
+ waitFor() {
+ return getList().length > 0;
+ }
+ \endcode
+*/
+
+
+/*!
+ \fn QSystemTest::verify(Boolean condition, String message)
+
+ Verifies that \a condition is true. If \a condition is not true, the
+ current test fails. If \a message is given, it will be appended to
+ the failure message.
+
+ Example:
+ \code
+ select("Frank", "Contacts");
+ waitForTitle("Details: Frank");
+ var details = getText();
+ // Verify that Frank's phone number is shown somewhere
+ verify( details.contains("12345") );
+ // Same, but with more details in error message
+ verify( details.contains("12345"), "Frank's phone number is missing!" );
+ \endcode
+*/
+
+/*!
+ \fn QSystemTest::compare(Variant actual, Variant expected)
+
+ Verifies that \a actual is equal to \a expected. If this is not the case,
+ the current test fails.
+
+ Note that the order of \a actual and \a expected is significant, as it
+ affects the test failure message.
+*/
+
+/*!
+ \fn QSystemTest::fail(String message)
+
+ Immediately fail the current test with the specified \a message.
+*/
+
+/*!
+ Returns the signature of the tabbar widget. If multiple tabbars exist, \a index can be used to
+ distinguish between them (sorted in order of position from top left of screen).
+
+ Example:
+ \code
+ select( "Personal", tabBar() ); // select the tab with text 'Personal' from the tab bar.
+ print( tabBar() ); // to print the signature of the tabbar widget.
+ \endcode
+
+ The test will fail if no visible tabbar is found.
+*/
+#ifdef Q_QDOC
+void QSystemTest::tabBar( int index )
+{
+ // This code is implemented in the QtUiTestrunner bindings
+}
+#endif
+
+/*!
+ \internal
+ Returns an identifier for the current runtime configuration.
+ Includes mousePreferred(), screen size and theme.
+*/
+QString QSystemTest::configurationIdentifier() const
+{ return d->config_id; }
+
+/*!
+ \internal
+*/
+void QSystemTest::setConfigurationIdentifier(QString const& config)
+{ d->config_id = config; }
+
+/*!
+ \internal
+*/
+bool QSystemTest::verbose() const
+{ return d->verbose; }
+
+/*!
+ \internal
+*/
+bool QSystemTest::doQuery(const QTestMessage& message, const QString& queryPath, QTestMessage* reply, int timeout, const QStringList& pass, const QStringList& fail)
+{ return d->queryPassed(pass, fail, message, queryPath, reply, timeout); }
+
+/*!
+ \internal
+ Called for each incoming message from the AUT.
+*/
+void QSystemTest::processMessage(const QTestMessage& message)
+{
+ QTestMessage copy(message);
+ d->processMessage(&copy);
+}
+
+/*!
+ \internal
+ Prints \a value.
+*/
+void QSystemTest::print( QVariant const& value )
+{
+ QDebug(QtDebugMsg) << qPrintable(value.toString());
+}
+
+/*! \internal
+ Enables/disables waits and animations for demo purposes.
+*/
+void QSystemTest::setDemoMode( bool enabled )
+{
+ QTestMessage queryMsg("enableDemoMode");
+ queryMsg["enable"] = enabled;
+ d->queryPassed( "OK", "", queryMsg );
+}
+
+/*!
+ \internal
+*/
+bool QSystemTest::demoMode() const
+{ return d->demo_mode; }
+
+/*!
+ \internal
+*/
+QString QSystemTest::autHost() const
+{ return d->aut_host; }
+
+/*!
+ \internal
+*/
+int QSystemTest::autPort() const
+{ return d->aut_port; }
+
+/*!
+ Uses the \a reason to mark the current testfunction as expected to fail.
+*/
+void QSystemTest::expectFail( const QString &reason )
+{
+ QEXPECT_FAIL(currentDataTag().toLatin1().constData(), qstrdup(reason.toLatin1().constData()), Abort);
+}
+
+/*!
+ Returns the translation for \a text, from the application's installed translation files. \a context is
+ typically a class name. If no translation is found, the \a text is returned unchanged.
+
+ \a comment is a disambiguating comment, for when the same sourceText is used in different roles
+ within the same context. By default, it is null. \a n is used in conjunction with \c %n to support
+ plural forms. See QObject::tr() for details.
+
+ When developing test cases that use translations, it will be necessary to refer to the translator
+ message files (\c .ts files), either directly or through Qt Linguist, to determine which
+ translations are available, and the appropriate \a context to use.
+
+ In some cases, translated phrases will contain argument placeholders (\c %1, etc) which will need
+ to be expanded with the correct values.
+
+ Example:
+ \code
+ // Label translation
+ print( translate("QFileDialog", "File &name:") );
+
+ // Replace argument placeholders
+ compare( message, translate("QHttp", "Host %1 not found").replace("%1", hostname) );
+ \endcode
+
+ \sa QCoreApplication::translate(), getLocale()
+*/
+QString QSystemTest::translate(const QString &context, const QString &text, const QString &comment, int n)
+{
+ QTestMessage message("translate");
+ message["context"] = context;
+ message["text"] = text;
+ message["comment"] = comment;
+ message["number"] = n;
+ QTestMessage reply;
+
+ if (!d->queryPassed( "OK", "", BT(message), "", &reply )) return false;
+ return reply["translate"].toString();
+}
+
+/*!
+ Returns the system locale.
+
+ \sa QLocale::system(), translate()
+*/
+QLocale QSystemTest::getLocale()
+{
+ QTestMessage message("getLocale");
+ QTestMessage reply;
+
+ if (!d->queryPassed( "OK", "", BT(message), "", &reply )) return QLocale();
+ return reply["getLocale"].toLocale();
+}
+
+/*!
+ \internal
+*/
+void QSystemTest::qtuitest_pre_test_function()
+{
+ d->query_count = 0;
+ d->prompt_count = 0;
+ d->skip_current_function = false;
+}
+
+/*!
+ \internal
+*/
+void QSystemTest::qtuitest_post_test_function()
+{
+ if (failEmptyTest() && d->query_count == 0 && d->prompt_count == 0 && !d->skip_current_function && !QTest::currentTestFailed()) {
+ fail("Nothing tested");
+ }
+}
+
+/*! \typedef StringArray
+ \relates QSystemTest
+
+ An \l Array object in which every element is a \l String.
+*/
+
+/*! \typedef QVariantArray
+ \relates QSystemTest
+
+ An \l Array object in which every element is a \l QVariant.
+*/
+
+/*! \typedef Function
+ \relates QSystemTest
+
+ The Function type as documented in ECMA-262, section 15.3.
+*/
+
+/*! \typedef Array
+ \relates QSystemTest
+
+ The Array type as documented in ECMA-262, section 15.4.
+
+ The following extensions are provided in QtUiTest.
+
+ \table
+ \row \o \tt{\l Boolean Array.prototype.contains(value)}
+ \o Returns true if the array contains the given value.
+ \endtable
+*/
+
+/*! \typedef String
+ \relates QSystemTest
+
+ The String type as documented in ECMA-262, section 15.5.
+
+ The following extensions are provided in QtUiTest.
+
+ \table
+ \row \o \tt{ \l Boolean String.prototype.contains(String text)}
+ \o Returns true if the string contains the given text.
+ \row \o \tt{ \l Boolean String.prototype.contains(\l QRegExp regex)}
+ \o Returns true if the string is matched by the given regular expression.
+ \row \o \tt{ \l Boolean String.prototype.startsWith(String text)}
+ \o Returns true if the string starts with the given text.
+ \row \o \tt{ String String.prototype.left(\l Number n)}
+ \o Returns the first n characters of the string.
+ \row \o \tt{ String String.prototype.right(\l Number n)}
+ \o Returns the last n characters of the string.
+ \endtable
+*/
+
+
+/*! \typedef Boolean
+ \relates QSystemTest
+
+ The Boolean type as documented in ECMA-262, section 15.6.
+*/
+
+/*! \typedef Number
+ \relates QSystemTest
+
+ The Number type as documented in ECMA-262, section 15.7.
+*/
+
+#include "qsystemtest.moc"
diff --git a/libqsystemtest/qsystemtest.h b/libqsystemtest/qsystemtest.h
new file mode 100644
index 0000000..1b8b5fc
--- /dev/null
+++ b/libqsystemtest/qsystemtest.h
@@ -0,0 +1,457 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSYSTEMTEST_H
+#define QSYSTEMTEST_H
+
+#include "qabstracttest.h"
+#include "qtestprotocol_p.h"
+
+#include <QDir>
+#include <QLocale>
+
+#define DEFAULT_QUERY_TIMEOUT 120000
+
+class QSystemTestPrivate;
+class QTestMessage;
+
+#ifdef Q_QDOC
+namespace QSystemTest
+#else
+class QSYSTEMTEST_EXPORT QSystemTest : public QAbstractTest
+#endif
+{
+Q_OBJECT
+Q_ENUMS(SkipMode)
+Q_ENUMS(EnterMode)
+Q_ENUMS(LabelOrientation)
+Q_ENUMS(StartApplicationFlag)
+Q_FLAGS(StartApplicationFlags)
+Q_ENUMS(Role)
+Q_ENUMS(StateFlag)
+Q_FLAGS(State)
+
+public:
+ QSystemTest();
+ virtual ~QSystemTest();
+
+ enum SkipMode
+ {
+ SkipSingle = 0x01,
+ SkipAll = 0x02
+ };
+
+ enum EnterMode
+ {
+ Commit = 0x00,
+ NoCommit = 0x01
+ };
+
+ enum LabelOrientation
+ {
+ LabelLeft = 0x01,
+ LabelRight = 0x02,
+ LabelAbove = 0x03,
+ LabelBelow = 0x04
+ };
+
+ enum StartApplicationFlag
+ {
+ NoFlag = 0x00,
+ WaitForFocus = 0x01,
+ BackgroundCurrentApplication = 0x02
+ };
+ Q_DECLARE_FLAGS(StartApplicationFlags, StartApplicationFlag)
+
+ // This should match QAccessible::Role
+ enum Role {
+ NoRole = 0x00000000,
+ TitleBar = 0x00000001,
+ MenuBar = 0x00000002,
+ ScrollBar = 0x00000003,
+ Grip = 0x00000004,
+ Sound = 0x00000005,
+ Cursor = 0x00000006,
+ Caret = 0x00000007,
+ AlertMessage = 0x00000008,
+ Window = 0x00000009,
+ Client = 0x0000000A,
+ PopupMenu = 0x0000000B,
+ MenuItem = 0x0000000C,
+ ToolTip = 0x0000000D,
+ Application = 0x0000000E,
+ Document = 0x0000000F,
+ Pane = 0x00000010,
+ Chart = 0x00000011,
+ Dialog = 0x00000012,
+ Border = 0x00000013,
+ Grouping = 0x00000014,
+ Separator = 0x00000015,
+ ToolBar = 0x00000016,
+ StatusBar = 0x00000017,
+ Table = 0x00000018,
+ ColumnHeader = 0x00000019,
+ RowHeader = 0x0000001A,
+ Column = 0x0000001B,
+ Row = 0x0000001C,
+ Cell = 0x0000001D,
+ Link = 0x0000001E,
+ HelpBalloon = 0x0000001F,
+ Assistant = 0x00000020,
+ List = 0x00000021,
+ ListItem = 0x00000022,
+ Tree = 0x00000023,
+ TreeItem = 0x00000024,
+ PageTab = 0x00000025,
+ PropertyPage = 0x00000026,
+ Indicator = 0x00000027,
+ Graphic = 0x00000028,
+ StaticText = 0x00000029,
+ EditableText = 0x0000002A,
+ PushButton = 0x0000002B,
+ CheckBox = 0x0000002C,
+ RadioButton = 0x0000002D,
+ ComboBox = 0x0000002E,
+ ProgressBar = 0x00000030,
+ Dial = 0x00000031,
+ HotkeyField = 0x00000032,
+ Slider = 0x00000033,
+ SpinBox = 0x00000034,
+ Canvas = 0x00000035,
+ Animation = 0x00000036,
+ Equation = 0x00000037,
+ ButtonDropDown = 0x00000038,
+ ButtonMenu = 0x00000039,
+ ButtonDropGrid = 0x0000003A,
+ Whitespace = 0x0000003B,
+ PageTabList = 0x0000003C,
+ Clock = 0x0000003D,
+ Splitter = 0x0000003E,
+ LayeredPane = 0x0000003F,
+ UserRole = 0x0000ffff
+ };
+
+ // This should match QAccessible::StateFlag
+ enum StateFlag {
+ Normal = 0x00000000,
+ Unavailable = 0x00000001,
+ Selected = 0x00000002,
+ Focused = 0x00000004,
+ Pressed = 0x00000008,
+ Checked = 0x00000010,
+ Mixed = 0x00000020,
+ ReadOnly = 0x00000040,
+ HotTracked = 0x00000080,
+ DefaultButton = 0x00000100,
+ Expanded = 0x00000200,
+ Collapsed = 0x00000400,
+ Busy = 0x00000800,
+ Marqueed = 0x00002000,
+ Animated = 0x00004000,
+ Invisible = 0x00008000,
+ Offscreen = 0x00010000,
+ Sizeable = 0x00020000,
+ Movable = 0x00040000,
+ SelfVoicing = 0x00080000,
+ Focusable = 0x00100000,
+ Selectable = 0x00200000,
+ Linked = 0x00400000,
+ Traversed = 0x00800000,
+ MultiSelectable = 0x01000000,
+ ExtSelectable = 0x02000000,
+ Protected = 0x20000000,
+ HasPopup = 0x40000000,
+ Modal = 0x80000000
+ };
+ Q_DECLARE_FLAGS(State, StateFlag)
+
+
+
+public slots:
+ // commands to control test execution
+ void strict( bool = true );
+ void setDemoMode( bool );
+ static QString userName();
+ bool shouldFilterMessage(char const*);
+ QMap<QString, int> filteredMessages() const;
+ void clearFilteredMessages();
+ bool runsOnDevice();
+
+ virtual void skip(const QString&,SkipMode);
+ virtual void expectFail(const QString&);
+
+ QString signature(const QString&, int = 0);
+
+ // widget checks
+ bool isVisible(const QString&);
+ bool isEnabled(const QString&);
+
+ // checkBox manipulators
+ bool isChecked(const QString&);
+ bool isChecked(const QString&, const QString&);
+ void setChecked(bool,const QString& = QString());
+ void setChecked(bool,const QString&,const QString&);
+ int checkState(const QString&);
+ void setCheckState(int,const QString& = QString());
+
+ // data verification functions
+ QString currentApplication();
+ QString applicationVersion();
+ QString qtVersion();
+ QString currentTitle(const QString& = QString());
+ QStringList getWindowTitles();
+ void activateWindow(const QString&);
+ QString activeWindow();
+ QString focusWidget();
+ QString getSelectedText(const QString& = QString() );
+ QString getText(const QString& = QString() );
+ QVariant getSelectedValue(const QString& = QString() );
+ QVariant getValue(const QString& = QString() );
+ QStringList getList(const QString& = QString() );
+ QPoint getCenter(const QString&, const QString&);
+ QStringList getLabels(const QString& = QString() );
+
+ // clipboard
+ QString getClipboardText();
+ void setClipboardText(const QString&);
+
+ // time management functions
+ QDateTime getDateTime();
+
+ int visibleResponseTime();
+ void setVisibleResponseTime(int);
+
+ // application management functions
+ virtual void startApplication(const QString&, const QStringList& = QStringList(), int timeout = 5000,QSystemTest::StartApplicationFlags = QSystemTest::WaitForFocus);
+ void expectApplicationClose(bool);
+
+ // low level simulators
+ void keyClick(Qt::Key,const QString& = QString());
+ void keyClickHold(Qt::Key,int,const QString& = QString());
+ void keyPress(Qt::Key,const QString& = QString());
+ void keyRelease(Qt::Key,const QString& = QString());
+
+ void mouseClick(int,int,QFlags<Qt::MouseButton> = Qt::LeftButton);
+ void mouseClick(const QPoint&,QFlags<Qt::MouseButton> = Qt::LeftButton);
+ void mouseClick(const QString&,QFlags<Qt::MouseButton> = Qt::LeftButton);
+ void mouseClickHold(int,int,int,QFlags<Qt::MouseButton> = Qt::LeftButton);
+ void mouseClickHold(const QPoint&,int,QFlags<Qt::MouseButton> = Qt::LeftButton);
+ void mouseClickHold(const QString&,int,QFlags<Qt::MouseButton> = Qt::LeftButton);
+ void mousePress(int,int,QFlags<Qt::MouseButton> = Qt::LeftButton);
+ void mousePress(const QPoint&,QFlags<Qt::MouseButton> = Qt::LeftButton);
+ void mousePress(const QString&,QFlags<Qt::MouseButton> = Qt::LeftButton);
+ void mouseRelease(int,int,QFlags<Qt::MouseButton> = Qt::LeftButton);
+ void mouseRelease(const QPoint&,QFlags<Qt::MouseButton> = Qt::LeftButton);
+ void mouseRelease(const QString&,QFlags<Qt::MouseButton> = Qt::LeftButton);
+
+ bool mousePreferred();
+ void setMousePreferred(bool);
+
+ LabelOrientation labelOrientation();
+ void setLabelOrientation(LabelOrientation);
+
+ // input and selection functions
+ void enter(const QVariant&,const QString& = QString(),EnterMode = Commit);
+ void select(const QString&,const QString& = QString());
+ void selectIndex(const QVariantList&,const QString& = QString());
+ QVariantList getSelectedIndex(const QString& = QString());
+ void activate(const QString&);
+ void ensureVisible(const QString&,const QString& = QString());
+
+ // verification mechanisms
+ void verifyImage(const QString&,const QString& = QString(),
+ const QString& = QString(),const QStringList& = QStringList());
+ bool compareImage( const QString&, const QString&, const QStringList& = QStringList());
+ void prompt(const QString& = QString());
+ bool recordEvents(const QString&, bool = true);
+ QString stopRecordingEvents();
+
+ // testcase synchronisation
+ void wait(int);
+
+ // graphical manipulation
+ void saveScreen(const QString&, const QString& = "");
+ QImage grabImage(const QString& = QString(),const QStringList& = QStringList());
+
+ // environment manipulation functions
+ QString runProcess(const QString&,const QStringList&,const QString&);
+ QString getenv(const QString&);
+ bool checkOS(const QString&);
+ void putFile(const QString&,const QString&,QFile::Permissions=0);
+ void putData(const QByteArray&,const QString&,QFile::Permissions=0);
+ void getFile(const QString&,const QString&);
+ QString readLocalFile(const QString&);
+ QString getData(const QString&);
+ void deletePath(const QString&);
+ QStringList getDirectoryEntries(const QString&,QDir::Filters = QDir::NoFilter);
+
+ QSize getImageSize(const QString&);
+ QRect getGeometry(const QString& = QString());
+
+ void setProperty(const QString&,const QString&,const QVariant&);
+ QVariant getProperty(const QString&,const QString&);
+ QStringList findByProperty(const QString&, const QVariant&);
+ QStringList findByProperty(const QVariantMap&);
+ QStringList findWidget(const QString&, const QVariant&);
+ QStringList findWidget(const QVariantMap&);
+
+ bool invokeMethod(const QString&,const QString&,
+ const QVariant& = QVariant(),const QVariant& = QVariant(),const QVariant& = QVariant(),
+ const QVariant& = QVariant(),const QVariant& = QVariant(),const QVariant& = QVariant(),
+ const QVariant& = QVariant(),const QVariant& = QVariant(),const QVariant& = QVariant(),
+ const QVariant& = QVariant());
+
+ bool invokeMethod(const QString&,const QString&,Qt::ConnectionType,
+ const QVariant& = QVariant(),const QVariant& = QVariant(),const QVariant& = QVariant(),
+ const QVariant& = QVariant(),const QVariant& = QVariant(),const QVariant& = QVariant(),
+ const QVariant& = QVariant(),const QVariant& = QVariant(),const QVariant& = QVariant(),
+ const QVariant& = QVariant());
+
+ QVariant getSetting(const QString&,const QString&,const QString&);
+ QVariant getSetting(const QString&,const QString&,const QString&,const QString&);
+ void setSetting(const QString&,const QString&,const QString&,const QVariant&);
+ void setSetting(const QString&,const QString&,const QString&,const QString&,const QVariant&);
+ QString translate(const QString&, const QString&, const QString& = QString(), int = 0);
+ QLocale getLocale();
+
+ // debug helper functions
+ QString activeWidgetInfo();
+
+ void print(QVariant const&);
+
+ void qtuitest_pre_test_function();
+ void qtuitest_post_test_function();
+
+ static QSystemTest* lastInstance();
+
+protected:
+ virtual void printUsage(int,char*[]) const;
+ virtual void processCommandLine(int&,char*[]);
+ virtual int runTest(int,char*[]);
+
+ virtual void applicationStandardOutput(QList<QByteArray> const&);
+ virtual void applicationStandardError(QList<QByteArray> const&);
+
+ bool connectToAut(int timeout = 10000);
+ void disconnectFromAut();
+ bool isConnected() const;
+ bool demoMode() const;
+ QString autHost() const;
+ int autPort() const;
+
+ virtual QString currentFile();
+ virtual int currentLine();
+
+ QString configurationIdentifier() const;
+ void setConfigurationIdentifier(QString const&);
+
+ bool verbose() const;
+
+
+#ifndef Q_QDOC
+ virtual bool fail(QString const&);
+ bool doQuery(const QTestMessage& message, const QString& queryPath = QString(), QTestMessage* reply = 0, int timeout = DEFAULT_QUERY_TIMEOUT, const QStringList& pass = QStringList("OK"), const QStringList& fail = QStringList());
+ inline bool doQuery(const QTestMessage& message, const QString& queryPath, QTestMessage* reply, int timeout, const QString& pass, const QString& fail = QString())
+ { return doQuery(message,queryPath,reply,timeout,QStringList(pass),QStringList(fail)); }
+
+ template <typename T> inline
+ T queryWithReturn(T const& ret, QString const& msg, QString const& queryPath)
+ {
+ QTestMessage reply;
+ QTestMessage testMessage(msg);
+ if (!doQuery(testMessage, queryPath, &reply)) return ret;
+ if (!reply[msg].isValid()) {
+ reply["status"] = "ERROR: no data in reply to " + msg + "; status: " + reply["status"].toString();
+ setQueryError(reply);
+ return ret;
+ }
+ return reply[msg].value<T>();
+ }
+#endif
+
+ virtual bool setQueryError(const QTestMessage&);
+ virtual bool setQueryError(const QString&);
+
+ virtual bool queryFailed(QTestMessage* = 0,QTestMessage* = 0);
+ virtual void enableQueryWarnings(bool,const QString& = QString(),int = -1);
+ virtual void setLocation(const QString& = QString(),int = -1);
+
+ virtual void processMessage(const QTestMessage&);
+
+protected slots:
+ void abortPrompt();
+ void abortTest();
+
+protected:
+ bool abort_prompt;
+
+private:
+ QSystemTestPrivate *d;
+ friend class QSystemTestMaster;
+ friend class QSystemTestPrivate;
+ friend class QSystemTestMail;
+ friend class TestProcess;
+
+#ifdef Q_QDOC
+/* Functions where implementation is in QtScript */
+public:
+ void waitFor(Number = 10000,Number = 20,String = null);
+ void expectMessageBox(String,String,String,Number);
+ void compare(Variant,Variant);
+ void verify(Boolean,String = null);
+ void fail(String);
+ void tabBar(int = 0);
+#endif
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QSystemTest::StartApplicationFlags)
+
+#ifdef Q_QDOC
+typedef Nothing String;
+typedef Nothing StringArray;
+typedef Nothing QVariantArray;
+typedef Nothing Boolean;
+typedef Nothing Number;
+typedef Nothing Array;
+typedef Nothing Function;
+#endif
+
+#endif
diff --git a/libqsystemtest/qsystemtest_p.cpp b/libqsystemtest/qsystemtest_p.cpp
new file mode 100644
index 0000000..1bc6672
--- /dev/null
+++ b/libqsystemtest/qsystemtest_p.cpp
@@ -0,0 +1,764 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qsystemtest.h>
+#include "qsystemtestmaster_p.h"
+
+#include "qtestverifydlg_p.h"
+#include "qtestremote_p.h"
+#include "recordevent_p.h"
+
+#include <QProcess>
+#include <QTextEdit>
+#include <QMessageBox>
+
+#include <QMetaEnum>
+
+#include "qtuitest_config.h"
+
+#include "qsystemtest_p.h"
+
+#undef qLog
+#define qLog(A) if (!verbose); else (QDebug(QtDebugMsg) << #A ":")
+
+#define OBJECT_EXIST_TIMEOUT 1000
+
+#define BT(message) (\
+ message["location"] = QString("%1:%2%3").arg(__FILE__).arg(__LINE__).arg(!message["location"].toString().isEmpty() ? "\n" + message["location"].toString() : ""),\
+ message)
+
+
+QSystemTest *QSystemTestPrivate::singleton = 0;
+
+QSystemTestPrivate::QSystemTestPrivate(QSystemTest *parent)
+ : QObject(parent)
+ , event_timer(0)
+ , aut()
+ , remote_aut()
+ , test_app(0)
+ , recorded_events_edit(0)
+ , recorded_events_as_code(true)
+ , record_prompt(false)
+ , query_warning_mode(true)
+ , fatal_timeouts(1)
+ , timeouts(0)
+ , keyclickhold_key((Qt::Key)0)
+ , current_application("")
+ , current_app_version("")
+ , loc_fname("")
+ , loc_line(-1)
+ , auto_mode(false)
+ , aut_host("127.0.0.1")
+ , aut_port(DEFAULT_AUT_PORT)
+ , keep_aut(false)
+ , silent_aut(false)
+ , no_aut(false)
+ , demo_mode(false)
+ , verbose(false)
+ , env()
+ , strict_mode(false)
+ , visible_response_time(4000)
+ , recorded_events()
+ , recorded_code()
+ , display_id(0)
+ , device()
+ , mousePreferred(false)
+ , screenGeometry()
+ , theme()
+ , config_id()
+ , got_startup_info(false)
+ , recording_events(false)
+ , expect_app_close(false)
+ , sample_memory_interval(-1)
+ , p(parent)
+{
+ (void)qMetaTypeId<RecordEvent>();
+ (void)qMetaTypeId< QList<RecordEvent> >();
+}
+
+QSystemTestPrivate::~QSystemTestPrivate()
+{
+ while (aut.count()) {
+ QPointer<QProcess> proc = aut.takeFirst();
+ if (proc) {
+ proc->terminate();
+ if (!proc->waitForFinished(5000)) {
+ proc->kill();
+ proc->waitForFinished(5000);
+ }
+ delete proc;
+ }
+ }
+
+ delete event_timer;
+ delete test_app;
+ while (expected_msg_boxes.count() > 0)
+ delete expected_msg_boxes.takeFirst();
+}
+
+/*!
+ \internal
+ Determines whether to learn the new pixmap by displaying a prompt to the user.
+ \a actual is the current snapshot, while \a expected is the stored pixmap (if any).
+ If the user does not accept the new snapshot, a failure is generated for \a file at \a line, and
+ \c false is returned. Otherwise the new snapshot replaces the previous stored one, and \c true is returned.
+ \a comment is a comment intended to help the user decide whether or not to accept the pixmap.
+
+ If this is a GUI application, the prompt is displayed directly. Otherwise it sends a message to
+ any connected IDE's to display the message.
+*/
+bool QSystemTestPrivate::learnImage(const QImage &actual, const QImage &expected, const QString &comment)
+{
+ if (qtest_ide.isConnected()) {
+ QTestMessage returnValue;
+ QTestMessage msg("VERIFY_IMAGE");
+ msg["actual"] = actual.isNull() ? QPixmap() : QPixmap::fromImage(actual);
+ msg["expected"] = expected.isNull() ? QPixmap() : QPixmap::fromImage(expected);
+ msg["comment"] = comment;
+
+ if (qtest_ide.sendMessage( msg, returnValue, -1 ) && returnValue["status"] == "OK") {
+ return returnValue["accepted"].toBool();
+ } else {
+ return p->fail( "Verification of pixmap not possible: remote test tool did not correctly respond." );
+ }
+ } else {
+ QTestVerifyDlg dlg;
+ dlg.setWindowFlags(dlg.windowFlags() | Qt::WindowStaysOnTopHint);
+ QString fullComment("Does the 'Actual' image show the correct output?\n" + comment);
+
+ dlg.addTab("Actual", actual.isNull() ? QPixmap() : QPixmap::fromImage(actual));
+ if (!expected.isNull()) {
+ dlg.addTab("Expected", QPixmap::fromImage(expected));
+ dlg.setComment(fullComment);
+ } else {
+ dlg.setComment(fullComment + "\n"
+ "If you click on 'Yes' the 'Actual' image will become the\n"
+ "expected image, and will be used for future comparisons.\n");
+ }
+
+ if ( dlg.exec() == QDialog::Accepted )
+ return true;
+ }
+
+ return false;
+}
+
+/*!
+ \internal
+ Compares the \a actual and \a expected images and returns true if the images are
+ the same. If \a strict is false, small differences between the images are allowed.
+*/
+bool QSystemTestPrivate::imagesAreEqual( const QImage &actual, const QImage &expected, bool strict )
+{
+ // images are considered the same if both contain a null image
+ if (actual.isNull() && expected.isNull())
+ return true;
+
+ // images are not the same if one images contains a null image
+ if (actual.isNull() || expected.isNull())
+ return false;
+
+ // images do not have the same size
+ if (actual.size() != expected.size())
+ return false;
+
+ QImage a = actual.convertToFormat(QImage::Format_ARGB32);
+ QImage e = expected.convertToFormat(QImage::Format_ARGB32);
+
+ bool equal = true;
+ int threshold = 80;
+ for ( int y=0; y<a.height(); y++ ) {
+ for ( int x=0; x<a.width(); x++ ) {
+ QRgb actPix = a.pixel( x, y );
+ QRgb expPix = e.pixel( x, y );
+
+ if ( qAlpha(actPix)==0 && qAlpha(expPix)==0 )
+ continue;
+ if ( actPix != expPix) {
+ if (strict ||
+ (qAbs(qRed(actPix) - qRed(expPix)) +
+ qAbs(qGreen(actPix) - qGreen(expPix)) +
+ qAbs(qBlue(actPix) - qBlue(expPix)) > threshold)
+ ) {
+ equal = false;
+ goto done;
+ }
+ }
+ }
+ }
+
+done:
+ return equal;
+}
+
+
+/*!
+ \internal
+ Sends a query test message \a msg to the Application Under Test (AUT) identified by \a queryPath and returns the reply message. An error is logged in the testresult if the AUT doesn't respond within \a timeout ms.
+
+ Note that it is seldom necessery to call query directly.
+*/
+QTestMessage QSystemTestPrivate::query( const QTestMessage &msg, const QString &queryPath, int timeout )
+{
+ query_count++;
+ QTestMessage message(msg);
+ message["queryPath"] = queryPath;
+ query_failed = false;
+ error_msg = QTestMessage();
+ last_msg_sent = QTestMessage();
+
+ if (-1 != fatal_timeouts && timeouts >= fatal_timeouts) {
+ QTestMessage reply;
+ reply["status"] = "ERROR_FATAL_TIMEOUT";
+ p->setQueryError(reply);
+ return reply;
+ }
+
+ QTestMessage reply;
+ reply["status"] = "ERROR_UNSET_REPLY";
+
+ last_msg_sent = message;
+
+ if (test_app) {
+
+ static int breakpoint_mode = -1;
+ if (qtest_ide.isConnected()) {
+ if (breakpoint_mode == -1) {
+ QTestMessage reply;
+ QTestMessage ide_msg("queryBreakpointMode");
+ qtest_ide.sendMessage( ide_msg, reply, -1 );
+ breakpoint_mode = reply["queryBreakpointMode"].toBool();
+ }
+ if (breakpoint_mode == 1) {
+ QTestMessage ide_msg("queryBreakpoint");
+ ide_msg["file"] = p->currentFile();
+ ide_msg["line"] = QString("%1").arg(p->currentLine());
+ QTestMessage reply;
+ qtest_ide.sendMessage( ide_msg, reply, -1 );
+ }
+ }
+
+ if (!test_app->sendMessage( message, reply, timeout )) {
+ p->setQueryError(reply);
+ return reply;
+ }
+ } else {
+ p->setQueryError( "No Application Under Test (AUT) available" );
+ }
+
+ QString warning = reply["warning"].toString();
+ if (!warning.isEmpty()) {
+ qWarning("In response to '%s', received warning from test system: %s", qPrintable(message.event()), qPrintable(warning));
+ }
+ if (reply["status"] == "ERROR_REPLY_TIMEOUT" || reply["status"] == "ERROR_NO_CONNECTION") ++timeouts;
+
+ return reply;
+}
+
+/*!
+ \internal
+ Sends a query specified with \a message to the Application Under Test (AUT). If the query was successful and \a reply is not null the reply message is returned in \a reply.
+
+ The function returns true if the query result string equals \a passResult and false if it equals
+ \a failResult. The function also returns false in cases where a query failure has occurred.
+
+ The \a queryPath can be used to specify which specific application/object the query is intended for.
+
+ The \a timeout parameter can be used to limit the time the query will wait for a reply.
+
+ If the function is NOT called from within a test macro such as QVERIFY, QCOMPARE, etc, the function
+ will also write a warning message to the display describing the error.
+*/
+bool QSystemTestPrivate::queryPassed( const QStringList &passResult, const QStringList &failResult,
+ const QTestMessage &message, const QString &queryPath, QTestMessage *reply, int timeout )
+{
+ QTime t;
+ if (verbose) t.start();
+
+ QTestMessage msg(message);
+
+ if (expect_app_close) {
+ msg["expectClose"] = "yes";
+ }
+
+ QTestMessage ret = query( BT(msg), queryPath, timeout );
+ if (reply) *reply = ret;
+ QString query_msg = message.event();
+ if (query_msg == "getProperty")
+ query_msg += "(" + message["property"].toString() + ")";
+
+ if (!p->queryFailed()) {
+ if (passResult.contains( ret["status"].toString() )) {
+ if (verbose) {
+ qLog(QtUitest) << QString("query '%1' took %2 ms").arg(query_msg).arg(t.elapsed()).toLatin1();
+ }
+ return true;
+ }
+ if (failResult.contains( ret["status"].toString() )) {
+ if (verbose) {
+ qLog(QtUitest) << QString("query '%1' took %2 ms").arg(query_msg).arg(t.elapsed()).toLatin1();
+ }
+ return false;
+ }
+ }
+
+ if (verbose) {
+ qLog(QtUitest) << QString("query '%1' took %2 ms").arg(message.event()).arg(t.elapsed()).toLatin1();
+ }
+ return p->setQueryError( ret );
+}
+
+/*!
+ \internal
+ \overload
+ Equivalent to queryPassed() with passResult and failResult a single-element string list.
+*/
+bool QSystemTestPrivate::queryPassed( const QString &passResult, const QString &failResult,
+ const QTestMessage &message, const QString &queryPath, QTestMessage *reply, int timeout )
+{
+ QStringList pass;
+ QStringList fail;
+ if (!passResult.isEmpty()) pass << passResult;
+ if (!failResult.isEmpty()) fail << failResult;
+ return queryPassed(pass, fail, message, queryPath, reply, timeout);
+}
+
+
+/*!
+ \internal
+ Implementation for the two public getSetting functions.
+*/
+QVariant QSystemTestPrivate::getSetting( const QString &org, const QString &app, const QString &file, const QString &group, const QString &key )
+{
+ QTestMessage message("getSetting");
+ if (!org.isNull()) message["org"] = org;
+ if (!app.isNull()) message["app"] = app;
+ if (!file.isNull()) message["path"] = file;
+ message["group"] = group;
+ message["key"] = key;
+
+ QVariant out;
+ QTestMessage reply;
+ if (!queryPassed("OK", "", BT(message), "", &reply)) return out;
+ if (!reply.contains("getSetting")) {
+ reply["status"] = "reply was missing return value";
+ p->setQueryError(reply);
+ return QVariant();
+ }
+ return reply["getSetting"];
+}
+
+/*!
+ \internal
+ Implementation for the two public setSetting functions.
+*/
+void QSystemTestPrivate::setSetting( const QString &org, const QString &app, const QString &file, const QString &group, const QString &key, const QVariant &value )
+{
+ QTestMessage message("setSetting");
+ if (!org.isNull()) message["org"] = org;
+ if (!app.isNull()) message["app"] = app;
+ if (!file.isNull()) message["path"] = file;
+ message["group"] = group;
+ message["key"] = key;
+ message["value"] = value;
+
+ queryPassed("OK", "", BT(message));
+}
+
+/*!
+ \internal
+ Processes incoming messages from the system under test
+*/
+bool QSystemTestPrivate::processMessage( QTestMessage *msg )
+{
+ if (msg->event().startsWith("key")) {
+ resetEventTimer();
+ if (recorded_events_as_code)
+ parseKeyEventToCode( msg );
+ return true;
+ } else if (msg->event().startsWith("mouse")) {
+ resetEventTimer();
+ return true;
+ } else if (msg->event() == "information") {
+ if (recorded_events_as_code)
+ recordedEvent( msg );
+ return true;
+ } else if (msg->event() == "command") {
+ if (recorded_events_as_code)
+ recordedEvent( msg );
+ return true;
+ } else if (msg->event() == "recordedEvents") {
+ recordedEvent( msg );
+ return true;
+ } else if (msg->event() == "appGainedFocus") {
+ QString new_app = (*msg)["appName"].toString();
+ if (new_app != current_application) {
+ current_application = new_app;
+ current_app_version = (*msg)["appVersion"].toString();
+ emit appGainedFocus(current_application);
+ }
+ return true;
+ } else if (msg->event() == "appBecameIdle") {
+ emit appBecameIdle((*msg)["appName"].toString());
+ }
+
+ return false;
+}
+
+struct StaticQtMetaObject : public QObject
+{
+ static const QMetaObject *get()
+ { return &static_cast<StaticQtMetaObject*> (0)->staticQtMetaObject; }
+};
+
+/*!
+ \internal
+*/
+void QSystemTestPrivate::parseKeyEventToCode( QTestMessage *msg) {
+ bool pressed = (msg->event() == "keyPress");
+
+ Qt::Key key = (Qt::Key)(*msg)["key"].toInt();
+ Qt::KeyboardModifiers mod = (Qt::KeyboardModifiers)(*msg)["mod"].toInt();
+ bool autoRepeat = (*msg)["rep"].toBool();
+ if (autoRepeat) return;
+
+ QMetaObject const *qt = StaticQtMetaObject::get();
+ QMetaEnum key_enum = qt->enumerator(qt->indexOfEnumerator("Key"));
+ char const *key_str = key_enum.valueToKey(key);
+
+ if (pressed) {
+ key_hold_started = QTime::currentTime();
+ return;
+ }
+
+ int timePressed = key_hold_started.msecsTo(QTime::currentTime());
+ bool is_script = true; //p->inherits("QScriptSystemTest",QString());
+
+ QString key_identifier = (is_script) ? "Qt." : "Qt::";
+ key_identifier += QString::fromLatin1(key_str);
+
+ QString code;
+ if (!is_script) code += "QCHECKED( ";
+ if (timePressed > 300) {
+ code += QString("keyClickhold( %1, %2 )").arg( key_identifier ).arg( timePressed );
+ } else {
+ code += QString("keyClick( %1 )").arg( key_identifier );
+ }
+ if (!is_script) code += " )";
+ code += ";";
+
+ QTestMessage out("CODE");
+ out["code"] = code;
+ recordedEvent( &out );
+}
+
+/*!
+ \internal
+*/
+bool QSystemTestPrivate::recentEventRecorded()
+{
+ if (event_timer == 0) {
+ return false;
+ } else {
+ return event_timer->elapsed() < 4800;
+ }
+}
+
+/*!
+ \internal
+*/
+void QSystemTestPrivate::resetEventTimer()
+{
+ if (event_timer == 0) {
+ event_timer = new QTime();
+ }
+
+ event_timer->start();
+}
+
+/*!
+ \internal
+ Signals the test that event recording needs to be switched on.
+*/
+void QSystemTestPrivate::recordPrompt()
+{
+ record_prompt = true;
+}
+
+void compressCode(QString &code)
+{
+ QString old_c;
+ QString c = code;
+ while (old_c != c) {
+ old_c = c;
+
+ // toggling a checkbox also causes it to be selected.
+ static QRegExp setCheckedSelect(
+ "setChecked\\( (true|false), ([^\n]+) \\);\n"
+ "select\\( \\2 \\);\n",
+ Qt::CaseSensitive, QRegExp::RegExp2);
+ while (-1 != setCheckedSelect.indexIn(c))
+ c.replace(setCheckedSelect, "setChecked( \\1, \\2 );\n");
+ static QRegExp selectSetChecked(
+ "select\\( ([^\n]+) \\);\n"
+ "setChecked\\( (true|false), \\1 \\);\n",
+ Qt::CaseSensitive, QRegExp::RegExp2);
+ while (-1 != selectSetChecked.indexIn(c))
+ c.replace(selectSetChecked, "setChecked( \\2, \\1 );\n");
+
+ // We get an enter event for each key press typically, so
+ // compress enter("f"), enter("fo"), enter("foo") into enter("foo")
+ static QRegExp enter(
+ "enter\\( [^\n]+(, [^\n]+) \\);\n"
+ "enter\\( ([^\n]+)\\1 \\);\n",
+ Qt::CaseSensitive, QRegExp::RegExp2);
+ while (-1 != enter.indexIn(c))
+ c.replace(enter, "enter( \\2\\1 );\n");
+
+ // Do the above also when there is no querypath
+ static QRegExp enter2(
+ "enter\\( \"(?:[^\"\\\\]*(?:\\\\.)*)*\" \\);\n"
+ "enter\\( \"((?:[^\"\\\\]*(?:\\\\.)*)*)\" \\);\n",
+ Qt::CaseSensitive, QRegExp::RegExp2);
+ while (-1 != enter2.indexIn(c))
+ c.replace(enter2, "enter( \"\\1\" );\n");
+
+ // We get a select tab bar event each time we switch tabs, so
+ // compress them.
+ static QRegExp selectTabBar(
+ "select\\( [^\n]+, tabBar\\(\\) \\);\n"
+ "select\\( ([^\n]+), tabBar\\(\\) \\);\n",
+ Qt::CaseSensitive, QRegExp::RegExp2);
+ while (-1 != selectTabBar.indexIn(c))
+ c.replace(selectTabBar, "select( \\1, tabBar() );\n");
+
+ // Not sure how to handle empty selects. Strip them out.
+ static QRegExp selectNothing(
+ "select\\( (\"\")? \\);\n");
+ while (-1 != selectNothing.indexIn(c))
+ c.replace(selectNothing, QString());
+
+ // Strip out redundant selects (eg, when selecting from combobox)
+ static QRegExp selectTestAbstractItemView(
+ "select\\( \"[^\n]+\", \"TestAbstractItemView\\[\\w*\\]\" \\);\n");
+ while (-1 != selectTestAbstractItemView.indexIn(c))
+ c.replace(selectTestAbstractItemView, QString());
+
+ }
+ code = c;
+}
+
+QString escapeString(QString const& in)
+{
+ QString out;
+ foreach (QChar c, in) {
+ if (c == '"')
+ out += "\\\"";
+ else if (c == '\\')
+ out += "\\\\";
+ else if (c == '\n')
+ out += "\\n";
+ else
+ out += c;
+ }
+ return out;
+}
+
+QString widgetParameter(QString const& widget)
+{
+ QString ret;
+ if (widget == SOFT_MENU_ALIAS)
+ ret = "softMenu()";
+ else if (widget == TAB_BAR_ALIAS)
+ ret = "tabBar()";
+ else if (widget == LAUNCHER_MENU_ALIAS)
+ ret = "launcherMenu()";
+ else if (widget == OPTIONS_MENU_ALIAS)
+ ret = "optionsMenu()";
+ else {
+ ret = '"' + escapeString(widget) + '"';
+ }
+ return ret;
+}
+
+QString recordedEventsToCode( QList<RecordEvent> const &events )
+{
+ QStringList statements;
+ QString focusWidget;
+ foreach (RecordEvent e, events) {
+ QString cmd;
+ switch (e.type) {
+ case RecordEvent::GotFocus:
+ // There is currently no API for simply navigating to a widget.
+ // If one were added, we would do something like this:
+ // statements << QString("setFocus( \"%1\" );").arg(e.widget);
+ focusWidget = e.widget;
+ break;
+
+ case RecordEvent::Entered:
+ cmd = QString("enter( \"%1\"").arg(escapeString(e.data.toString()));
+ if (!e.widget.isEmpty() && e.widget != focusWidget)
+ cmd += QString(", %1").arg(widgetParameter(e.widget));
+ cmd += " );";
+ statements << cmd;
+ focusWidget = e.widget;
+ break;
+
+ case RecordEvent::Activated:
+ statements << QString("select( %1 );").arg(widgetParameter(e.widget));
+ focusWidget = QString();
+ break;
+
+ case RecordEvent::Selected:
+ cmd = QString("select( \"%1\"").arg(escapeString(e.data.toString()));
+ if (!e.widget.isEmpty() && e.widget != focusWidget)
+ cmd += QString(", %1").arg(widgetParameter(e.widget));
+ cmd += " );";
+ statements << cmd;
+ focusWidget = QString();
+ break;
+
+ case RecordEvent::CheckStateChanged:
+ cmd = QString("setChecked( %1").arg(e.data.toBool() ? "true" : "false");
+ if (!e.widget.isEmpty() && e.widget != focusWidget)
+ cmd += QString(", %1").arg(widgetParameter(e.widget));
+ cmd += " );";
+ statements << cmd;
+ focusWidget = e.widget;
+ break;
+
+ case RecordEvent::TitleChanged:
+ statements << QString("waitForTitle( \"%1\" );").arg(escapeString(e.data.toString()));
+ focusWidget = QString();
+ break;
+
+ case RecordEvent::MessageBoxShown: {
+ QVariantMap map = e.data.toMap();
+ QString title = map["title"].toString();
+ QString text = map["text"].toString();
+ statements << QString("// Message box shown, title: \"%1\", text: \"%2\"").arg(escapeString(title)).arg(escapeString(text));
+ focusWidget = QString();
+ break;
+ }
+
+ default:
+ statements << QString("// unknown event: %1 %2 %3").arg(e.type).arg(widgetParameter(e.widget)).arg(escapeString(e.data.toString()));
+ break;
+ }
+ }
+
+ return statements.join("\n");
+}
+
+/*!
+ \internal
+*/
+void QSystemTestPrivate::recordedEvent( QTestMessage *msg ) {
+ if (msg->event() == "recordedEvents") {
+ recordEvents( (*msg)["events"].value< QList<RecordEvent> >() );
+ }
+}
+
+void QSystemTestPrivate::recordEvents(QList<RecordEvent> const& events)
+{
+ recorded_events << events;
+ QString out = recordedEventsToCode( recorded_events );
+ recorded_events.clear();
+ if (!out.isEmpty()) {
+ recorded_code += out + "\n";
+
+ // For debugging purposes, allow code compression to be skipped.
+ static bool skip_compression = !qgetenv("QTUITEST_DEBUG_RECORD").isEmpty();
+ if (!skip_compression) compressCode(recorded_code);
+ if (recorded_events_edit && recorded_events_edit->isVisible()) {
+ recorded_events_edit->setPlainText(recorded_code);
+ recorded_events_edit->moveCursor(QTextCursor::End);
+ recorded_events_edit->ensureCursorVisible();
+ }
+ if (qtest_ide.isConnected()) {
+ QTestMessage ide_msg("recordedCode");
+ ide_msg["code"] = recorded_code;
+ qtest_ide.postMessage( ide_msg );
+ }
+ }
+}
+
+QString QSystemTestPrivate::processEnvironment( QString const& in ) const
+{
+ struct SystemEnvironment {
+ static QMap<QString,QString> get() {
+ QMap<QString,QString> ret;
+ QStringList env = QProcess::systemEnvironment();
+ foreach (QString str, env) {
+ if (str.contains('=')) {
+ ret[str.left(str.indexOf('=')).toUpper()] = str.mid(str.indexOf('=') + 1);
+ }
+ }
+ return ret;
+ }
+ };
+ static const QMap<QString,QString> environment( SystemEnvironment::get() );
+
+ QString out;
+ static QRegExp re("\\$[{(]?([A-Za-z0-9_]+)[})]?");
+ int offset = 0;
+ while (true) {
+ int index = re.indexIn(in, offset);
+ if (-1 == index) {
+ out += in.mid(offset);
+ break;
+ }
+ out += in.mid(offset, index - offset);
+ out += environment.value(re.cap(1).toUpper());
+ offset += re.matchedLength();
+ }
+
+ return out;
+}
+
+QStringList QSystemTestPrivate::processEnvironment( QStringList const& in ) const
+{
+ QStringList out;
+ foreach (QString string, in) {
+ out << processEnvironment(string);
+ }
+ return out;
+}
diff --git a/libqsystemtest/qsystemtest_p.h b/libqsystemtest/qsystemtest_p.h
new file mode 100644
index 0000000..a6108a7
--- /dev/null
+++ b/libqsystemtest/qsystemtest_p.h
@@ -0,0 +1,189 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSYSTEMTEST_P_H
+#define QSYSTEMTEST_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtUiTest API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QObject>
+#include "qtestremote_p.h"
+#include "qtestprotocol_p.h"
+#include "recordevent_p.h"
+#include <QStringList>
+#include <qsystemtest.h>
+
+class QProcess;
+class QSystemTestMail;
+class QSystemTestMaster;
+class QTextEdit;
+
+class QSystemTestPrivate : public QObject
+{
+Q_OBJECT
+public slots:
+ void recordPrompt();
+
+ bool recentEventRecorded();
+ void resetEventTimer();
+
+signals:
+ void appGainedFocus(QString const &appName);
+ void appBecameIdle(QString const &appName);
+
+public:
+ QSystemTestPrivate(QSystemTest *parent);
+ virtual ~QSystemTestPrivate();
+
+ virtual bool processMessage( QTestMessage *msg );
+ bool recordEvents( const QString &manualSteps = QString() );
+
+public slots:
+ QTestMessage query( const QTestMessage &message, const QString &queryPath = QString(), int timeout = DEFAULT_QUERY_TIMEOUT );
+ bool queryPassed( const QStringList &passResult, const QStringList &failResult,
+ const QTestMessage &message, const QString &queryPath = QString(), QTestMessage *reply = 0, int timeout = DEFAULT_QUERY_TIMEOUT );
+ bool queryPassed( const QString &passResult, const QString &failResult,
+ const QTestMessage &message, const QString &queryPath = QString(), QTestMessage *reply = 0, int timeout = DEFAULT_QUERY_TIMEOUT );
+
+public:
+ void recordedEvent( QTestMessage *msg );
+ void recordEvents( QList<RecordEvent> const& );
+ void parseKeyEventToCode( QTestMessage *msg);
+
+ QVariant getSetting(const QString&,const QString&,const QString&,const QString&,const QString&);
+ void setSetting(const QString&,const QString&,const QString&,const QString&,const QString&,const QVariant&);
+
+ bool imagesAreEqual( const QImage &actual, const QImage &expected, bool strict = false );
+ bool learnImage( const QImage &actual, const QImage &expected, const QString &comment = QString());
+
+ QString processEnvironment( QString const& ) const;
+ QStringList processEnvironment( QStringList const& ) const;
+
+ QTime *event_timer;
+ QList<QPointer<QProcess> > aut;
+ QStringList remote_aut;
+ QTime key_hold_started;
+ QSystemTestMaster *test_app;
+ QTestMessage error_msg;
+ QTestMessage error_msg_sent;
+ QTestMessage last_msg_sent;
+
+ QTimer *key_enter_timer;
+
+ QPointer<QTextEdit> recorded_events_edit;
+
+ bool recorded_events_as_code;
+ bool record_prompt;
+ bool query_failed;
+ bool query_warning_mode;
+ int fatal_timeouts;
+ int timeouts;
+
+ Qt::Key keyclickhold_key;
+ QString keyclickhold_path;
+ QString current_application;
+ QString current_app_version;
+
+ QString loc_fname;
+ int loc_line;
+ class ExpectedMessageBox {
+ public:
+ QString test_function;
+ QString data_tag;
+ QString title;
+ QString text;
+ QString option;
+ };
+ QList<ExpectedMessageBox*> expected_msg_boxes;
+
+ bool auto_mode;
+
+ // the following parameters are used to start an Application_Under_Test
+ QString aut_host;
+ quint16 aut_port;
+ bool keep_aut;
+ bool silent_aut;
+ bool no_aut;
+ bool demo_mode;
+ bool verbose_perf;
+ bool verbose;
+
+ QStringList env;
+
+ QTestRemote qtest_ide;
+
+ QMap<QString, QString> appNameToBinary;
+
+ QMap<QString, int> filteredMessages;
+
+ static QSystemTest* singleton;
+ bool strict_mode;
+ int visible_response_time;
+
+ QList<RecordEvent> recorded_events;
+ QString recorded_code;
+ int display_id;
+ QString device;
+ bool mousePreferred;
+ QRect screenGeometry;
+ QString theme;
+ QString config_id;
+ bool got_startup_info;
+ bool recording_events;
+ bool expect_app_close;
+ int sample_memory_interval;
+ int query_count;
+ int prompt_count;
+ bool skip_current_function;
+
+ QSystemTest *p;
+};
+
+#endif
diff --git a/libqsystemtest/qsystemtestmaster.cpp b/libqsystemtest/qsystemtestmaster.cpp
new file mode 100644
index 0000000..731ffca
--- /dev/null
+++ b/libqsystemtest/qsystemtestmaster.cpp
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qsystemtestmaster_p.h"
+
+#include <qsystemtest.h>
+#include "qsystemtest_p.h"
+
+#include <QFile>
+#include <QDir>
+#include <QTextStream>
+#include <QIODevice>
+
+// **************************************************************************************
+// **************************************************************************************
+
+QSystemTestMaster::QSystemTestMaster( QSystemTestPrivate *testCase )
+ : QTestProtocol()
+ , app_name()
+ , app_version()
+ , qt_version()
+ , test_case(testCase)
+{
+}
+
+QSystemTestMaster::~QSystemTestMaster()
+{
+}
+
+void QSystemTestMaster::queryName()
+{
+ QTestMessage reply;
+ sendMessage(QTestMessage("appName"), reply, 40000);
+ app_name = reply["appName"].toString();
+ app_version = reply["appVersion"].toString();
+ qt_version = reply["qtVersion"].toString();
+}
+
+void QSystemTestMaster::processMessage( QTestMessage *msg )
+{
+ if (msg->event() == "APP_NAME") {
+ app_name = (*msg)["appName"].toString();
+ app_version = (*msg)["appVersion"].toString();
+ qt_version = (*msg)["qtVersion"].toString();
+ } else {
+ // Leave all processing to the testcase
+ if (test_case != 0) {
+ test_case->p->processMessage( *msg );
+ }
+ }
+}
+
+QString QSystemTestMaster::appName()
+{
+ return app_name;
+}
+
+QString QSystemTestMaster::appVersion()
+{
+ return app_version;
+}
+
+QString QSystemTestMaster::qtVersion()
+{
+ return qt_version;
+}
+
+void QSystemTestMaster::onReplyReceived( QTestMessage * /*reply*/ )
+{
+}
+
diff --git a/libqsystemtest/qsystemtestmaster_p.h b/libqsystemtest/qsystemtestmaster_p.h
new file mode 100644
index 0000000..1ae6b64
--- /dev/null
+++ b/libqsystemtest/qsystemtestmaster_p.h
@@ -0,0 +1,110 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSYSTEMTESTMASTER_P_H
+#define QSYSTEMTESTMASTER_P_H
+
+#include "qtestprotocol_p.h"
+#include <QObject>
+#include <qtuitestglobal.h>
+
+class QSystemTestPrivate;
+
+class QSYSTEMTEST_EXPORT QSystemTestMaster : public QTestProtocol
+{
+public:
+ QSystemTestMaster( QSystemTestPrivate *testCase );
+ virtual ~QSystemTestMaster();
+
+ QString appName();
+ QString appVersion();
+ QString qtVersion();
+
+ virtual void onReplyReceived( QTestMessage *reply );
+
+protected:
+ virtual void processMessage( QTestMessage *msg );
+
+private:
+ void queryName();
+ QString app_name;
+ QString app_version;
+ QString qt_version;
+ QSystemTestPrivate *test_case;
+};
+
+/*
+class QTUITEST_EXPORT QSystemTestMasterServer: public QTestServerSocket
+{
+ Q_OBJECT
+public:
+ QSystemTestMasterServer( quint16 port, QSystemTest *testCase );
+ virtual ~QSystemTestMasterServer();
+
+ //static void delayConnection();
+
+ bool waitForApp( const QString &appName, uint timeOut );
+ QSystemTestMaster *findApp( const QString &appName );
+ QSystemTestMaster *getApp( uint index );
+ uint appCount() { return app_count; };
+
+protected:
+ virtual void onNewConnection( int socket );
+ bool appendApp( QSystemTestMaster *app );
+ //static void savePortInfo( int port );
+
+protected slots:
+ void connectionClosed( QTestProtocol *socket );
+
+signals:
+ void newGuiClient( QSystemTestMaster *newApp );
+
+private:
+ // FIXME: Should use QList here
+ #define MAX_APPS 50
+ QSystemTestMaster *apps[MAX_APPS];
+ uint app_count;
+ QSystemTest *test_case;
+};
+*/
+
+#endif
+
diff --git a/libqsystemtest/qtestremote.cpp b/libqsystemtest/qtestremote.cpp
new file mode 100644
index 0000000..8aae353
--- /dev/null
+++ b/libqsystemtest/qtestremote.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qtestremote_p.h"
+
+#include <stdlib.h> // used for exit
+
+QTestRemote::QTestRemote()
+{
+ must_stop_event_recording = false;
+ event_recording_aborted = false;
+}
+
+QTestRemote::~QTestRemote()
+{
+}
+
+void QTestRemote::processMessage( QTestMessage *msg )
+{
+ if (msg->event() == "stopEventRecording") {
+ must_stop_event_recording = true;
+ } else if (msg->event() == "eventRecordingAborted") {
+ must_stop_event_recording = true;
+ event_recording_aborted = true;
+ } else if (msg->event() == "abort") {
+ emit abort();
+ }
+}
+
+/*!
+ \internal
+ Opens a socket connection to a remote test tool and uses the connection to
+ communicate with the connected tool.
+*/
+void QTestRemote::openRemote( const QString &ip, int port )
+{
+ connect( ip, port );
+ if (!waitForConnected(5000)) {
+ // it really doesn't make sense to continue testing if we cannot communicate with the remote tool so we abort immediately.
+ exit( REMOTE_CONNECT_ERROR );
+ }
+}
+
diff --git a/libqsystemtest/qtestremote_p.h b/libqsystemtest/qtestremote_p.h
new file mode 100644
index 0000000..0acec07
--- /dev/null
+++ b/libqsystemtest/qtestremote_p.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTESTREMOTE_P_H
+#define QTESTREMOTE_P_H
+
+#include "qtestprotocol_p.h"
+#include <qtuitestglobal.h>
+
+class QString;
+
+class QSYSTEMTEST_EXPORT QTestRemote : public QTestProtocol
+{
+ Q_OBJECT
+
+public:
+ QTestRemote();
+ virtual ~QTestRemote();
+
+ void openRemote( const QString &ip, int port );
+ virtual void processMessage( QTestMessage *msg );
+
+ bool must_stop_event_recording;
+ bool event_recording_aborted;
+
+signals:
+ void abort();
+};
+
+#endif
+
diff --git a/libqsystemtest/qtestverifydlg.cpp b/libqsystemtest/qtestverifydlg.cpp
new file mode 100644
index 0000000..da4f8fe
--- /dev/null
+++ b/libqsystemtest/qtestverifydlg.cpp
@@ -0,0 +1,174 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qtestverifydlg_p.h"
+
+#include <QLabel>
+#include <QPushButton>
+#include <QDesktopWidget>
+#include <QLayout>
+#include <QPixmap>
+#include <QTabWidget>
+
+
+#define WIDTH 364
+#define HEIGHT 310
+
+QTestVerifyDlg::QTestVerifyDlg( QWidget* parent )
+ : QDialog( parent )
+{
+
+// resize( WIDTH, HEIGHT );
+
+ QVBoxLayout *mainLayout = new QVBoxLayout( this );
+ mainLayout->setMargin(11);
+ mainLayout->setSpacing(6);
+
+ commentLabel = new QLabel();
+ commentLabel->setAlignment( Qt::AlignCenter );
+ mainLayout->addWidget( commentLabel );
+
+ QHBoxLayout *pixLayout = new QHBoxLayout;
+ pixLayout->setMargin(0);
+ pixLayout->setSpacing(6);
+
+ tabWidget = new QTabWidget();
+ tabWidget->setTabPosition( QTabWidget::South );
+
+ pixLayout->addItem( new QSpacerItem( 12, 12, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
+ pixLayout->addWidget( tabWidget );
+ pixLayout->addItem( new QSpacerItem( 12, 12, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
+ mainLayout->addLayout( pixLayout );
+ mainLayout->addItem( new QSpacerItem( 16, 16, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
+ QHBoxLayout *buttonLayout = new QHBoxLayout;
+ buttonLayout->setMargin(0);
+ buttonLayout->setSpacing(6);
+ okButton = new QPushButton();
+ buttonLayout->addWidget( okButton );
+ cancelButton = new QPushButton();
+ buttonLayout->addWidget( cancelButton );
+ buttonLayout->addItem( new QSpacerItem( 16, 16, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
+ mainLayout->addLayout( buttonLayout );
+
+ // signals and slots connections
+ connect( okButton, SIGNAL(clicked()), this, SLOT(accept()), Qt::DirectConnection );
+ connect( cancelButton, SIGNAL(clicked()), this, SLOT(reject()), Qt::DirectConnection );
+
+ okButton->setText( "Yes" );
+ cancelButton->setText( "No" );
+ setWindowTitle( "Verify Pixmap" );
+// questionText = "Does the 'Actual' tab show the correct output?\n ";
+// questionLabel->setText(questionText);
+}
+
+/*
+ Destroys the object and frees any allocated resources
+*/
+QTestVerifyDlg::~QTestVerifyDlg()
+{
+ //hide();
+}
+
+void QTestVerifyDlg::setComment( const QString &text )
+{
+ commentLabel->setText(text);
+}
+
+void QTestVerifyDlg::addTab( const QString &name, const QPixmap &img )
+{
+ QLabel *label = new QLabel();
+ label->setObjectName( name + "Label" );
+
+ QSizePolicy sizePolicy = QSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );
+ sizePolicy.setHorizontalStretch(0);
+ sizePolicy.setVerticalStretch(0);
+ sizePolicy.setHeightForWidth(label->sizePolicy().hasHeightForWidth());
+
+ label->setSizePolicy( sizePolicy );
+ label->setFrameShape( QLabel::Box );
+ label->setFrameShadow( QLabel::Sunken );
+ label->setScaledContents( false );
+ label->setAlignment( Qt::AlignCenter );
+
+ if (!img.isNull()) {
+ label->setPixmap(img);
+ } else {
+ label->setText("No image available");
+ }
+
+ tabWidget->addTab( label, name );
+ updateGeometry();
+}
+/*
+void QTestVerifyDlg::setData( const QPixmap &actual, const QPixmap &expected,
+ const QPixmap &diff, const QString &comment)
+{
+ questionLabel->setText(questionText + comment);
+ if (!actual.isNull())
+ actualLabel->setPixmap(actual);
+
+ bool expectedValid = true;
+ if (!expected.isNull()) {
+ expectedLabel->setPixmap(expected);
+ if (!diff.isNull()) {
+ diffLabel->setPixmap(diff);
+ }
+ }
+ else {
+ QString S = "No expected pixmap available";
+ expectedLabel->setText( S );
+ QSize s1 = actualLabel->sizeHint();
+ QSize s2 = expectedLabel->sizeHint();
+ while (s1.width() > s2.width()) {
+ S = " " + S + " ";
+ expectedLabel->setText( S );
+ s1 = actualLabel->sizeHint();
+ s2 = expectedLabel->sizeHint();
+ }
+ S+="\n\nIf you click on 'Yes' the LEFT pixmap\nwill become the expected pixmap\nand will be used for future comparisons.";
+ expectedLabel->setText( S );
+
+ expectedValid = false;
+ }
+
+ updateGeometry();
+}
+*/ \ No newline at end of file
diff --git a/libqsystemtest/qtestverifydlg_p.h b/libqsystemtest/qtestverifydlg_p.h
new file mode 100644
index 0000000..529e572
--- /dev/null
+++ b/libqsystemtest/qtestverifydlg_p.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTESTVERIFYDLG_P_H
+#define QTESTVERIFYDLG_P_H
+
+#include <QDialog>
+#include <qtuitestglobal.h>
+
+class QLabel;
+class QPushButton;
+class QTabWidget;
+
+class QSYSTEMTEST_EXPORT QTestVerifyDlg : public QDialog
+{
+ Q_OBJECT
+
+public:
+ QTestVerifyDlg(QWidget* parent = 0);
+ ~QTestVerifyDlg();
+
+ void setComment( const QString& );
+ void addTab( const QString&, const QPixmap& );
+// void setData( const QPixmap&, const QPixmap&, const QPixmap&, const QString& = QString() );
+
+private:
+ QLabel *commentLabel;
+ QTabWidget *tabWidget;
+ QPushButton *okButton;
+ QPushButton *cancelButton;
+
+// QString questionText;
+};
+
+#endif
diff --git a/libqsystemtest/recorddlg.ui b/libqsystemtest/recorddlg.ui
new file mode 100644
index 0000000..3f2178b
--- /dev/null
+++ b/libqsystemtest/recorddlg.ui
@@ -0,0 +1,108 @@
+<ui version="4.0" >
+ <class>RecordDialog</class>
+ <widget class="QDialog" name="RecordDialog" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>562</width>
+ <height>314</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>System Test</string>
+ </property>
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QLabel" name="steps_label" >
+ <property name="text" >
+ <string>Manual steps to record</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTextEdit" name="steps_view" >
+ <property name="readOnly" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Events are now being recorded and scripting code will be added to the field below. When you have finished recording events, copy the text from the field and click 'Stop'.</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTextEdit" name="codeEdit" >
+ <property name="font" >
+ <font>
+ <family>Courier New</family>
+ <pointsize>10</pointsize>
+ </font>
+ </property>
+ <property name="readOnly" >
+ <bool>true</bool>
+ </property>
+ <property name="acceptRichText" >
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QPushButton" name="abort_button" >
+ <property name="text" >
+ <string>Abort</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>371</width>
+ <height>26</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="stopButton" >
+ <property name="text" >
+ <string>Stop</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>stopButton</sender>
+ <signal>clicked()</signal>
+ <receiver>RecordDialog</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>504</x>
+ <y>291</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>419</x>
+ <y>295</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
diff --git a/libqtslave/DESCRIPTION b/libqtslave/DESCRIPTION
new file mode 100644
index 0000000..6af32e1
--- /dev/null
+++ b/libqtslave/DESCRIPTION
@@ -0,0 +1 @@
+QtUitest test slave for Qt applications.
diff --git a/libqtslave/libqtslave.pro b/libqtslave/libqtslave.pro
new file mode 100644
index 0000000..6615dca
--- /dev/null
+++ b/libqtslave/libqtslave.pro
@@ -0,0 +1,45 @@
+VPATH+=$$PWD
+INCLUDEPATH+=$$PWD
+
+HEADERS += \
+ qtestslave.h \
+ qtestslaveglobal.h \
+ qtestwidgets.h
+
+SOURCES += \
+ qtestslave.cpp \
+ qtestwidgets.cpp
+
+TEMPLATE=lib
+INCLUDEPATH+=$$SRCROOT/libqtuitest
+TARGET=qtslave
+TARGET=$$qtLibraryTarget($$TARGET)
+QT+=network
+DEFINES+=QTSLAVE_TARGET
+
+unix:!symbian {
+ MOC_DIR=$$OUT_PWD/.moc
+ OBJECTS_DIR=$$OUT_PWD/.obj
+ DESTDIR=$$BUILDROOT/lib
+}
+
+symbian {
+ TARGET.EPOCALLOWDLLDATA=1
+ TARGET.CAPABILITY += AllFiles ReadDeviceData ReadUserData SwEvent WriteUserData NetworkServices
+ MOC_DIR=$$OUT_PWD/moc
+ OBJECTS_DIR=$$OUT_PWD/obj
+ LIBS+=-lqtuitest.lib -lws32 -leuser -lcone
+ CONFIG+=staticlib
+}
+
+win32 {
+ CONFIG(debug,debug|release): LIBS+=-L$$BUILDROOT/libqtuitest -lqtuitestd
+ CONFIG(release,debug|release):LIBS+=-L$$BUILDROOT/libqtuitest -lqtuitest
+ target.path=$$INSTALLROOT
+ INSTALLS+=target
+}
+
+mac {
+ LIBS+=-L$$BUILDROOT/lib -lqtuitest
+}
+
diff --git a/libqtslave/qtestslave.cpp b/libqtslave/qtestslave.cpp
new file mode 100644
index 0000000..502d398
--- /dev/null
+++ b/libqtslave/qtestslave.cpp
@@ -0,0 +1,1771 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtestslave.h>
+#include <qtestslaveglobal.h>
+#include <qtestwidgets.h>
+#include <qtuitestnamespace.h>
+#include <qtuitestrecorder.h>
+
+#include <QWidget>
+#include <QPixmap>
+#include <QApplication>
+#include <QDir>
+#include <QVariant>
+#include <QMetaProperty>
+#include <QMetaObject>
+#include <QMetaType>
+#include <QPoint>
+#include <QProcess>
+#include <QSettings>
+#include <QLocale>
+#include <QDebug>
+#include <QPainter>
+
+#ifndef QT_NO_CLIPBOARD
+# include <QClipboard>
+#endif
+
+#define qLog(A) if(1); else qDebug() << #A
+
+#ifdef Q_OS_UNIX
+# include <sys/time.h>
+#endif
+
+#include <qalternatestack_p.h>
+
+using namespace QtUiTest;
+
+template <typename T>
+T* findTestWidget(QTestMessage const& message)
+{
+ using namespace QtUiTest;
+ T* ret = 0;
+ QTestMessage reply;
+ QString error;
+ QString qp = message["queryPath"].toString();
+ QObject *o;
+ if (!QActiveTestWidget::instance()->findWidget( qp, o, error)) {
+ setErrorString(error);
+ return ret;
+ }
+
+ ret = qtuitest_cast<T*>(o);
+ if (!ret) {
+ setErrorString(QString("Error: %1 is not of type %2").arg(qp).arg(static_cast<T*>(0)->_q_interfaceName()));
+ } else {
+ setErrorString(QString());
+ }
+
+ return ret;
+}
+
+/* Handler for test messages */
+class QTestSlavePrivate : public QObject
+{
+Q_OBJECT
+public:
+ QTestSlavePrivate(QTestSlave *parent)
+ : eventRecordingEnabled(false),
+ p(parent),
+ recorder(this)
+ {}
+
+ bool event(QEvent *e);
+ bool waitForIdle(int timeout = 10000);
+ QString recursiveDelete(QString const&) const;
+ void startWaitForIdle(int);
+ static void processMessage(QAlternateStack*,QVariant const&);
+ QPoint mousePointForMessage(QTestMessage const&,QTestMessage&,bool&);
+
+ bool eventRecordingEnabled;
+ QTestSlave *p;
+ QTime lastFocusWarn;
+ QtUiTestRecorder recorder;
+
+public slots:
+ void record_entered(QObject*, QVariant const&);
+ void record_selected(QObject*, QString const&);
+ void record_activated(QObject*);
+ void record_stateChanged(QObject*, int);
+ void record_gotFocus(QObject*);
+
+ QTestMessage widget (QTestMessage const&);
+
+ QTestMessage currentTitle (QTestMessage const&);
+ QTestMessage getWindowTitles (QTestMessage const&);
+ QTestMessage activateWindow (QTestMessage const&);
+ QTestMessage appName (QTestMessage const&);
+ QTestMessage isVisible (QTestMessage const&);
+
+ QTestMessage startEventRecording(QTestMessage const&);
+ QTestMessage stopEventRecording (QTestMessage const&);
+
+ QTestMessage activeWindow (QTestMessage const&);
+ QTestMessage focusWidget (QTestMessage const&);
+ QTestMessage hasFocus (QTestMessage const&);
+
+ QTestMessage grabPixmap (QTestMessage const&);
+ QTestMessage getSelectedText (QTestMessage const&);
+ QTestMessage getText (QTestMessage const&);
+ QTestMessage getSelectedValue (QTestMessage const&);
+ QTestMessage getValue (QTestMessage const&);
+ QTestMessage getCenter (QTestMessage const&);
+ QTestMessage getList (QTestMessage const&);
+ QTestMessage getLabels (QTestMessage const&);
+
+ QTestMessage isChecked (QTestMessage const&);
+ QTestMessage setChecked (QTestMessage const&);
+ QTestMessage checkState (QTestMessage const&);
+ QTestMessage setCheckState (QTestMessage const&);
+
+ QTestMessage enter (QTestMessage const&);
+ QTestMessage select (QTestMessage const&);
+ QTestMessage selectIndex (QTestMessage const&);
+ QTestMessage getSelectedIndex (QTestMessage const&);
+ QTestMessage activate (QTestMessage const&);
+ QTestMessage ensureVisible (QTestMessage const&);
+
+ QTestMessage activeWidgetInfo (QTestMessage const&);
+
+ QTestMessage invokeMethod (QTestMessage const&);
+ QTestMessage setProperty (QTestMessage const&);
+ QTestMessage getProperty (QTestMessage const&);
+ QTestMessage findByProperty (QTestMessage const&);
+ QTestMessage findByProperties (QTestMessage const&);
+
+ QTestMessage getSetting (QTestMessage const&);
+ QTestMessage setSetting (QTestMessage const&);
+
+ QTestMessage getClipboardText (QTestMessage const&);
+ QTestMessage setClipboardText (QTestMessage const&);
+
+ QTestMessage mousePreferred (QTestMessage const&);
+ QTestMessage setMousePreferred (QTestMessage const&);
+ QTestMessage labelOrientation (QTestMessage const&);
+ QTestMessage setLabelOrientation(QTestMessage const&);
+
+ QTestMessage putFile (QTestMessage const&);
+ QTestMessage getFile (QTestMessage const&);
+ QTestMessage deletePath (QTestMessage const&);
+ QTestMessage getDirectoryEntries(QTestMessage const&);
+
+ QTestMessage getImageSize (QTestMessage const&);
+ QTestMessage getGeometry (QTestMessage const&);
+ QTestMessage setSystemTime (QTestMessage const&);
+ QTestMessage systemTime (QTestMessage const&);
+
+ QTestMessage waitForIdle (QTestMessage const&);
+
+ QTestMessage keyPress (QTestMessage const&);
+ QTestMessage keyRelease (QTestMessage const&);
+ QTestMessage keyClick (QTestMessage const&);
+
+ QTestMessage mousePress (QTestMessage const&);
+ QTestMessage mouseRelease (QTestMessage const&);
+ QTestMessage mouseClick (QTestMessage const&);
+
+ QTestMessage translate (QTestMessage const&);
+ QTestMessage getLocale (QTestMessage const&);
+ QTestMessage getenv (QTestMessage const&);
+ QTestMessage checkOS (QTestMessage const&);
+
+ void sendBecameIdleMessage();
+
+signals:
+ void applicationBecameIdle();
+};
+
+class IdleEvent : public QEvent
+{
+public:
+ enum EventType { Type = QEvent::User + 10 };
+ IdleEvent(QTime itime, int itimeout)
+ : QEvent( (QEvent::Type)Type ), time(itime), timeout(itimeout) {}
+
+ QTime time;
+ int timeout;
+};
+
+#include "qtestslave.moc"
+
+#define RET(message, str) (\
+ message["status"] = str,\
+ message["location"] = QString("%1:%2%3").arg(__FILE__).arg(__LINE__).arg(!message["location"].toString().isEmpty() ? "\n" + message["location"].toString() : ""),\
+ message)
+
+QTestSlave::QTestSlave()
+ : QTestProtocol()
+ , d(new QTestSlavePrivate(this))
+{
+ // Stop text cursors from flashing so that we can take reproducible screen shots
+ QApplication::setCursorFlashTime(0);
+ QtUiTest::testInputOption(QtUiTest::NoOptions);
+}
+
+QTestSlave::~QTestSlave()
+{
+ delete d;
+ disconnect();
+}
+
+void QTestSlave::onConnected()
+{
+ QTestProtocol::onConnected();
+ QTestMessage msg("APP_NAME");
+ msg["appName"] = qApp->applicationName();
+ msg["appVersion"] = qApp->applicationVersion();
+ msg["qtVersion"] = QT_VERSION_STR;
+ postMessage( msg );
+}
+
+void QTestSlave::setRecordingEvents(bool on)
+{
+ d->eventRecordingEnabled = on;
+ if (on) {
+ QObject::connect(&d->recorder, SIGNAL(entered(QObject*,QVariant)),
+ d, SLOT(record_entered(QObject*,QVariant)));
+ QObject::connect(&d->recorder, SIGNAL(selected(QObject*,QString)),
+ d, SLOT(record_selected(QObject*,QString)));
+ QObject::connect(&d->recorder, SIGNAL(gotFocus(QObject*)),
+ d, SLOT(record_gotFocus(QObject*)));
+ QObject::connect(&d->recorder, SIGNAL(activated(QObject*)),
+ d, SLOT(record_activated(QObject*)));
+ QObject::connect(&d->recorder, SIGNAL(stateChanged(QObject*,int)),
+ d, SLOT(record_stateChanged(QObject*,int)));
+ } else {
+ QObject::disconnect(&d->recorder, 0, d, 0);
+ }
+}
+
+bool QTestSlave::recordingEvents() const
+{ return d->eventRecordingEnabled; }
+
+QTestMessage QTestSlavePrivate::currentTitle(QTestMessage const&)
+{
+ QTestMessage reply;
+
+ QObject* focus = qApp->focusWidget();
+ QtUiTest::Widget* w = qtuitest_cast<QtUiTest::Widget*>(focus);
+ while (w && !(w->windowFlags() & Qt::Window) && w->parent()) {
+ w = qtuitest_cast<QtUiTest::Widget*>(w->parent());
+ }
+ if (w) {
+ reply["currentTitle"] = w->windowTitle();
+ reply["status"] = "OK";
+ } else if (!focus) {
+ reply["status"] = "Could not get current window title: could not find currently focused widget!";
+ } else {
+ reply["status"] = "Could not get current window title: could not find a top-level QtUiTest::Widget!";
+ }
+ return reply;
+}
+
+QTestMessage QTestSlavePrivate::getWindowTitles(QTestMessage const&)
+{
+ QTestMessage reply;
+ reply["getWindowTitles"] = QActiveTestWidget::instance()->getWindowTitles();
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::activateWindow(QTestMessage const &message)
+{
+ QTestMessage reply;
+ QWidget *window = QActiveTestWidget::instance()->findWindow(message["window"].toString());
+ if (window) {
+ if (window != qApp->activeWindow()) {
+ window->activateWindow();
+ window->raise();
+ for (int i=0; i<10; ++i) {
+ QtUiTest::wait(50);
+ if (window == qApp->activeWindow()) break;
+ }
+ if (window != qApp->activeWindow()) {
+ return RET(reply, "Could not activate window \"" + message["window"].toString() + "\"");
+ }
+ }
+ } else {
+ return RET(reply, "Could not find window \"" + message["window"].toString() + "\"");
+ }
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::grabPixmap(QTestMessage const &message)
+{
+ QTestMessage reply;
+ QPixmap pix;
+
+ Widget *tw = 0;
+ if (!message["queryPath"].toString().isEmpty()) {
+ tw = findTestWidget<Widget>(message);
+ } else {
+ tw = qtuitest_cast<Widget*>(qApp->activeWindow());
+ }
+
+ if (tw) {
+ tw->grabPixmap(pix);
+
+ if (!message["mask"].toStringList().isEmpty()) {
+ QPainter painter(&pix);
+ painter.setBrush(Qt::black);
+ QString error;
+ foreach (QString maskStr, message["mask"].toStringList()) {
+ QObject *o;
+ if (!QActiveTestWidget::instance()->findWidget( maskStr, o, error)) {
+ setErrorString(error);
+ break;
+ }
+ QtUiTest::Widget *w = qtuitest_cast<Widget*>(o);
+ if (!w) {
+ return RET(reply, "Could not find masked widget \"" + maskStr + "\"");
+ }
+ QRect rect = w->geometry();
+ rect.moveTo( tw->mapFromGlobal(w->mapToGlobal( QPoint(0,0) )) );
+ painter.drawRect(rect);
+ }
+ }
+ } else {
+ if (QtUiTest::errorString().isEmpty())
+ return RET(reply, "Widget not found");
+ }
+
+ reply["grabPixmap"] = pix;
+
+ if (!QtUiTest::errorString().isEmpty())
+ return RET(reply, QtUiTest::errorString());
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::activeWidgetInfo(QTestMessage const &message)
+{
+ Q_UNUSED(message);
+ QTestMessage reply;
+ QString error;
+ if (!QActiveTestWidget::instance()->rescan(error)) {
+ return RET(reply, error);
+ }
+ reply["activeWidgetInfo"] = QActiveTestWidget::instance()->toString();
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::getSelectedText(QTestMessage const &message)
+{
+ QTestMessage reply;
+ TextWidget *tw = findTestWidget<TextWidget>(message);
+ if (tw) {
+ reply["getSelectedText"] = tw->selectedText();
+ }
+
+ if (!QtUiTest::errorString().isEmpty())
+ return RET(reply, QtUiTest::errorString());
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::getText(QTestMessage const &message)
+{
+ QTestMessage reply;
+ TextWidget *tw = findTestWidget<TextWidget>(message);
+ if (tw) {
+ reply["getText"] = tw->text();
+ }
+
+ if (!QtUiTest::errorString().isEmpty())
+ return RET(reply, QtUiTest::errorString());
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::getSelectedValue(QTestMessage const &message)
+{
+ QTestMessage reply;
+ TextWidget *tw = findTestWidget<TextWidget>(message);
+ if (tw) {
+ reply["getSelectedValue"] = tw->selectedValue();
+ }
+
+ if (!QtUiTest::errorString().isEmpty())
+ return RET(reply, QtUiTest::errorString());
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::getValue(QTestMessage const &message)
+{
+ QTestMessage reply;
+ TextWidget *tw = findTestWidget<TextWidget>(message);
+ if (tw) {
+ reply["getValue"] = tw->value();
+ }
+
+ if (!QtUiTest::errorString().isEmpty())
+ return RET(reply, QtUiTest::errorString());
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::getList(QTestMessage const &message)
+{
+ QTestMessage reply;
+ ListWidget *lw = findTestWidget<ListWidget>(message);
+ if (lw) {
+ reply["getList"] = lw->list();
+ }
+
+ if (!QtUiTest::errorString().isEmpty())
+ return RET(reply, QtUiTest::errorString());
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::getLabels(QTestMessage const &/*message*/)
+{
+ QTestMessage reply;
+ QString error;
+ if (!QActiveTestWidget::instance()->rescan(error)) {
+ return RET(reply, error);
+ }
+ reply["getLabels"] = QActiveTestWidget::instance()->allLabels();
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::isVisible(QTestMessage const &message)
+{
+ QTestMessage reply;
+ Widget *w = findTestWidget<Widget>(message);
+ if (w) {
+ reply["isVisible"] = !(w->visibleRegion() | w->childrenVisibleRegion()).isEmpty();
+ } else {
+ reply["isVisible"] = false;
+ }
+
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::widget(QTestMessage const &message)
+{
+ QObject *tw;
+ QTestMessage reply;
+ QString error;
+ int offset = 0;
+ if (!message["offset"].toString().isEmpty()) offset = message["offset"].toInt();
+ if (QActiveTestWidget::instance()->findWidget( message["queryPath"].toString(), tw, error, offset )) {
+ reply["widget"] = QTestWidgets::signature(tw);//tw->signature();
+ return RET(reply, "OK");
+ }
+ return RET(reply, error);
+}
+
+QTestMessage QTestSlavePrivate::isChecked(QTestMessage const &message)
+{
+ QTestMessage reply;
+ if (message["item"].isValid()) {
+ CheckItemWidget *ciw = findTestWidget<CheckItemWidget>(message);
+ if (ciw) {
+ reply["isChecked"] = ciw->isChecked(message["item"].toString());
+ } else {
+ reply["isChecked"] = false;
+ }
+ } else {
+ CheckWidget *cw = findTestWidget<CheckWidget>(message);
+ if (cw) {
+ reply["isChecked"] = (cw->checkState() != Qt::Unchecked);
+ } else {
+ reply["isChecked"] = false;
+ }
+ }
+
+ if (!QtUiTest::errorString().isEmpty())
+ return RET(reply, QtUiTest::errorString());
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::setChecked(QTestMessage const &message)
+{
+ QTestMessage reply;
+ if (message["item"].isValid()) {
+ CheckItemWidget *ciw = findTestWidget<CheckItemWidget>(message);
+ if (ciw) {
+ ciw->setChecked(message["item"].toString(), message["doCheck"].toBool());
+ }
+ } else {
+ CheckWidget *cw = findTestWidget<CheckWidget>(message);
+ if (cw) {
+ Qt::CheckState state = Qt::Unchecked;
+ if (message["doCheck"].toBool())
+ state = Qt::Checked;
+ if (cw->checkState() == state)
+ return RET(reply, "OK");
+ if (!cw->setCheckState(state) && QtUiTest::errorString().isEmpty())
+ QtUiTest::setErrorString("Failed to change check state of widget");
+ }
+ }
+
+ if (!QtUiTest::errorString().isEmpty())
+ return RET(reply, QtUiTest::errorString());
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::checkState(QTestMessage const &message)
+{
+ QTestMessage reply;
+ CheckWidget *cw = findTestWidget<CheckWidget>(message);
+ if (cw) {
+ reply["checkState"] = static_cast<int>(cw->checkState());
+ }
+
+ if (!QtUiTest::errorString().isEmpty())
+ return RET(reply, QtUiTest::errorString());
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::setCheckState(QTestMessage const &message)
+{
+ QTestMessage reply;
+ CheckWidget *cw = findTestWidget<CheckWidget>(message);
+ if (cw) {
+ Qt::CheckState state = static_cast<Qt::CheckState>(message["state"].toInt());
+ if (!cw->setCheckState(state) && QtUiTest::errorString().isEmpty())
+ QtUiTest::setErrorString("Failed to change check state of widget");
+ }
+
+ if (!QtUiTest::errorString().isEmpty())
+ return RET(reply, QtUiTest::errorString());
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::getCenter(QTestMessage const &message)
+{
+ QTestMessage reply;
+ Widget *qw = findTestWidget<Widget>(message);
+ QPoint pos;
+ QRegion visibleRegion = qw->visibleRegion() | qw->childrenVisibleRegion();
+
+ // If we have just gotten focus, the visible region might be empty.
+ // Wait for up to 100ms for screen expose events to propagate correctly.
+ for (int i = 0;
+ i < 100 && visibleRegion.isEmpty();
+ QtUiTest::wait(20), i += 20, visibleRegion = qw->visibleRegion() | qw->childrenVisibleRegion()) {}
+
+ if (message["item"].isValid()) {
+ bool ok = false;
+ ListWidget *lw = findTestWidget<ListWidget>(message);
+ if (lw) {
+ ok = true;
+ pos = qw->mapToGlobal(lw->visualRect(message["item"].toString()).center());
+ }
+
+ if (!ok) {
+ return RET(reply, "ERROR: couldn't get center of item " + message["item"].toString() +
+ " in widget " + message["queryPath"].toString());
+ }
+ }
+
+ if (pos.isNull()) {
+ pos = qw->center();
+ }
+
+ reply["getCenter"] = QVariant::fromValue(pos);
+
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::activeWindow(QTestMessage const &message)
+{
+ Q_UNUSED(message);
+ QTestMessage reply;
+ QObject *w = qApp->activeWindow();
+ if (w) {
+ reply["activeWindow"] = QTestWidgets::signature( w );
+ return RET(reply, "OK");
+ }
+
+ return RET(reply, "ERROR: No active application window");
+}
+
+QTestMessage QTestSlavePrivate::focusWidget(QTestMessage const &message)
+{
+ Q_UNUSED(message);
+ QTestMessage reply;
+ QtUiTestElapsedTimer t;
+ QObject *w = 0;
+ while (t.elapsed() < VISIBLE_RESPONSE_TIME) {
+ QString error;
+ QActiveTestWidget::instance()->rescan(error);
+ w = qApp->focusWidget();
+ if (w) break;
+ QtUiTest::wait(3);
+ }
+ if (!w) w = QTestWidgets::activeWidget();
+ if (w) {
+ reply["focusWidget"] = QTestWidgets::signature( w );
+ return RET(reply, "OK");
+ }
+
+ return RET(reply, QString("ERROR: No focus widget found in application '%1' in %2 ms.").arg(qApp->applicationName()).arg(t.elapsed()));
+}
+
+QTestMessage QTestSlavePrivate::hasFocus( QTestMessage const &message )
+{
+ QTestMessage reply;
+ Widget *w = findTestWidget<Widget>(message);
+
+ if (w) {
+ reply["hasFocus"] = w->hasFocus();
+ }
+
+ if (!QtUiTest::errorString().isEmpty())
+ return RET(reply, QtUiTest::errorString());
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::appName(QTestMessage const &message)
+{
+ Q_UNUSED(message);
+ QTestMessage reply;
+ reply["appName"] = qApp->applicationName();
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::startEventRecording(QTestMessage const &message)
+{
+ Q_UNUSED(message);
+ QTestMessage reply;
+ if (qApp != 0) {
+ p->setRecordingEvents(true);
+ qApp->installEventFilter( this );
+ return RET(reply, "OK");
+ }
+ return RET(reply, "ERROR: No application available to record events. This is unusual.");
+}
+
+QTestMessage QTestSlavePrivate::stopEventRecording(QTestMessage const &message)
+{
+ Q_UNUSED(message);
+ QTestMessage reply;
+ if (qApp != 0) {
+ p->setRecordingEvents(false);
+ qApp->removeEventFilter( this );
+ return RET(reply, "OK");
+ }
+ return RET(reply, "ERROR: No application available to stop event recording. This is unusual.");
+}
+
+void QTestSlave::recordEvent(RecordEvent::Type type, QString const& widget, QString const& focusWidget, QVariant const& data)
+{
+ RecordEvent event;
+ event.type = type;
+ event.widget = widget;
+ event.focusWidget = focusWidget;
+ event.data = data;
+
+ QList<RecordEvent> unpostedEvents;
+ unpostedEvents << event;
+
+ QTestMessage msg("recordedEvents");
+ msg["events"] = QVariant::fromValue(unpostedEvents);
+ postMessage(msg);
+}
+
+QTestMessage QTestSlavePrivate::invokeMethod(QTestMessage const &message)
+{
+ QObject *o;
+ QString error;
+ QTestMessage reply;
+ if (!QActiveTestWidget::instance()->findWidget( message["queryPath"].toString(), o, error))
+ return RET(reply,error);
+
+ QString method = message["method"].toString();
+ bool returns = message["returns"].toBool();
+ Qt::ConnectionType connType = (Qt::ConnectionType)message["conntype"].toInt();
+
+ method = QMetaObject::normalizedSignature(qPrintable(method));
+
+ QVariantList argList = message["args"].toList();
+
+ QMetaObject const *mo = o->metaObject();
+
+ int m = mo->indexOfMethod(QMetaObject::normalizedSignature(qPrintable(method)));
+ if (-1 == m) {
+ return RET(reply, "ERROR_NO_METHOD");
+ }
+ QMetaMethod mm = mo->method(m);
+ if (mm.methodType() == QMetaMethod::Method) {
+ return RET(reply, "ERROR_METHOD_NOT_INVOKABLE");
+ }
+ QList<QByteArray> paramTypes = mm.parameterTypes();
+ if (paramTypes.count() != argList.count()) {
+ (void)RET(reply, "ERROR_WRONG_ARG_COUNT");
+ reply["warning"] = QString("actual args %1, expected args %2").arg(paramTypes.count()).arg(argList.count());
+ return reply;
+ }
+ QString retType = mm.typeName();
+ if (returns && retType.isEmpty()) {
+ return RET(reply, "ERROR_NO_RETURN");
+ }
+
+ QGenericArgument arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9;
+#define LARG(i) do {\
+ if (argList.count() <= i) break;\
+ arg##i = QGenericArgument(paramTypes[i], argList[i].constData());\
+} while(0);
+ LARG(0);LARG(1);LARG(2);LARG(3);LARG(4);LARG(5);LARG(6);
+ LARG(7);LARG(8);LARG(9);
+#undef LARG
+
+ QString methodName = method.left(method.indexOf('('));
+
+ if (!retType.isEmpty()) {
+ /* FIXME! What if the variable is larger than this? */
+ char buf[16384];
+ QGenericReturnArgument rarg(qPrintable(retType), static_cast<void *>(buf));
+ if (!QMetaObject::invokeMethod(o, qPrintable(methodName), connType,
+ rarg, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)) {
+ return RET(reply, "ERROR_IN_INVOKE");
+ }
+ int typeId = QMetaType::type(qPrintable(retType));
+ QVariant var(typeId, static_cast<const void *>(buf));
+ reply["returns"] = var;
+ } else {
+ if (!QMetaObject::invokeMethod(o, qPrintable(methodName), connType,
+ arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9)) {
+ return RET(reply, "ERROR_IN_INVOKE");
+ }
+ }
+
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::setProperty(QTestMessage const &message)
+{
+ QTestMessage reply;
+ Widget *w = findTestWidget<Widget>(message);
+ if (w) {
+ QString property = message["property"].toString();
+ QVariant value = message["value"];
+ if (!w->setProperty(property, value) && QtUiTest::errorString().isEmpty()) {
+ return RET(reply, "ERROR_SETTING_PROPERTY");
+ }
+ }
+
+ if (!QtUiTest::errorString().isEmpty())
+ return RET(reply, QtUiTest::errorString());
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::getProperty(QTestMessage const &message)
+{
+ QTestMessage reply;
+ Widget *w = findTestWidget<Widget>(message);
+ if (w) {
+ QString property = message["property"].toString();
+ QVariant value = w->getProperty(property);
+ if (QObject *obj = value.value<QObject*>()) {
+ value = QTestWidgets::signature(obj);
+ }
+ reply["getProperty"] = value;
+ if (!value.isValid()) {
+ QtUiTest::setErrorString("Failed to retrieve property from object");
+ }
+ }
+
+ if (!QtUiTest::errorString().isEmpty())
+ return RET(reply, QtUiTest::errorString());
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::findByProperty(QTestMessage const &message)
+{
+ QTestMessage reply;
+ QString error;
+ if (!QActiveTestWidget::instance()->rescan(error)) {
+ return RET(reply, error);
+ }
+
+ QString property = message["property"].toString();
+ QVariant searchValue = message["searchValue"];
+ if (property.isEmpty() || !searchValue.isValid()) {
+ return RET(reply, "ERROR_MISSING_PARAMETERS");
+ }
+
+ QObjectList ol = QActiveTestWidget::instance()->findObjectsByProperty( property, searchValue );
+
+ // Sort the list by widget position
+ qStableSort(ol.begin(), ol.end(), QTestWidgets::lessThan);
+
+ QStringList ret = QTestWidgets::objectListToSignatures(ol);
+ reply["findByProperty"] = ret;
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::findByProperties(QTestMessage const &message)
+{
+ QTestMessage reply;
+ QString error;
+ if (!QActiveTestWidget::instance()->rescan(error)) {
+ return RET(reply, error);
+ }
+
+ QVariantMap searchValues = message["searchValues"].toMap();
+ if ( searchValues.isEmpty() ) {
+ return RET(reply, "ERROR_MISSING_PARAMETERS");
+ }
+
+ QObjectList ol = QActiveTestWidget::instance()->findObjectsByProperty( searchValues );
+
+ // Sort the list by widget position
+ qStableSort(ol.begin(), ol.end(), QTestWidgets::lessThan);
+
+ QStringList ret = QTestWidgets::objectListToSignatures(ol);
+ reply["findByProperties"] = ret;
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::getSetting(QTestMessage const &message)
+{
+ QTestMessage reply;
+ QString org = message["org"].toString();
+ QString app = message["app"].toString();
+ QString path = message["path"].toString();
+ QString group = message["group"].toString();
+ QString key = message["key"].toString();
+ path = p->processEnvironment(path);
+ if (group.isEmpty() || key.isEmpty()) {
+ return RET(reply, "ERROR_MISSING_PARAMETERS");
+ }
+ if (!path.isEmpty() && (!org.isEmpty() || !app.isEmpty())) {
+ return RET(reply, "ERROR_BAD_PARAMETERS");
+ } else if (path.isEmpty() && org.isEmpty()) {
+ return RET(reply, "ERROR_MISSING_PARAMETERS");
+ }
+
+ QSettings *settings = 0;
+ if (!path.isEmpty()) settings = new QSettings(path, QSettings::NativeFormat);
+ else settings = new QSettings(org, app);
+
+ settings->beginGroup(group);
+ reply["getSetting"] = settings->value(key);
+ delete settings;
+
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::setSetting(QTestMessage const &message)
+{
+ QTestMessage reply;
+ QString org = message["org"].toString();
+ QString app = message["app"].toString();
+ QString path = message["path"].toString();
+ QString group = message["group"].toString();
+ QString key = message["key"].toString();
+ path = p->processEnvironment(path);
+ if (key.isEmpty()) {
+ return RET(reply, "ERROR_MISSING_PARAMETERS");
+ }
+ if (!path.isEmpty() && (!org.isEmpty() || !app.isEmpty())) {
+ return RET(reply, "ERROR_BAD_PARAMETERS");
+ } else if (path.isEmpty() && org.isEmpty()) {
+ return RET(reply, "ERROR_MISSING_PARAMETERS");
+ }
+
+ QSettings *settings = 0;
+ if (!path.isEmpty()) settings = new QSettings(path, QSettings::NativeFormat);
+ else settings = new QSettings(org, app);
+
+ if (!group.isEmpty())
+ settings->beginGroup(group);
+ settings->setValue(key, message["value"]);
+ delete settings;
+
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::getClipboardText(QTestMessage const &message)
+{
+ Q_UNUSED(message);
+ QTestMessage reply;
+
+#ifndef QT_NO_CLIPBOARD
+ QClipboard *cb = QApplication::clipboard();
+ if (cb) {
+ reply["getClipboardText"] = cb->text();
+ return RET(reply, "OK");
+ }
+#endif
+
+ return RET(reply, "ERROR: couldn't get clipboard");
+}
+
+QTestMessage QTestSlavePrivate::setClipboardText(QTestMessage const &message)
+{
+ QTestMessage reply;
+
+#ifndef QT_NO_CLIPBOARD
+ QString value = message["text"].toString();
+ QClipboard *cb = QApplication::clipboard();
+ if (cb) {
+ cb->setText(value);
+ return RET(reply, "OK");
+ }
+#endif
+
+ return RET(reply, "ERROR: couldn't get clipboard");
+}
+
+QTestMessage QTestSlavePrivate::mousePreferred(QTestMessage const &message)
+{
+ Q_UNUSED(message);
+ QTestMessage reply;
+
+ reply["mousePreferred"] = QtUiTest::mousePreferred();
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::setMousePreferred(QTestMessage const &message)
+{
+ QTestMessage reply;
+ bool useMouse = message["useMouse"].toBool();
+
+ QtUiTest::setMousePreferred(useMouse);
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::labelOrientation(QTestMessage const &message)
+{
+ Q_UNUSED(message);
+ QTestMessage reply;
+
+ reply["labelOrientation"] = QtUiTest::labelOrientation();
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::setLabelOrientation(QTestMessage const &message)
+{
+ QTestMessage reply;
+ int orientation = message["orientation"].toInt();
+
+ QtUiTest::setLabelOrientation(static_cast<QtUiTest::LabelOrientation>(orientation));
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::putFile(QTestMessage const &message)
+{
+ QTestMessage reply;
+ QString path = message["path"].toString();
+ path = p->processEnvironment(path);
+ QByteArray data = message["data"].toByteArray();
+
+ if (path.isEmpty())
+ return RET(reply, "ERROR_MISSING_PARAMETERS");
+
+ {
+ QFileInfo info = QFileInfo(path);
+ QDir dir = info.dir();
+ if (info.exists()) {
+ dir.remove(info.fileName());
+ } else if (!dir.exists() && !QDir("/").mkpath(dir.absolutePath())) {
+ return RET(reply, "Could not create path '" + dir.absolutePath() + "'");
+ }
+ }
+
+ QFile f(path);
+ if (f.open(QIODevice::WriteOnly)) {
+ if (message["permissions"].isValid() && !f.setPermissions(static_cast<QFile::Permissions>(message["permissions"].toInt()))) {
+ return RET(reply, "ERROR_FILE_PERMISSIONS");
+ }
+ QDataStream ds(&f);
+ if (data.constData()) {
+ int bytesWritten = ds.writeRawData(data.constData(), data.size());
+ if (bytesWritten == data.size())
+ return RET(reply, "OK");
+ else {
+ reply["warning"] = QString("Wrote %1 byte(s), expected %2").arg(bytesWritten).arg(data.size());
+ return RET(reply, "ERROR_TRUNCATED");
+ }
+ }
+ // It's OK for data to be empty, then we create an empty file.
+ return RET(reply, "OK");
+ }
+
+ return RET(reply, "ERROR_FILE_OPEN");
+}
+
+QTestMessage QTestSlavePrivate::getFile(QTestMessage const &message)
+{
+ QTestMessage reply;
+ QString path = message["path"].toString();
+ path = p->processEnvironment(path);
+
+ if (path.isEmpty())
+ return RET(reply, "ERROR_MISSING_PARAMETERS");
+
+ QFile f(path);
+ if (!f.exists()) return RET(reply, "ERROR_FILE_NOT_EXIST");
+ if (f.open(QIODevice::ReadOnly)) {
+ QByteArray data;
+ QDataStream ds(&f);
+ data.resize(f.size());
+ int bytesRead = ds.readRawData(data.data(), f.size());
+ reply["getFile"] = data;
+ if (bytesRead == f.size())
+ return RET(reply, "OK");
+ else {
+ reply["warning"] = QString("Read %1 byte(s), expected %2").arg(bytesRead).arg(data.size());
+ return RET(reply, "ERROR_TRUNCATED");
+ }
+ }
+ return RET(reply, "ERROR_FILE_OPEN");
+}
+
+QTestMessage QTestSlavePrivate::getImageSize(QTestMessage const &message)
+{
+ QTestMessage reply;
+ QString path = message["path"].toString();
+ path = p->processEnvironment(path);
+
+ if (path.isEmpty())
+ return RET(reply, "Error: Path is Empty.");
+
+ QImage f(path);
+ if (f.isNull())
+ return RET(reply, "Error: No Image Loaded.");
+ QSize imgSize = f.size();
+ reply["getImageSize"] = imgSize;
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::getGeometry(QTestMessage const &message)
+{
+ QTestMessage reply;
+ Widget *w = findTestWidget<Widget>(message);
+ if (w) {
+ QRect ret = w->geometry();
+ ret.moveTo( w->mapToGlobal( QPoint(0,0) ) );
+ reply["getGeometry"] = ret;
+ }
+
+ if (!QtUiTest::errorString().isEmpty())
+ return RET(reply, QtUiTest::errorString());
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::setSystemTime(QTestMessage const &message)
+{
+ QTestMessage reply;
+#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
+ QDateTime dt = message["dateTime"].value<QDateTime>();
+ if (!dt.isValid()) return RET(reply, "ERROR: Invalid date/time specified");
+
+ struct timeval myTv;
+ myTv.tv_sec = dt.toTime_t();
+ myTv.tv_usec = 0;
+
+ if ( myTv.tv_sec != -1 )
+ ::settimeofday( &myTv, 0 );
+
+ return RET(reply, "OK");
+#else
+ Q_UNUSED(message);
+ return RET(reply, "ERROR: setSystemTime is not implemented on this platform!");
+#endif
+}
+
+QTestMessage QTestSlavePrivate::systemTime(QTestMessage const &message)
+{
+ Q_UNUSED(message);
+ QTestMessage reply;
+ reply["systemTime"] = QDateTime::currentDateTime();
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::getDirectoryEntries(QTestMessage const &message)
+{
+ QTestMessage reply;
+ QString path = message["path"].toString();
+ path = p->processEnvironment(path);
+
+ if (path.isEmpty()) {
+ return RET(reply, "ERROR_MISSING_PARAMETERS");
+ }
+
+ QDir d(path);
+ if (!d.exists()) {
+ reply["getDirectoryEntries"] = QStringList();
+ return RET(reply, "OK");
+ }
+
+ QDir::Filters filters;
+ {
+ int filters_int = message["filters"].toInt();
+ filters = QFlag(filters_int);
+ }
+
+ QStringList list = d.entryList(filters);
+ reply["getDirectoryEntries"] = list;
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::deletePath(QTestMessage const &message)
+{
+ QTestMessage reply;
+ QString path = message["path"].toString();
+ path = p->processEnvironment(path);
+ return RET(reply, recursiveDelete(path));
+}
+
+// All messages get processed on their own stack.
+// This function is the entry point into the alternate stacks.
+void QTestSlavePrivate::processMessage(QAlternateStack* stack, QVariant const& data)
+{
+ QVariantList list = data.toList();
+ QTestSlave* slave = qobject_cast<QTestSlave*>(list.at(0).value<QObject*>());
+ QTestMessage msg = list.at(1).value<QTestMessage>();
+
+ QTestMessage reply = slave->constructReplyToMessage(msg);
+
+ if (!reply.isNull()) {
+ // Warn if we couldn't use QAlternateStack.
+ static char mem = 0;
+ while (!mem) {
+ mem = 1;
+ if (stack) break;
+ if (QApplication::type() != QApplication::GuiServer) break;
+ static const char warning[] =
+ "QAlternateStack is not available on this platform.\n"
+ "Modal dialogs, message boxes and nested event loops may cause a hang.";
+ qWarning("QtUitest: %s", warning);
+ reply["warning"] = QString::fromLatin1(warning);
+ }
+ slave->replyMessage(&msg, reply);
+ }
+
+ // The alternate stack is no longer required, so delete it after
+ // we return.
+ if (stack) stack->deleteLater();
+}
+
+Q_DECLARE_METATYPE(QAlternateStackEntryPoint);
+Q_DECLARE_METATYPE(QVariant);
+
+void QTestSlave::processMessage( QTestMessage *msg )
+{
+ // Make sure we don't process within an alternate stack.
+ foreach (QAlternateStack* stack, QAlternateStack::instances()) {
+ if (stack->isCurrentStack())
+ qFatal( "%s received message %s while in an alternate stack! "
+ "This is a programmer error; it means events are being "
+ "processed in an alternate stack. This should never "
+ "happen.",
+ qPrintable(qApp->applicationName()),
+ qPrintable(msg->event()));
+ }
+
+ QVariantList list;
+ list.append( QVariant::fromValue(static_cast<QObject*>(this)) );
+ list.append( QVariant::fromValue(*msg) );
+
+ // If possible, use an alternate stack to handle the messages.
+ // We only want to switch to that stack once we get back to the event loop.
+ if (QAlternateStack::isAvailable()) {
+ QAlternateStack* stack;
+ if (msg->event() == "grabPixmap") {
+ stack = new QAlternateStack(131072, this);
+ } else {
+ stack = new QAlternateStack(65536, this);
+ }
+
+ static const int type1 = qRegisterMetaType<QAlternateStackEntryPoint>();
+ static const int type2 = qRegisterMetaType<QVariant>();
+ Q_UNUSED(type1); Q_UNUSED(type2);
+ QMetaObject::invokeMethod(stack, "start", Qt::QueuedConnection,
+ Q_ARG(QAlternateStackEntryPoint, QTestSlavePrivate::processMessage),
+ Q_ARG(QVariant, qVariantFromValue(list)));
+ }
+ // Some platforms can't use QAlternateStack.
+ // In that case, just process the message as usual. This means bug 194361
+ // can happen.
+ else {
+ QTestSlavePrivate::processMessage(0, list);
+ }
+}
+
+QTestMessage QTestSlave::constructReplyToMessage( QTestMessage const &_msg )
+{
+ QTestMessage reply;
+ QTestMessage msg(_msg);
+ reply["from"] = qApp->applicationName();
+
+// TO HANDLE A NEW SYSTEM TEST EVENT:
+// implement a function with signature:
+// QTestMessage QTestSlavePrivate::eventName(QTestMessage const &message)
+
+ QString qp = msg["queryPath"].toString();
+
+ if (!QMetaObject::invokeMethod(d, msg.event().toLatin1().constData(), Qt::DirectConnection,
+ Q_RETURN_ARG(QTestMessage, reply),
+ Q_ARG(QTestMessage, msg))) {
+ (void)RET(reply, "ERROR: Unhandled event '" + msg.event() + "'");
+ }
+
+ return reply;
+}
+
+QString QTestSlave::processEnvironment( QString const& in ) const
+{
+ struct SystemEnvironment {
+ static QMap<QString,QString> get() {
+ QMap<QString,QString> ret;
+ QStringList env = QProcess::systemEnvironment();
+ foreach (QString str, env) {
+ if (str.contains('=')) {
+ ret[str.left(str.indexOf('=')).toUpper()] = str.mid(str.indexOf('=') + 1);
+ }
+ }
+ return ret;
+ }
+ };
+ static const QMap<QString,QString> environment( SystemEnvironment::get() );
+
+ QString out;
+ static QRegExp re("\\$[{(]?([A-Za-z0-9_]+)[})]?");
+ int offset = 0;
+ while (true) {
+ int index = re.indexIn(in, offset);
+ if (-1 == index) {
+ out += in.mid(offset);
+ break;
+ }
+ out += in.mid(offset, index - offset);
+ out += environment.value(re.cap(1).toUpper());
+ offset += re.matchedLength();
+ }
+
+ return out;
+}
+
+QString QTestSlavePrivate::recursiveDelete( const QString &path ) const
+{
+ if (path.isEmpty()) return "ERROR_CANT_DELETE_EMPTY_PATH";
+
+ QFileInfo i(path);
+ if (!i.exists()) return "OK";
+ if (!i.isDir() || i.isSymLink()) {
+ if (!i.dir().remove(i.fileName())) {
+ return "ERROR_CANT_DELETE_FILE_" + path;
+ } else {
+ return "OK";
+ }
+ }
+
+ QDir dir(path);
+
+ QStringList children = dir.entryList( QDir::AllEntries | QDir::System | QDir::Hidden | QDir::NoDotAndDotDot );
+
+ QString res;
+ foreach (QString child, children) {
+ res = recursiveDelete( dir.absolutePath() + "/" + child );
+ if (res != "OK" ) return res;
+ }
+
+ QString dirName = dir.dirName();
+ dir.cdUp();
+
+ if (!dir.rmdir(dirName)) {
+ return "ERROR_CANT_DELETE_DIRECTORY_" + path;
+ }
+ return "OK";
+}
+
+bool QTestSlavePrivate::waitForIdle(int timeout)
+{
+ connect(this, SIGNAL(applicationBecameIdle()), this, SLOT(sendBecameIdleMessage()));
+ startWaitForIdle(timeout);
+
+ QtUiTest::waitForSignal(this, SIGNAL(applicationBecameIdle()), timeout);
+
+ return true;
+}
+
+QTestMessage QTestSlavePrivate::waitForIdle(QTestMessage const &message)
+{
+ QTestMessage reply;
+ if (waitForIdle(message["timeout"].toInt()))
+ return RET(reply, "OK");
+ return RET(reply, "ERROR_IDLE_TIMEOUT");
+}
+
+QTestMessage QTestSlavePrivate::select( QTestMessage const &message )
+{
+ bool should_rescan = false;
+ QTestMessage reply;
+ int try_count = 5;
+ QString text = message["text"].toString();
+ QString error;
+
+ qLog(QtUitest) << "select" << text << message["queryPath"].toString();
+
+ while (try_count-- > 0) {
+ if (should_rescan) {
+ // Wait a moment to process events and then try again
+ QtUiTest::wait(200);
+ if (!QActiveTestWidget::instance()->rescan(error)) {
+ return RET(reply, error);
+ }
+ reply["warning"] = "Item selection failed ... will try again in 200 ms";
+ should_rescan = false;
+ }
+
+ QString qp = message["queryPath"].toString();
+ QObject *o = 0;
+
+ // See if we should interpret select("Something") as activate("Something").
+ // From a user's point of view, activating a button from a set of buttons
+ // and selecting an action from a list are pretty much the same thing.
+ if (qp.isEmpty() && !text.isEmpty()) {
+ QString error;
+ if (QActiveTestWidget::instance()->findWidget( text, o, error)) {
+ ActivateWidget *aw = qtuitest_cast<ActivateWidget*>(o);
+ if (aw) {
+ aw->activate();
+ if (!QtUiTest::errorString().isEmpty())
+ return RET(reply, QtUiTest::errorString());
+ return RET(reply, "OK");
+ }
+ }
+ }
+
+ if (!QActiveTestWidget::instance()->findWidget(qp, o, error)) {
+ if (try_count > 0) {
+ should_rescan = true;
+ continue;
+ } else {
+ return RET(reply,error);
+ }
+ }
+ if (qp.isEmpty()) qp = QTestWidgets::signature(o);
+
+ QtUiTest::SelectWidget *sw = qtuitest_cast<QtUiTest::SelectWidget*>(o);
+ if (!sw) {
+ QString resolvedQp;
+ QDebug(&resolvedQp) << o;
+ return RET(reply, "ERROR: " + qp + " (" + resolvedQp + ") is not a SelectWidget.");
+ }
+ if (!sw->select(text)) {
+ if (!sw->canSelect(text)) {
+ if (try_count > 0) {
+ should_rescan = true;
+ continue;
+ } else {
+ QString error = "ERROR: item '" + text
+ + "' is not available for selection in " + qp;
+ if (!QtUiTest::errorString().isEmpty()) {
+ error += "\n" + QtUiTest::errorString();
+ }
+ QtUiTest::ListWidget *lw = qtuitest_cast<QtUiTest::ListWidget*> (o);
+ if (lw) {
+ error += "\nAvailable items: " + lw->list().join(",");
+ }
+ return RET(reply, error);
+ }
+ }
+ error = "ERROR: unknown error selecting item '" + text
+ + "' from " + qp;
+ if (!QtUiTest::errorString().isEmpty())
+ error = QtUiTest::errorString();
+ return RET(reply, error);
+ }
+ return RET(reply, "OK");
+ }
+
+ error = "ERROR: unknown error selecting item '" + text + "'";
+ return RET(reply, error);
+}
+
+QTestMessage QTestSlavePrivate::selectIndex( QTestMessage const &message )
+{
+ QTestMessage reply;
+ IndexedWidget *iw = findTestWidget<IndexedWidget>(message);
+ if (iw) {
+ QVariantList index = message["index"].toList();
+ iw->selectIndex(index);
+ }
+
+ if (!QtUiTest::errorString().isEmpty())
+ return RET(reply, QtUiTest::errorString());
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::getSelectedIndex( QTestMessage const &message )
+{
+ QTestMessage reply;
+ IndexedWidget *iw = findTestWidget<IndexedWidget>(message);
+ if (iw) {
+ reply["getSelectedIndex"] = iw->selectedIndex();
+ }
+
+ if (!QtUiTest::errorString().isEmpty())
+ return RET(reply, QtUiTest::errorString());
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::activate( QTestMessage const &message )
+{
+ QTestMessage reply;
+ ActivateWidget *aw = findTestWidget<ActivateWidget>(message);
+ if (aw) {
+ aw->activate();
+ }
+
+ if (!QtUiTest::errorString().isEmpty())
+ return RET(reply, QtUiTest::errorString());
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::ensureVisible( QTestMessage const &message )
+{
+ QTestMessage reply;
+ if (message["item"].isValid()) {
+ ListWidget *lw = findTestWidget<ListWidget>(message);
+ if (lw) {
+ bool ok = lw->ensureVisible(message["item"].toString());
+ if (!ok && QtUiTest::errorString().isEmpty()) {
+ return RET(reply, "ERROR: Failed to make item visible");
+ }
+ }
+ } else {
+ return RET(reply, "ERROR: No item specified");
+ }
+
+ if (!QtUiTest::errorString().isEmpty())
+ return RET(reply, QtUiTest::errorString());
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::enter( QTestMessage const &message )
+{
+ QObject* o;
+ QString error;
+ QString qp = message["queryPath"].toString();
+ QVariant value = message["value"];
+ bool mode = message["mode"] == "NoCommit";
+
+ QTestMessage reply;
+ if (!QActiveTestWidget::instance()->findWidget(qp, o, error))
+ return RET(reply,error);
+
+ QPointer<QObject> safeTw = o;
+
+ QtUiTest::InputWidget *iw
+ = qtuitest_cast<QtUiTest::InputWidget*>(o);
+
+ QString sig = QTestWidgets::signature(o);
+
+ if (!iw) {
+ return RET(reply, "ERROR: " + qp + " is not an InputWidget. Signature: " + sig);
+ }
+
+ if (!iw->enter(value, mode)) {
+ QString error;
+ if (!safeTw) {
+ error = "ERROR: " + qp + " was destroyed while entering text into it.";
+ } else if (!iw->canEnter(value) && QtUiTest::errorString().isEmpty()) {
+ QString resolvedQp;
+ QDebug(&resolvedQp) << o;
+ return RET(reply, "ERROR: '" + value.toString()
+ + "' is not valid input for " + qp + " (" + resolvedQp + "; " + sig + ")");
+ } else {
+ error = "ERROR: unknown error entering '" + value.toString()
+ + "' into " + qp + ". Signature: " + sig;
+ if (!QtUiTest::errorString().isEmpty())
+ error = QtUiTest::errorString();
+ }
+ return RET(reply, error);
+ }
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::keyPress(QTestMessage const &message)
+{
+ QTestMessage reply;
+ if (!message["key"].isValid()) {
+ return RET(reply, "ERROR_MISSING_KEY");
+ }
+
+ Qt::Key key = (Qt::Key)(message["key"].toInt());
+ if (!key) return RET(reply, "ERROR_ZERO_KEY");
+
+ QtUiTest::keyPress(key);
+
+ if (message["duration"].isValid()) {
+ int duration = message["duration"].toInt();
+ if (duration >= 500) {
+ QtUiTest::wait(500);
+ duration -= 500;
+ bool keyRepeat=QtUiTest::testInputOption(QtUiTest::KeyRepeat);
+ QtUiTest::setInputOption(QtUiTest::KeyRepeat, true);
+ QtUiTest::keyPress(key);
+ while (duration > 0) {
+ QtUiTest::wait(150);
+ duration -= 150;
+ QtUiTest::keyPress(key);
+ }
+ QtUiTest::setInputOption(QtUiTest::KeyRepeat, keyRepeat);
+ } else {
+ QtUiTest::wait(duration);
+ }
+ }
+
+ return RET(reply, "OK" );
+}
+
+QTestMessage QTestSlavePrivate::keyRelease(QTestMessage const &message)
+{
+ QTestMessage reply;
+ if (!message["key"].isValid()) {
+ return RET(reply, "ERROR_MISSING_KEY");
+ }
+ Qt::Key key = (Qt::Key)(message["key"].toInt());
+ if (!key) return RET(reply, "ERROR_ZERO_KEY");
+ QtUiTest::keyRelease(key);
+ return RET(reply, "OK" );
+}
+
+QTestMessage QTestSlavePrivate::keyClick(QTestMessage const &message)
+{
+ QTestMessage reply;
+ if (!message["key"].isValid()) {
+ return RET(reply, "ERROR_MISSING_KEY");
+ }
+
+ Qt::Key key = (Qt::Key)(message["key"].toInt());
+ if (!key) return RET(reply, "ERROR_ZERO_KEY");
+ QtUiTest::keyClick(key);
+ return RET(reply, "OK" );
+}
+
+QTestMessage QTestSlavePrivate::mousePress(QTestMessage const &message)
+{
+ QTestMessage reply;
+ bool ok;
+ Qt::MouseButtons buttons = (Qt::MouseButtons)(message["buttons"].toInt(&ok));
+ if (!ok) buttons = Qt::LeftButton;
+
+ QPoint pos(mousePointForMessage(message, reply, ok));
+ if (ok) QtUiTest::mousePress(pos, buttons);
+ else return reply;
+ return RET(reply, "OK" );
+}
+
+QTestMessage QTestSlavePrivate::mouseRelease(QTestMessage const &message)
+{
+ QTestMessage reply;
+ bool ok;
+ Qt::MouseButtons buttons = (Qt::MouseButtons)(message["buttons"].toInt(&ok));
+ if (!ok) buttons = Qt::LeftButton;
+
+ QPoint pos(mousePointForMessage(message, reply, ok));
+ if (ok) QtUiTest::mouseRelease(pos, buttons);
+ else return reply;
+ return RET(reply, "OK" );
+}
+
+QTestMessage QTestSlavePrivate::mouseClick(QTestMessage const &message)
+{
+ QTestMessage reply;
+ bool ok;
+ Qt::MouseButtons buttons = (Qt::MouseButtons)(message["buttons"].toInt(&ok));
+ if (!ok) buttons = Qt::LeftButton;
+
+ if (message["pos"].isValid()) {
+ QtUiTest::mouseClick(message["pos"].value<QPoint>(), buttons);
+ } else {
+ Widget *w = findTestWidget<Widget>(message);
+ if (w) {
+ QPoint pos(w->rect().center());
+ if (w->visibleRegion().boundingRect().contains(pos) ||
+ w->ensureVisiblePoint(pos)) {
+ QtUiTest::mouseClick(w->mapToGlobal(pos), buttons);
+ } else {
+ //can't make visible
+ return RET(reply, "ERROR: couldn't make widget visible");
+ }
+ }
+ }
+
+ return RET(reply, "OK");
+}
+
+QPoint QTestSlavePrivate::mousePointForMessage(QTestMessage const &message, QTestMessage &reply, bool &ok)
+{
+ ok = true;
+ if (message["pos"].isValid())
+ return message["pos"].value<QPoint>();
+ reply = getCenter( message );
+ return reply["getCenter"].value<QPoint>();
+}
+
+QTestMessage QTestSlavePrivate::translate( QTestMessage const &message )
+{
+ QTestMessage reply;
+ QByteArray context = message["context"].toString().toLatin1();
+ QByteArray text = message["text"].toString().toLatin1();
+ QByteArray comment = message["comment"].toString().toLatin1();
+ int n = message["number"].toInt();
+ reply["translate"] = QCoreApplication::translate(context, text, comment, QCoreApplication::CodecForTr, n);
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::getLocale( QTestMessage const &message )
+{
+ Q_UNUSED(message);
+ QTestMessage reply;
+ reply["getLocale"] = QLocale::system();
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::getenv( QTestMessage const &message )
+{
+ QTestMessage reply;
+ reply["getenv"] = QVariant::fromValue(qgetenv(message["key"].toString().toLatin1()));
+ return RET(reply, "OK");
+}
+
+QTestMessage QTestSlavePrivate::checkOS( QTestMessage const &message )
+{
+ QTestMessage reply;
+ QString os = message["os"].toString().toUpper();
+
+ bool result = false;
+
+#ifdef Q_OS_UNIX
+ if (os == "UNIX") result = true;
+#endif
+#ifdef Q_OS_LINUX
+ if (os == "LINUX") result = true;
+#endif
+#ifdef Q_OS_MAC
+ if (os == "MAC") result = true;
+#endif
+#ifdef Q_OS_WIN32
+ if (os == "WIN32") result = true;
+#endif
+#ifdef Q_OS_WINCE
+ if (os == "WINCE") result = true;
+#endif
+#ifdef Q_OS_SYMBIAN
+ if (os == "SYMBIAN") result = true;
+#endif
+
+ reply["checkOS"] = result;
+ return RET(reply, "OK");
+}
+
+bool QTestSlavePrivate::event(QEvent *e)
+{
+ if ((int)IdleEvent::Type != (int)e->type()) return false;
+ e->accept();
+
+ extern uint qGlobalPostedEventsCount();
+
+ static uint lastCount = 0;
+ static uint times = 0;
+
+ IdleEvent *i = static_cast<IdleEvent*>(e);
+ uint count = qGlobalPostedEventsCount();
+ if (count == lastCount) {
+ ++times;
+ } else {
+ lastCount = count;
+ times = 0;
+ }
+ if (times < 50 && count > 1) {
+ if (i->timeout == -1 || i->time.elapsed() < i->timeout) {
+ IdleEvent *new_i = new IdleEvent(*i);
+ QCoreApplication::postEvent(this, new_i, -2000);
+ }
+ } else {
+ emit applicationBecameIdle();
+ }
+
+ return true;
+}
+
+void QTestSlavePrivate::startWaitForIdle(int timeout)
+{
+ QTime now;
+ now.start();
+ IdleEvent *i = new IdleEvent(now, timeout);
+ QCoreApplication::postEvent(this, i, -2000);
+}
+
+void QTestSlavePrivate::sendBecameIdleMessage()
+{
+ QTestMessage msg("appBecameIdle");
+ msg["appName"] = QCoreApplication::applicationName();
+ p->postMessage(msg);
+}
+
+// ***********************************************************************
+
+void QTestSlavePrivate::record_entered(QObject* object, QVariant const& item)
+{
+ p->recordEvent(RecordEvent::Entered, QActiveTestWidget::instance()->friendlyName(object),
+ QActiveTestWidget::instance()->friendlyName(QTestWidgets::focusWidget()), item);
+}
+
+void QTestSlavePrivate::record_gotFocus(QObject* object)
+{
+ p->recordEvent(RecordEvent::GotFocus, QActiveTestWidget::instance()->friendlyName(object),
+ QActiveTestWidget::instance()->friendlyName(QTestWidgets::focusWidget()));
+}
+
+void QTestSlavePrivate::record_activated(QObject* object)
+{
+ p->recordEvent(RecordEvent::Activated, QActiveTestWidget::instance()->friendlyName(object),
+ QActiveTestWidget::instance()->friendlyName(QTestWidgets::focusWidget()));
+}
+
+void QTestSlavePrivate::record_selected(QObject* object, QString const& item)
+{
+ p->recordEvent(RecordEvent::Selected, QActiveTestWidget::instance()->friendlyName(object),
+ QActiveTestWidget::instance()->friendlyName(QTestWidgets::focusWidget()), item);
+}
+
+void QTestSlavePrivate::record_stateChanged(QObject* object, int state)
+{
+ p->recordEvent(RecordEvent::CheckStateChanged, QActiveTestWidget::instance()->friendlyName(object),
+ QActiveTestWidget::instance()->friendlyName(QTestWidgets::focusWidget()), state);
+}
diff --git a/libqtslave/qtestslave.h b/libqtslave/qtestslave.h
new file mode 100644
index 0000000..9e43182
--- /dev/null
+++ b/libqtslave/qtestslave.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTESTSLAVE_H
+#define QTESTSLAVE_H
+
+#include <qtestprotocol_p.h>
+#include <recordevent_p.h>
+
+class QWSEvent;
+class QTestSlavePrivate;
+
+class QTSLAVE_EXPORT QTestSlave : public QTestProtocol
+{
+ Q_OBJECT
+public:
+ QTestSlave();
+ virtual ~QTestSlave();
+
+ virtual void processMessage(QTestMessage*);
+ virtual QTestMessage constructReplyToMessage(QTestMessage const&);
+
+ bool recordingEvents() const;
+
+public slots:
+ virtual void onConnected();
+
+protected:
+ QString processEnvironment(QString const&) const;
+ void setRecordingEvents(bool);
+
+ virtual void recordEvent(RecordEvent::Type,QString const&,QString const&,QVariant const& = QVariant());
+
+private:
+ friend class QTestSlavePrivate;
+ QTestSlavePrivate *d;
+};
+
+#endif
diff --git a/libqtslave/qtestslaveglobal.h b/libqtslave/qtestslaveglobal.h
new file mode 100644
index 0000000..a251c2f
--- /dev/null
+++ b/libqtslave/qtestslaveglobal.h
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTESTSLAVEGLOBAL_H
+#define QTESTSLAVEGLOBAL_H
+
+#define TAB_BAR_ALIAS ">@TAB_BAR@<"
+#define OPTIONS_MENU_ALIAS ">@OPTIONS_MENU@<"
+#define LAUNCHER_MENU_ALIAS ">@LAUNCHER_MENU@<" // launcher menu _can_ be a grid menu, but also a wheel menu, etc
+#define SOFT_MENU_ALIAS ">@SOFT_MENU@<"
+#define PROGRESS_BAR_ALIAS ">@PROGRESS_BAR@<"
+#define CALL_ACCEPT_ALIAS ">@CALL_ACCEPT@<"
+#define CALL_HANGUP_ALIAS ">@CALL_HANGUP@<"
+#define MENU_BAR_ALIAS ">@MENU_BAR@<"
+
+#endif
+
diff --git a/libqtslave/qtestwidgets.cpp b/libqtslave/qtestwidgets.cpp
new file mode 100644
index 0000000..51ef0bf
--- /dev/null
+++ b/libqtslave/qtestwidgets.cpp
@@ -0,0 +1,1008 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtestwidgets.h>
+#include <qtestslaveglobal.h>
+
+#include <QtGui>
+
+#define qLog(A) if (1); else qDebug() << #A
+
+bool active_test_widget_valid = false;
+
+uint qHash(QPointer<QObject> o)
+{ return qHash((QObject*)o); }
+
+inline QString dehyphenate(QString const& in)
+{ return QString(in).remove(QChar(0x00AD)); }
+
+/*!
+ Returns a unique string identifier for \a object.
+*/
+QString QTestWidgets::signature( const QObject *object )
+{
+ if (!object) return "ERROR_NO_OBJECT";
+ return uniqueName(object);
+}
+
+/*!
+ Returns a name for the object that is unique within the same peer level.
+*/
+QString QTestWidgets::uniqueName( const QObject *o )
+{
+ if (o && o->metaObject()) {
+ return QString("%1[%2]").arg(o->metaObject()->className()).arg((long)(void*)o,0,32).replace(' ', '_');
+ }
+
+ return "err_uniqueName";
+}
+
+/*
+ Returns the best matching buddy widget for the \a label by scanning through \a search_list.
+ The match is done based on the position information.
+*/
+QObject* QTestWidgets::locateBuddy( const QObject *label, const QObjectList &search_list )
+{
+ if (label == 0) return false;
+ QtUiTest::Widget* lw = qtuitest_cast<QtUiTest::Widget*>(label);
+
+ QtUiTest::LabelOrientation orientation = QtUiTest::labelOrientation();
+ int start = 0;
+ int end = 0;
+ int highNearEdge = 0;
+ int lowNearEdge = 0;
+
+ if (orientation == QtUiTest::LabelLeft || orientation == QtUiTest::LabelRight) {
+ start = lw->y();
+ end = start + lw->height();
+
+ if (orientation == QtUiTest::LabelLeft)
+ lowNearEdge = lw->x() + lw->width();
+ else
+ highNearEdge = lw->x();
+
+ } else if (orientation == QtUiTest::LabelBelow || orientation == QtUiTest::LabelAbove) {
+ start = lw->x();
+ end = start + lw->width();
+
+ if (orientation == QtUiTest::LabelBelow)
+ highNearEdge = lw->y();
+ else
+ lowNearEdge = lw->y() + lw->height();
+ }
+
+ QObject *buddy = 0;
+ int w_start = 0;
+ int w_end = 0;
+ int nearest = -1;
+
+ foreach(QObject *w, search_list) {
+ QtUiTest::Widget* qw = qtuitest_cast<QtUiTest::Widget*>(w);
+ if ( w && w != label && QTestWidgets::widgetVisible(w)) {
+
+ if (orientation == QtUiTest::LabelLeft || orientation == QtUiTest::LabelRight) {
+ w_start = qw->y();
+ w_end = w_start + qw->height();
+
+ if (orientation == QtUiTest::LabelLeft)
+ highNearEdge = qw->x();
+ else
+ lowNearEdge = qw->x() + qw->width();
+ } else if (orientation == QtUiTest::LabelBelow || orientation == QtUiTest::LabelAbove) {
+ w_start = qw->x();
+ w_end = w_start + qw->width();
+
+ if (orientation == QtUiTest::LabelBelow)
+ lowNearEdge = qw->y() + qw->height();
+ else
+ highNearEdge = qw->y();
+ }
+
+ if ((start == w_start ||
+ (start < w_start && end > w_start) ||
+ (start > w_start && start < w_end)) &&
+ (lowNearEdge < highNearEdge) &&
+ (!w->inherits("QGroupBox")) &&
+ (!w->inherits("QToolBox"))) {
+ int distance = highNearEdge - lowNearEdge;
+ if (nearest == -1 || nearest > distance) {
+ nearest = distance;
+ buddy = w;
+ }
+
+ }
+ }
+ }
+
+ return buddy;
+}
+
+/*
+ Returns true if the widget is truly visible, i.e. the widget claims it is visible,
+ all parents are visible and a parent is the activeWindow.
+*/
+bool QTestWidgets::widgetVisible( QObject *widget )
+{
+ if (widget == 0) return false;
+ QtUiTest::Widget* w = qtuitest_cast<QtUiTest::Widget*>(widget);
+ QtUiTest::Widget* aw = qtuitest_cast<QtUiTest::Widget*>(activeWidget());
+ bool is_active = (aw == 0);
+ while (w) {
+ if (!w->isVisible()) return false;
+ if (w == aw) is_active = true;
+ w = qtuitest_cast<QtUiTest::Widget*>(w->parent());
+ }
+ return is_active;
+}
+
+/*!
+ Returns the testWidget that is associated with the given \a signature.
+*/
+QObject *QTestWidgets::testWidget( const QString signature )
+{
+ if (signature.isEmpty()) {
+ return focusWidget();
+ }
+
+ return QActiveTestWidget::instance()->testWidget(signature);
+}
+
+QObject *QActiveTestWidget::testWidget( const QString &signature )
+{
+ QObject *rec = d->testWidgetsBySignature.value( signature, 0 );
+ return rec;
+}
+
+void QActiveTestWidget::registerTestWidget( QObject *ao )
+{
+ QString new_signature = QTestWidgets::signature( ao );
+ d->testWidgetsBySignature[new_signature] = ao;
+ connect( ao, SIGNAL(destroyed(QObject*)), this, SLOT(onDestroyed(QObject*)), Qt::DirectConnection );
+}
+
+void QActiveTestWidget::onDestroyed(QObject *o)
+{
+ if (o) {
+ d->removeTestWidget(o);
+ }
+}
+
+/*!
+ \internal
+
+ Returns a list of all top-level QObjects in the current application.
+*/
+QObjectList QTestWidgets::topLevelObjects()
+{
+ QWidgetList wl = qApp->topLevelWidgets();
+ QObjectList ol = qApp->children();
+ foreach(QWidget *w, wl) {
+ if (!ol.contains(w)) ol << w;
+ }
+ return ol;
+}
+
+/*!
+ Returns the current activeWindow, activePopupWidget or activeModalWidget.
+*/
+QObject* QTestWidgets::activeWidget()
+{
+ QObject *fw = focusWidget();
+
+ QObject *w = 0;
+ if (qApp) {
+ if (w == 0) w = qApp->activeModalWidget();
+ if (w == 0) w = qApp->activePopupWidget();
+ if (w == 0) w = qApp->activeWindow();
+ }
+
+ if (!w) w = fw;
+ return w;
+}
+
+/*
+ Returns the widget that has focus.
+*/
+QObject* QTestWidgets::focusWidget()
+{
+ QObject *fw = qApp->focusWidget();
+ QtUiTest::Widget *qw = qtuitest_cast<QtUiTest::Widget*>(fw);
+
+ // The widget with focus might not be a QWidget, eg, could
+ // be an item in a QGraphicsView. Use focusProxy to find
+ // the actual item with focus.
+ if (qw) {
+ QObject *focusProxy = qw->focusProxy();
+ while (focusProxy) {
+ fw = focusProxy;
+ qw = qtuitest_cast<QtUiTest::Widget*>(fw);
+ focusProxy = qw ? qw->focusProxy() : 0;
+ }
+ }
+
+ return fw;
+}
+
+QStringList QTestWidgets::objectListToSignatures(const QObjectList& ol)
+{
+ QStringList ret;
+ foreach (QObject *obj, ol) {
+ ret << QTestWidgets::signature(obj);
+ }
+ return ret;
+}
+
+QString QTestWidgets::labelText(const QString& text)
+{
+ return text.trimmed().replace(QRegExp("&(.)"), "\\1");
+}
+
+// **********************************************************************
+
+QActiveTestWidgetData::QActiveTestWidgetData()
+{
+}
+
+QActiveTestWidgetData::~QActiveTestWidgetData()
+{
+}
+
+void QActiveTestWidgetData::clear()
+{
+ resolved_buddy_pairs.clear();
+ visible_tw_buddies.clear();
+ unresolved_tw_buddies.clear();
+ visible_tw_labels.clear();
+ unresolved_tw_labels.clear();
+ app_windows.clear();
+ testWidgetsBySignature.clear();
+}
+
+void QActiveTestWidgetData::removeTestWidget( QObject *w )
+{
+ resolved_buddy_pairs.remove(w);
+ visible_tw_buddies.removeAll(w);
+ unresolved_tw_buddies.removeAll(w);
+ visible_tw_labels.removeAll(w);
+ unresolved_tw_labels.removeAll(w);
+ app_windows.removeAll(w);
+ testWidgetsBySignature.remove( QTestWidgets::signature(w) );
+}
+
+bool QActiveTestWidgetData::scan( QObject *ao )
+{
+ //FIXME: Investigate next line - required?
+ if (qobject_cast<QAbstractSpinBox*>(ao)) return false;
+
+ QActiveTestWidget::instance()->registerTestWidget(ao);
+
+ QtUiTest::Widget* aw = qtuitest_cast<QtUiTest::Widget*>(ao);
+ if (aw == 0) return false;
+
+ bool any_appended = false;
+ foreach(QObject *o, aw->children()) {
+ QActiveTestWidget::instance()->registerTestWidget(o);
+
+ if (!QTestWidgets::widgetVisible(o)) {
+ continue;
+ }
+
+ // Recursively scan child widgets
+ any_appended |= scan(o);
+
+ QtUiTest::Widget* qw = qtuitest_cast<QtUiTest::Widget*>(o);
+
+ QtUiTest::LabelWidget* lw = qtuitest_cast<QtUiTest::LabelWidget*>(o);
+ if (lw && lw->labelText() != "") {
+ visible_tw_labels.append(o);
+ }
+
+ if (qw->ignoreScan()) {
+ continue;
+ }
+
+ if (!visible_tw_buddies.contains(o)) {
+ any_appended = true;
+ visible_tw_buddies.append(o);
+ }
+ }
+
+ return any_appended;
+}
+
+void QActiveTestWidgetData::scanWindows()
+{
+ app_windows.clear();
+ foreach (QWidget *w, qApp->topLevelWidgets()) {
+ if (w->isWindow() && !w->windowTitle().isEmpty()) {
+ app_windows.append(w);
+ }
+ }
+}
+
+void QActiveTestWidgetData::resolveLabels()
+{
+ // resolve relationship between label and buddy fields
+ unresolved_tw_labels = visible_tw_labels;
+ unresolved_tw_buddies = visible_tw_buddies;
+ foreach (QObject *w, visible_tw_labels) {
+ QObject *buddy = 0;
+ QtUiTest::LabelWidget* lw = qtuitest_cast<QtUiTest::LabelWidget*>(w);
+
+ if (lw) {
+ buddy = lw->buddy();
+ }
+
+ if (!buddy)
+ buddy = QTestWidgets::locateBuddy( w, visible_tw_buddies );
+
+ if (!buddy) continue;
+
+ // If the buddy has a focus proxy, set that as the actual buddy,
+ // as that's the widget that will always receive focus.
+ QtUiTest::Widget *qbuddy = qtuitest_cast<QtUiTest::Widget*>(buddy);
+ QObject *focusProxy = qbuddy->focusProxy();
+ while (focusProxy) {
+ buddy = focusProxy;
+ qbuddy = qtuitest_cast<QtUiTest::Widget*>(focusProxy);
+ focusProxy = qbuddy ? qbuddy->focusProxy() : 0;
+ }
+
+ if (resolved_buddy_pairs.values().contains(buddy)) {
+ qLog(QtUitest) << QString("*** duplicate Label: %1[%2] -- Buddy: %3[%4]").arg(w->metaObject()->className()).arg((long)(void*)w,0,32).arg(buddy->metaObject()->className()).arg((long)(void*)buddy,0,32).toLatin1();
+ } else {
+ resolved_buddy_pairs.insert( w, buddy );
+ qLog(QtUitest) << QString("*** resolved Label: %1[%2] -- Buddy: %3[%4]").arg(w->metaObject()->className()).arg((long)(void*)w,0,32).arg(buddy->metaObject()->className()).arg((long)(void*)buddy,0,32).toLatin1();
+ unresolved_tw_buddies.removeAll( buddy );
+ unresolved_tw_labels.removeAll( buddy );
+ if (buddy != w) visible_tw_labels.removeAll( buddy );
+ unresolved_tw_labels.removeAll( w );
+ }
+ }
+}
+
+void QActiveTestWidgetData::sort()
+{
+ qStableSort(visible_tw_buddies.begin(), visible_tw_buddies.end(), QTestWidgets::lessThan);
+ qStableSort(visible_tw_labels.begin(), visible_tw_labels.end(), QTestWidgets::lessThan);
+}
+
+QObject* QActiveTestWidgetData::findWidgetByLabel( const QString &text, QString &error )
+{
+ error = "";
+ QObjectList possibleMatches;
+ QObjectList definiteMatches;
+ QString labelText = QTestWidgets::labelText(text);
+
+ foreach (QObject *o, resolved_buddy_pairs.keys()) {
+ QtUiTest::LabelWidget* lw = qtuitest_cast<QtUiTest::LabelWidget*>(o);
+ QtUiTest::TextWidget* tw = qtuitest_cast<QtUiTest::TextWidget*>(o);
+ if (lw && QTestWidgets::labelText(lw->labelText()) == labelText) {
+ definiteMatches << resolved_buddy_pairs[o];
+ } else if (tw && QTestWidgets::labelText(tw->selectedText()) == labelText) {
+ possibleMatches << resolved_buddy_pairs[o];
+ }
+ }
+ if (definiteMatches.count() == 1) {
+ return definiteMatches[0];
+ }
+ if (definiteMatches.count() > 1) {
+ error = "ERROR: '" + labelText + "' is ambiguous.\n Available labels: " + allLabels().join(",");
+ return 0;
+ }
+
+ // No definite matches.
+ if (possibleMatches.count() == 1) {
+ return possibleMatches[0];
+ }
+ if (possibleMatches.count() > 1) {
+ error = "ERROR: '" + labelText + "' is ambiguous.\n Available labels: " + allLabels().join(",");
+ return 0;
+ }
+
+ error = "ERROR: No label with text '" + labelText + "' found.\n Available labels: " + allLabels().join(",");
+ return 0;
+}
+
+QObjectList QActiveTestWidgetData::findWidgetsByLabel( const QString &text )
+{
+ QObjectList matches;
+ QString labelText = QTestWidgets::labelText(text);
+
+ for (int i=0; i<visible_tw_labels.count(); i++)
+ {
+ QObject *o = qobject_cast<QObject*>(visible_tw_labels.at(i));
+ if (o) {
+ QtUiTest::LabelWidget* lw = qtuitest_cast<QtUiTest::LabelWidget*>(o);
+ QtUiTest::TextWidget* tw = qtuitest_cast<QtUiTest::TextWidget*>(o);
+ if ((lw && QTestWidgets::labelText(lw->labelText()) == labelText) ||
+ (tw && QTestWidgets::labelText(tw->selectedText()) == labelText)) {
+ matches << resolved_buddy_pairs[o];
+ }
+ }
+ }
+
+ return matches;
+}
+
+bool QActiveTestWidgetData::findWidget( const QString &labelOrSignature, QObject *&buddy, QString &error, int offset )
+{
+ error = "";
+ buddy = 0;
+
+ qLog(QtUitest) << QString("QActiveTestWidgetData::findWidget(%1,%2)").arg(labelOrSignature).arg(offset).toLatin1();
+
+ if (labelOrSignature.contains("[") && labelOrSignature.contains("]")) {
+ // it's probably signature
+ buddy = QTestWidgets::testWidget(labelOrSignature);
+ }
+
+ if (buddy == 0) {
+ if (!QActiveTestWidget::instance()->rescan(error)) return false;
+ buddy = findWidgetByLabel(labelOrSignature, error);
+ }
+
+ if (buddy != 0 && offset == 0) {
+ qLog(QtUitest) << QString("QActiveTestWidgetData::findWidget(offset=0) ... found: " + QTestWidgets::signature(buddy)).toLatin1();
+
+ return true;
+ }
+
+ int index = 0;
+ int pos = visible_tw_buddies.indexOf(buddy);
+ if (pos < 0) {
+ error = "ERROR: Buddy widget for '" + labelOrSignature + "' not found.\nAvailable labels: " + allLabels().join(",");
+ return false;
+ }
+ index = pos + offset;
+
+ qLog(QtUitest) << QString("QActiveTestWidgetData::findWidget(offset=%1) index=%2 ").arg(offset).arg(index).toLatin1();
+
+ if ((index >= 0) && (index < visible_tw_buddies.count())) {
+ buddy = qobject_cast<QObject*>(visible_tw_buddies.at(index));
+ if (buddy)
+ return true;
+ }
+
+ return false;
+}
+
+QWidget *QActiveTestWidgetData::findWindow( const QString &titleOrSignature )
+{
+ QWidget *ret = 0;
+ foreach (QObject *o, app_windows) {
+ QWidget *window = qobject_cast<QWidget*>(o);
+ if (window &&
+ (window->windowTitle() == titleOrSignature ||
+ QTestWidgets::signature(window) == titleOrSignature)) {
+ return window;
+ }
+ }
+ return ret;
+}
+
+QStringList QActiveTestWidgetData::allLabels()
+{
+ QStringList ret;
+ foreach (QObject *label, visible_tw_labels) {
+ QtUiTest::LabelWidget* lw = qtuitest_cast<QtUiTest::LabelWidget*>(label);
+ if (label) ret << lw->labelText();
+ }
+ return ret;
+}
+
+QStringList QActiveTestWidgetData::getWindowTitles()
+{
+ QStringList ret;
+ foreach (QObject *o, app_windows) {
+ QWidget *window = qobject_cast<QWidget*>(o);
+ if (window) ret << window->windowTitle();
+ }
+ return ret;
+}
+
+// ****************************************************************
+
+#include <QTime>
+QActiveTestWidget::QActiveTestWidget()
+{
+ active_widget = 0;
+ d = new QActiveTestWidgetData();
+ scan_busy = false;
+ active_test_widget_valid = false;
+}
+
+QActiveTestWidget::~QActiveTestWidget()
+{
+ delete d;
+}
+
+QActiveTestWidget* QActiveTestWidget::instance()
+{
+ static QActiveTestWidget qatw;
+ return &qatw;
+}
+
+void QActiveTestWidget::clear()
+{
+ if (active_widget) active_widget->removeEventFilter(this);
+ active_widget = 0;
+ scan_time = 0;
+ if (d == 0) {
+ d = new QActiveTestWidgetData();
+ } else
+ d->clear();
+}
+
+const QString QActiveTestWidget::NoActiveWidgetError("ERROR: No active widget available");
+
+bool QActiveTestWidget::rescan( QString &error, int timeout )
+{
+ if (scan_busy) return true;
+ scan_busy = true;
+
+ if (d == 0) d = new QActiveTestWidgetData();
+
+ QTime t;
+ t.start();
+ QObject *aw = 0;
+ while (aw == 0) {
+ if (!QApplication::startingUp()) {
+ aw = QTestWidgets::activeWidget();
+ if (aw != 0) break;
+ }
+ if (t.elapsed() >= timeout) {
+ error = QString("%1 (timeout %2 ms)").arg(NoActiveWidgetError).arg(t.elapsed());
+ scan_busy = false;
+ return false;
+ }
+ QtUiTest::wait(3);
+ }
+
+ clear();
+ if (aw == 0) {
+ error = "ERROR: No active widget available";
+ scan_busy = false;
+ return false;
+ }
+ active_widget = aw;
+ active_widget->installEventFilter(this);
+
+ d->scan(active_widget);
+ d->scanWindows();
+
+ d->resolveLabels();
+ d->sort();
+ scan_time = t.elapsed();
+
+ scan_busy = false;
+ active_test_widget_valid = true;
+ return true;
+}
+
+//TODO: Should probably rewrite toString()
+QString QActiveTestWidget::toString()
+{
+ QString ret;
+ if (!d) rescan(ret, 1000);
+ ret = QString("Application : %1").arg(qApp->applicationName());
+ ret += "\nActive Widget: " + (active_widget ? QTestWidgets::signature(active_widget) : "(no active widget)");
+ ret += "\nFocus Widget : " + QTestWidgets::signature(QTestWidgets::focusWidget());
+
+ bool first = true;
+ QHash< QPointer<QObject>,QPointer<QObject> >::iterator i = d->resolved_buddy_pairs.begin();
+ while (i != d->resolved_buddy_pairs.end()) {
+ QObject *buddy_rec = i.value();
+ QObject *lbl = i.key(); // must be label
+ QtUiTest::LabelWidget* lw = qtuitest_cast<QtUiTest::LabelWidget*>(lbl);
+ if (buddy_rec && lw) {
+ QString lbl_txt = lw->labelText();
+ QtUiTest::LabelWidget* blw = qtuitest_cast<QtUiTest::LabelWidget*>(buddy_rec);
+ QString buddy_txt;
+ if (blw)
+ buddy_txt = blw->labelText();
+ if (buddy_txt.length() > 50)
+ buddy_txt = buddy_txt.left(50) + " [...]";
+
+ QObject *buddy(buddy_rec);
+ Q_ASSERT(buddy);
+ QtUiTest::Widget *bw = qtuitest_cast<QtUiTest::Widget*>(buddy);
+
+ QLatin1String cn(buddy->metaObject()->className());
+ if (first) {
+ ret += "\nBuddypairs:";
+ first = false;
+ }
+ ret += QString("\n Label: %1[%2] '%3' -- Buddy: %4[%5] '%6' x:%7 y:%8 h:%9 w:%10").
+ arg(lbl->metaObject()->className()).
+ arg((long)(void*)lbl,0,32).
+ arg(lbl_txt).
+ arg(cn).
+ arg((long)(void*)buddy,0,32).
+ arg(buddy_txt).
+ arg(bw->x()).
+ arg(bw->y()).
+ arg(bw->height()).
+ arg(bw->width());
+ }
+ ++i;
+ }
+
+ first = true;
+ foreach(QObject* buddy_rec, d->unresolved_tw_buddies) {
+ if (buddy_rec) {
+ QtUiTest::Widget *bw = qtuitest_cast<QtUiTest::Widget*>(buddy_rec);
+ if (bw) {
+ if (first) {
+ ret += "\nWidgets without a buddy Label:";
+ first = false;
+ }
+ ret += QString("\n %1 x:%2 y:%3 h:%4 w:%5").arg(QTestWidgets::signature(buddy_rec)).arg(bw->x()).arg(bw->y()).arg(bw->height()).arg(bw->width()).toLatin1();
+ }
+ }
+ }
+
+ first = true;
+ foreach(QObject* buddy_rec, d->unresolved_tw_buddies) {
+ if (buddy_rec) {
+ QtUiTest::Widget *bw = qtuitest_cast<QtUiTest::Widget*>(buddy_rec);
+ if (bw) {
+ if (first) {
+ ret += "\nDisabled widgets without a buddy Label:";
+ first = false;
+ }
+ ret += QString("\n %1 x:%2 y:%3 h:%4 w:%5").arg(QTestWidgets::signature(buddy_rec)).arg(bw->x()).arg(bw->y()).arg(bw->height()).arg(bw->width()).toLatin1();
+ }
+ }
+ }
+
+ first = true;
+ foreach(QObject *lbl, d->unresolved_tw_labels) {
+ if (lbl) {
+ QtUiTest::Widget *vw = qtuitest_cast<QtUiTest::Widget*>(lbl);
+ QtUiTest::LabelWidget* lw = qtuitest_cast<QtUiTest::LabelWidget*>(lbl);
+ if (!vw || !lw) continue;
+ QString txt = lw->labelText();
+ if (first) {
+ ret += "\nLabels without a buddy widget:";
+ first = false;
+ }
+ ret += QString("\n %1 Text: %2 x:%3 y:%4 h:%5 w:%6").arg(QTestWidgets::signature(lbl)).arg(txt).arg(vw->x()).arg(vw->y()).arg(vw->height()).arg(vw->width()).toLatin1();
+ }
+ }
+
+ first = true;
+ foreach(QObject *tw, d->visible_tw_buddies) {
+ QtUiTest::Widget *bw = qtuitest_cast<QtUiTest::Widget*>(tw);
+ if (bw) {
+ if (first) {
+ ret += "\nBuddy widgets sorted on position:";
+ first = false;
+ }
+ ret += QString("\n %1 x:%2 y:%3 h:%4 w:%5").arg(QTestWidgets::signature(tw)).arg(bw->x()).arg(bw->y()).arg(bw->height()).arg(bw->width());
+ }
+ }
+
+ return ret;
+}
+
+QStringList QActiveTestWidget::allLabels()
+{
+ if (d) return d->allLabels();
+ return QStringList("ERROR: No labels found");
+}
+
+QStringList QActiveTestWidget::getWindowTitles()
+{
+ QString error;
+ if (!d && !rescan(error)) return QStringList(error);
+ d->scanWindows();
+ return d->getWindowTitles();
+}
+
+QWidget *QActiveTestWidget::findWindow( const QString &titleOrSignature )
+{
+ QString error;
+ if (!d && !rescan(error)) return 0;
+ d->scanWindows();
+ return d->findWindow(titleOrSignature);
+}
+
+/*!
+ Returns the friendliest possible, unambiguous name for \a o.
+*/
+QString QActiveTestWidget::friendlyName( QObject* o )
+{
+ QtUiTest::Widget* w = qtuitest_cast<QtUiTest::Widget*>(o);
+
+ if (!w)
+ return QTestWidgets::signature(o);
+
+ if (w->inherits(QtUiTest::TabBar))
+ return TAB_BAR_ALIAS;
+
+ QString ret;
+ rescan(ret, 50);
+
+ // Look through all of the buddy/label pairs.
+ // If this widget is in the list, then return its label as the friendly name.
+ QObject* label = 0;
+ QHash< QPointer<QObject>, QPointer<QObject> >::iterator i;
+ int focusableBuddyCount = 0;
+ for ( i = d->resolved_buddy_pairs.begin(); i != d->resolved_buddy_pairs.end(); ++i) {
+ QObject* buddy = i.value();
+ if (!buddy) continue;
+
+ // Determine if this widget can ever have focus.
+ QtUiTest::Widget *widget = qtuitest_cast<QtUiTest::Widget*>(buddy);
+ if (widget->focusPolicy() != Qt::NoFocus) {
+ ++focusableBuddyCount;
+ }
+ label = i.key();
+ if (!label) continue;
+
+ if (widget == w)
+ break;
+
+ widget = qtuitest_cast<QtUiTest::Widget*>(label);
+ if (widget == w)
+ break;
+ label = 0;
+ }
+
+ if (!label) {
+ // If this is the _only_ widget that can have focus,
+ // an empty string is good enough.
+ if (!focusableBuddyCount || ((1 == focusableBuddyCount) && w->hasFocus()))
+ return QString();
+ return QTestWidgets::signature(o);
+ }
+
+ // If we get here, then the widget was in the list of buddy/label pairs,
+ // so we can return the label text.
+ QtUiTest::LabelWidget* lw = qtuitest_cast<QtUiTest::LabelWidget*>(label);
+ if (lw) {
+ ret = QTestWidgets::labelText(lw->labelText());
+ } else {
+ ret = QTestWidgets::signature(o);
+ }
+ return ret;
+}
+
+bool QActiveTestWidget::findWidget( const QString &labelOrSignature, QObject *&buddy, QString &error, int offset )
+{
+ bool was_valid = active_test_widget_valid;
+ bool ok = findWidget_impl(labelOrSignature,buddy,error,offset);
+ if (!ok && was_valid) {
+ active_test_widget_valid = false;
+ if (!rescan(error)) return false;
+ ok = findWidget_impl(labelOrSignature,buddy,error,offset);
+ }
+ if (!ok) error += "\n" + toString();
+ return ok;
+}
+
+bool QActiveTestWidget::findWidget_impl( const QString &labelOrSignature, QObject *&buddy, QString &error, int offset )
+{
+ if (labelOrSignature.isEmpty()) {
+ buddy = QTestWidgets::focusWidget();
+ if (buddy == 0) {
+ error = "ERROR: No focus Widget available\n";
+ }
+ return buddy != 0;
+ }
+
+ return d->findWidget( labelOrSignature, buddy, error, offset );
+}
+
+QObjectList QActiveTestWidget::findObjectsByProperty( const QString &property, const QVariant &searchValue, const QObjectList &initList )
+{
+ QObjectList foundList;
+ QRegExp searchRegExp = searchValue.toRegExp();
+ QString searchString = searchValue.toString();
+
+ if (!searchRegExp.isEmpty() && !searchRegExp.isValid())
+ {
+ QtUiTest::setErrorString("Invalid regular expression");
+ return foundList;
+ }
+
+ QObjectList searchList(initList);
+ QString propertyUpper = property.toUpper();
+
+ if (searchList.isEmpty()) {
+ searchList << QTestWidgets::activeWidget();
+
+ foreach (QObject *tw, d->resolved_buddy_pairs.values()) {
+ if (!searchList.contains(tw)) searchList << tw;
+ }
+
+ foreach (QObject *tw, d->unresolved_tw_buddies) {
+ if (!searchList.contains(tw)) searchList << tw;
+ }
+
+ foreach (QObject *l, d->visible_tw_labels) {
+ if (!searchList.contains(l)) searchList << l;
+ }
+ }
+
+ QObjectList filterList;
+ if (propertyUpper == "LABEL") {
+ filterList = d->findWidgetsByLabel(searchValue.toString());
+ } else if (propertyUpper == "CHILD_OF") {
+ QObject *parent;
+ QString error;
+ QString labelOrSignature(searchValue.toString());
+ if (findWidget_impl(labelOrSignature, parent, error, 0)) {
+ QtUiTest::Widget *qw = qtuitest_cast<QtUiTest::Widget*>(parent);
+ if (qw) filterList = qw->children();
+ }
+ } else if (propertyUpper == "DESCENDANT_OF") {
+ QObject *parent;
+ QString error;
+ QString labelOrSignature(searchValue.toString());
+ if (findWidget_impl(labelOrSignature, parent, error, 0)) {
+ QtUiTest::Widget *qw = qtuitest_cast<QtUiTest::Widget*>(parent);
+ if (qw) qw->descendants(filterList);
+ }
+ } else if (propertyUpper == "PARENT_OF") {
+ QObject *child;
+ QString error;
+ QString labelOrSignature(searchValue.toString());
+ if (findWidget_impl(labelOrSignature, child, error, 0)) {
+ QtUiTest::Widget *qw = qtuitest_cast<QtUiTest::Widget*>(child);
+ filterList << qw->parent();
+ }
+ }
+
+ foreach (QObject *obj, searchList) {
+
+ QtUiTest::Widget *w = qtuitest_cast<QtUiTest::Widget*>(obj);
+ if (w) {
+ QVariant value = w->getProperty(property);
+ if (value.isValid()) {
+ if (QObject *obj = value.value<QObject*>()) {
+ value = QTestWidgets::signature(obj);
+ }
+ if ((value == searchValue) ||
+ (value.canConvert(QVariant::String) && value.toString() == searchString)) {
+ foundList << obj;
+ } else if (!searchRegExp.isEmpty() && searchRegExp.exactMatch(value.toString())) {
+ foundList << obj;
+ }
+ continue;
+ }
+ }
+
+ QMetaObject const *mo = obj->metaObject();
+
+ // Handle className like a property
+ if (propertyUpper == "CLASSNAME" && mo->className() == searchValue) {
+ foundList << obj;
+ continue;
+ }
+
+ if (propertyUpper == "INHERITS" && obj->inherits(searchValue.toString().toLatin1())) {
+ foundList << obj;
+ continue;
+ }
+
+ if ((propertyUpper == "LABEL" ||
+ propertyUpper == "CHILD_OF" ||
+ propertyUpper == "DESCENDANT_OF" ||
+ propertyUpper == "PARENT_OF") && filterList.contains(obj)) {
+ foundList << obj;
+ continue;
+ }
+
+ if (propertyUpper == "TESTWIDGET") {
+ if ((searchValue == "ActivateWidget" && qtuitest_cast<QtUiTest::ActivateWidget*>(obj)) ||
+ (searchValue == "LabelWidget" && qtuitest_cast<QtUiTest::LabelWidget*>(obj)) ||
+ (searchValue == "CheckWidget" && qtuitest_cast<QtUiTest::CheckWidget*>(obj)) ||
+ (searchValue == "CheckItemWidget" && qtuitest_cast<QtUiTest::CheckItemWidget*>(obj)) ||
+ (searchValue == "TextWidget" && qtuitest_cast<QtUiTest::TextWidget*>(obj)) ||
+ (searchValue == "ListWidget" && qtuitest_cast<QtUiTest::ListWidget*>(obj)) ||
+ (searchValue == "InputWidget" && qtuitest_cast<QtUiTest::InputWidget*>(obj)) ||
+ (searchValue == "SelectWidget" && qtuitest_cast<QtUiTest::SelectWidget*>(obj)) ||
+ (searchValue == "IndexedWidget" && qtuitest_cast<QtUiTest::IndexedWidget*>(obj))) {
+ foundList << obj;
+ continue;
+ }
+ }
+
+ // Accessibility properties (preliminary support)
+#ifndef QT_NO_ACCESSIBILITY
+ if (propertyUpper == "ROLE") {
+ QAccessibleInterface *accIface = QAccessible::queryAccessibleInterface(obj);
+ if (accIface && accIface->role(0) == searchValue.toInt())
+ foundList << obj;
+ delete accIface;
+ continue;
+ }
+
+ if (propertyUpper == "STATE") {
+ QAccessibleInterface *accIface = QAccessible::queryAccessibleInterface(obj);
+ if (accIface && accIface->state(0) & searchValue.toInt())
+ foundList << obj;
+ delete accIface;
+ continue;
+ }
+#endif
+
+ }
+
+ return foundList;
+}
+
+QObjectList QActiveTestWidget::findObjectsByProperty( const QVariantMap &searchValues )
+{
+ QObjectList searchList;
+
+ QVariantMap::const_iterator i = searchValues.constBegin();
+ while (i != searchValues.constEnd()) {
+ searchList = findObjectsByProperty(i.key(), i.value(), searchList);
+ if (searchList.isEmpty())
+ break;
+ ++i;
+ }
+
+ return searchList;
+}
+
+bool QActiveTestWidget::eventFilter(QObject * /*obj*/, QEvent *event)
+{
+ if (event->type() == QEvent::Hide ||
+ event->type() == QEvent::Show ||
+ event->type() == QEvent::EnabledChange ||
+#ifdef Q_WS_QWS
+ event->type() == QEvent::EnterEditFocus ||
+ event->type() == QEvent::LeaveEditFocus ||
+#endif
+ event->type() == QEvent::ParentChange ||
+ event->type() == QEvent::FocusIn ||
+ event->type() == QEvent::FocusOut ||
+ event->type() == QEvent::HideToParent ||
+ event->type() == QEvent::ShowToParent ||
+ event->type() == QEvent::WindowTitleChange ||
+ event->type() == QEvent::ChildAdded ||
+ event->type() == QEvent::ChildRemoved ) active_test_widget_valid = false;
+ return false;
+}
diff --git a/libqtslave/qtestwidgets.h b/libqtslave/qtestwidgets.h
new file mode 100644
index 0000000..76a072a
--- /dev/null
+++ b/libqtslave/qtestwidgets.h
@@ -0,0 +1,167 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTESTWIDGETS_H
+#define QTESTWIDGETS_H
+
+#include <QHash>
+#include <QMetaType>
+#include <QObject>
+#include <QPointer>
+#include <QString>
+#include <QStringList>
+#include <QVariantMap>
+#include <QWidget>
+
+#include <qtuitestnamespace.h>
+#include <qtuitestglobal.h>
+
+// Max timeout before we expect a visible clue on the device that the app is responding.
+#define VISIBLE_RESPONSE_TIME 5000
+
+#define USE_ADDRESS_FOR_SIGNATURE
+class QTestWidget;
+
+class QTSLAVE_EXPORT QActiveTestWidgetData : public QObject
+{
+public:
+ QActiveTestWidgetData();
+ ~QActiveTestWidgetData();
+
+ void clear();
+ void removeTestWidget( QObject* );
+ void sort();
+ void resolveLabels();
+ bool scan( QObject* aw );
+ void scanWindows();
+ QStringList allLabels();
+ QStringList getWindowTitles();
+ QWidget *findWindow(const QString&);
+ QObject* findWidgetByLabel( const QString &text, QString &error );
+ QObjectList findWidgetsByLabel( const QString &text );
+ bool findWidget( const QString &labelOrSignature, QObject *&widget, QString &error, int offset );
+
+ QHash<QString, QObject*> testWidgetsBySignature;
+ QHash< QPointer<QObject>, QPointer<QObject> > resolved_buddy_pairs;
+ QObjectList visible_tw_buddies;
+ QObjectList unresolved_tw_buddies;
+ QObjectList visible_tw_labels;
+ QObjectList unresolved_tw_labels;
+ QObjectList app_windows;
+};
+
+class QTSLAVE_EXPORT QActiveTestWidget : public QObject
+{
+ Q_OBJECT
+public:
+ static QActiveTestWidget* instance();
+
+ void clear();
+ bool rescan( QString &error, int timeout = VISIBLE_RESPONSE_TIME );
+ QString toString();
+ QStringList allLabels();
+ QStringList getWindowTitles();
+ QWidget *findWindow(const QString&);
+ bool findWidget( const QString &labelOrSignature, QObject *&widget, QString &error, int offset = 0 );
+ QObjectList findObjectsByProperty( const QString&, const QVariant&, const QObjectList& = QObjectList() );
+ QObjectList findObjectsByProperty( const QVariantMap& );
+ QString friendlyName(QObject*);
+ bool isList();
+ QObject* testWidget( const QString &signature );
+
+ void registerTestWidget( QObject *ao );
+
+ static const QString NoActiveWidgetError;
+
+protected:
+ bool eventFilter(QObject *obj, QEvent *event);
+ bool findWidget_impl( const QString &labelOrSignature, QObject *&widget, QString &error, int offset );
+
+protected slots:
+ void onDestroyed(QObject*);
+
+private:
+ QActiveTestWidget();
+ ~QActiveTestWidget();
+
+ QPointer<QObject> active_widget;
+ bool scan_busy;
+ int scan_time;
+
+ QActiveTestWidgetData *d;
+};
+
+//
+// This is the class that manages the test widgets and handles queries about them.
+//
+class QTSLAVE_EXPORT QTestWidgets
+{
+public:
+ static QObject* activeWidget();
+ static QObjectList topLevelObjects();
+
+ static QObject* testWidget( const QString signature );
+ static QObject* locateBuddy( const QObject *testlabel, const QObjectList &search_list );
+ static QString signature( const QObject* object );
+
+ static bool widgetVisible( QObject *widget );
+ static QObject* focusWidget();
+
+ static QStringList objectListToSignatures(const QObjectList&);
+
+ static QString labelText(const QString&);
+
+ static bool lessThan(QObject *a, QObject *b) {
+ QtUiTest::Widget *wa = qtuitest_cast<QtUiTest::Widget*>(a);
+ QtUiTest::Widget *wb = qtuitest_cast<QtUiTest::Widget*>(b);
+ Q_ASSERT(wa && wb);
+ if (wa->y() == wb->y())
+ return wa->x() < wb->x();
+ else
+ return wa->y() < wb->y();
+ }
+
+private:
+ static QString uniqueName( const QObject *item );
+
+};
+
+#endif
diff --git a/libqtuitest/DESCRIPTION b/libqtuitest/DESCRIPTION
new file mode 100644
index 0000000..289743a
--- /dev/null
+++ b/libqtuitest/DESCRIPTION
@@ -0,0 +1 @@
+Support library for QtUitest plugins.
diff --git a/libqtuitest/demowidgets_p.h b/libqtuitest/demowidgets_p.h
new file mode 100644
index 0000000..51ca0d0
--- /dev/null
+++ b/libqtuitest/demowidgets_p.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DEMOWIDGETS_P_H
+#define DEMOWIDGETS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtUiTest API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QWidget>
+#include <QBasicTimer>
+
+class MouseClickDemoWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ MouseClickDemoWidget();
+
+ void start(const QPoint&,int);
+ void stop();
+
+protected:
+ void paintEvent(QPaintEvent*);
+ void timerEvent(QTimerEvent*);
+
+private:
+ QVector<QPoint> offsets;
+ QRect bound;
+ QPixmap pm;
+ int tickCount;
+ int pressTick;
+ QBasicTimer pressTimer;
+};
+
+class MousePressDemoWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ MousePressDemoWidget();
+
+ void start(const QPoint&);
+ void stop();
+
+protected:
+ void paintEvent(QPaintEvent*);
+ void timerEvent(QTimerEvent*);
+
+private:
+ static QPixmap& pm();
+ QBasicTimer pressTimer;
+};
+
+#endif
+
diff --git a/libqtuitest/libqtuitest.pro b/libqtuitest/libqtuitest.pro
new file mode 100644
index 0000000..26493af
--- /dev/null
+++ b/libqtuitest/libqtuitest.pro
@@ -0,0 +1,83 @@
+DEFINES+=QTUITEST_TARGET
+
+enable_valgrind:DEFINES+=QTUITEST_HAVE_VALGRIND
+
+PRIVATE_HEADERS += \
+ qeventwatcher_p.h \
+ qinputgenerator_p.h \
+ qtuitestconnectionmanager_p.h \
+ qtuitestwidgets_p.h
+
+SEMI_PRIVATE_HEADERS += \
+ qalternatestack_p.h \
+ qtuitestelapsedtimer_p.h \
+ qtestprotocol_p.h \
+ recordevent_p.h
+
+HEADERS += \
+ qtuitestglobal.h \
+ qtuitestnamespace.h \
+ qtuitestrecorder.h \
+ qtuitestwidgetinterface.h \
+ testwidget.h
+
+SOURCES += \
+ qtuitestelapsedtimer.cpp \
+ qeventwatcher.cpp \
+ qinputgenerator.cpp \
+ qtestprotocol.cpp \
+ qtuitestconnectionmanager.cpp \
+ qtuitestnamespace.cpp \
+ qtuitestrecorder.cpp \
+ qtuitestwidgetinterface.cpp \
+ qtuitestwidgets.cpp \
+ testwidget.cpp
+
+unix:!symbian {
+ SOURCES+=qalternatestack_unix.cpp
+ embedded:SOURCES += qinputgenerator_qws.cpp
+ !embedded:!mac {
+ SOURCES += qinputgenerator_x11.cpp
+ LIBS += -lXtst
+ }
+ MOC_DIR=$$OUT_PWD/.moc
+ OBJECTS_DIR=$$OUT_PWD/.obj
+ DESTDIR=$$BUILDROOT/lib
+}
+
+symbian {
+ TARGET.EPOCALLOWDLLDATA=1
+ TARGET.CAPABILITY += AllFiles ReadDeviceData ReadUserData SwEvent WriteUserData NetworkServices
+ SOURCES += qalternatestack_symbian.cpp qinputgenerator_symbian.cpp
+ LIBS += -lws32
+ LIBS += -leuser -lcone
+}
+
+mac {
+ SOURCES += qinputgenerator_mac.cpp
+ LIBS += -framework ApplicationServices -framework Carbon
+}
+
+win32 {
+ SOURCES += qalternatestack_win.cpp \
+ qinputgenerator_win.cpp
+ LIBS += -luser32
+ target.path=$$INSTALLROOT
+ INSTALLS+=target
+}
+
+symbian {
+ MOC_DIR=$$OUT_PWD/moc
+ OBJECTS_DIR=$$OUT_PWD/obj
+ CONFIG+=staticlib
+}
+
+TEMPLATE=lib
+QT+=network
+HEADERS+=$$SEMI_PRIVATE_HEADERS $$PRIVATE_HEADERS
+VPATH+=$$PWD
+INCLUDEPATH+=$$PWD
+TARGET=qtuitest
+TARGET=$$qtLibraryTarget($$TARGET)
+CONFIG-=debug_and_release_target
+
diff --git a/libqtuitest/qalternatestack_p.h b/libqtuitest/qalternatestack_p.h
new file mode 100644
index 0000000..701c797
--- /dev/null
+++ b/libqtuitest/qalternatestack_p.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QALTERNATESTACK_P_H
+#define QALTERNATESTACK_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtUiTest API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QObject>
+#include <QVariant>
+#include <qtuitestglobal.h>
+
+class QAlternateStack;
+typedef void (*QAlternateStackEntryPoint)(QAlternateStack*,QVariant const&);
+
+struct QAlternateStackPrivate;
+
+class QTUITEST_EXPORT QAlternateStack : public QObject
+{
+ Q_OBJECT
+
+public:
+ QAlternateStack(quint32 = 65536, QObject* = 0);
+ virtual ~QAlternateStack();
+
+ bool isActive() const;
+ bool isCurrentStack() const;
+
+ static QList<QAlternateStack*> instances();
+ static bool isAvailable();
+
+public slots:
+ void start(QAlternateStackEntryPoint, const QVariant& = QVariant());
+ void switchTo();
+ void switchFrom();
+
+private:
+ QAlternateStackPrivate* d;
+ friend struct QAlternateStackPrivate;
+};
+
+#endif
+
diff --git a/libqtuitest/qalternatestack_symbian.cpp b/libqtuitest/qalternatestack_symbian.cpp
new file mode 100644
index 0000000..1fad1db
--- /dev/null
+++ b/libqtuitest/qalternatestack_symbian.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qalternatestack_p.h"
+struct QAlternateStackPrivate
+{
+ // All instances of QAlternateStack.
+// static QList<QAlternateStack*> instances;
+};
+
+//QList<QAlternateStack*> QAlternateStackPrivate::instances;
+
+QAlternateStack::QAlternateStack(quint32 size, QObject* parent)
+ : QObject(parent),
+ d(new QAlternateStackPrivate)
+{
+ Q_UNUSED(size);
+ Q_UNUSED(parent);
+ qFatal("QAlternateStack: not available on this platform");
+}
+
+QAlternateStack::~QAlternateStack()
+{
+}
+
+void QAlternateStack::start(QAlternateStackEntryPoint entry, const QVariant& data)
+{
+ Q_UNUSED(entry);
+ Q_UNUSED(data);
+}
+
+void QAlternateStack::switchTo()
+{
+}
+
+void QAlternateStack::switchFrom()
+{
+}
+
+bool QAlternateStack::isActive() const
+{ return false; }
+
+bool QAlternateStack::isCurrentStack() const
+{ return false; }
+
+QList<QAlternateStack*> QAlternateStack::instances()
+{ static QList<QAlternateStack*> l;
+ return l;
+ //QAlternateStackPrivate::instances; }
+}
+
+bool QAlternateStack::isAvailable()
+{ return false; }
+
diff --git a/libqtuitest/qalternatestack_unix.cpp b/libqtuitest/qalternatestack_unix.cpp
new file mode 100644
index 0000000..3c5de65
--- /dev/null
+++ b/libqtuitest/qalternatestack_unix.cpp
@@ -0,0 +1,529 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qalternatestack_p.h"
+
+#include <errno.h>
+#include <setjmp.h>
+#include <signal.h>
+#include <sys/syscall.h>
+#include <unistd.h>
+
+#include <QDebug>
+
+#ifdef QTUITEST_HAVE_VALGRIND
+# include <valgrind/valgrind.h>
+/* Make sure we have the right version of valgrind.h */
+# if !defined(VALGRIND_STACK_REGISTER) || !defined(VALGRIND_STACK_DEREGISTER) || !defined(VALGRIND_STACK_CHANGE)
+# warn You have Valgrind but are missing stack annotation macros, disabling Valgrind features.
+# undef QTUITEST_HAVE_VALGRIND
+# endif
+#endif
+
+struct QAlternateStackPrivate
+{
+ QAlternateStack* q;
+
+ // The memory containing the alternate stack.
+ QByteArray stackBuffer;
+ char* stackBegin;
+ int stackSize;
+
+#ifdef QTUITEST_HAVE_VALGRIND
+ int stackValgrindId;
+#endif
+
+ void allocate(int);
+
+ // Alternate and original stack objects.
+ stack_t alternateStack;
+ stack_t originalStack;
+
+ // Sigaction used to jump to new stack, and original sigaction.
+ struct sigaction alternateAction;
+ struct sigaction originalAction;
+
+ // jmp_buf for jumping between stacks.
+ sigjmp_buf alternateJmp;
+ sigjmp_buf originalJmp;
+
+ // Starting point of the new stack.
+ QAlternateStackEntryPoint entryFunction;
+
+ // Argument to be passed to entryFunction.
+ QVariant entryData;
+
+ // All instances of QAlternateStack.
+ static QList<QAlternateStack*> instances;
+};
+QList<QAlternateStack*> QAlternateStackPrivate::instances;
+
+QTUITEST_EXPORT char*& qalternatestack_stackbuf()
+{ static char* ret = 0; return ret; }
+QTUITEST_EXPORT int& qalternatestack_stackbuf_len()
+{ static int ret = 0; return ret; }
+
+#ifndef QT_NO_DEBUG
+QString qobject_to_string(QObject* object)
+{
+ QString ret;
+ {
+ QDebug dbg(&ret);
+ dbg << object;
+ }
+ return ret;
+}
+#endif
+
+void qt_sigaltstack(stack_t const* ss, stack_t* oss)
+{
+ if (0 != sigaltstack(ss, oss)) {
+ qFatal("QAlternateStack: error in sigaltstack: %s", strerror(errno));
+ }
+}
+
+void qt_sigaction(int signum, struct sigaction const* act, struct sigaction* oldact)
+{
+ if (0 != sigaction(signum,act,oldact)) {
+ qFatal("QAlternateStack: error in sigaction: %s", strerror(errno));
+ }
+}
+
+void qt_raise(int signum)
+{
+ if (-1 == raise(signum)) {
+ qFatal("QAlternateStack: error in raise: %s", strerror(errno));
+ }
+}
+
+QAlternateStackPrivate* qt_next_stack;
+
+static const int JMP_SWITCHFROM = 2;
+static const int JMP_SWITCHTO = 3;
+static const int JMP_FINISH = 4;
+static const int QALTERNATESTACK_SIGNAL = SIGUSR2;
+
+/*
+ This wrapper function is called when we first enter an alternate stack,
+ via the raising of QALTERNATESTACK_SIGNAL.
+*/
+void qt_entry_function_wrapper(int)
+{
+ // Establish this context into the alternate jmp_buf.
+ // We cannot have the whole stack run during a signal handler,
+ // so we store our context when we are first called, then return and allow
+ // the original stack to jump back to us.
+
+ int value = sigsetjmp(qt_next_stack->alternateJmp, 0);
+
+ // We might be here for these reasons:
+ //
+ // 1. We are handling the signal and just called setjmp.
+ // value == 0.
+ if (0 == value) {
+ // Return from the signal handler; the original stack will jump back
+ // to us via longjmp.
+ return;
+ }
+ // 2. We are switched to from the original stack.
+ // value == JMP_SWITCHTO.
+ else if (JMP_SWITCHTO == value) {
+ }
+ // Whoops, programmer error.
+ else Q_ASSERT(0);
+
+ QAlternateStackPrivate* stack = qt_next_stack;
+ stack->entryFunction(stack->q, stack->entryData);
+
+ // OK, jump back to the main stack and let it know that we're finished.
+ // We can't just return here; if we did, we'd jump back to the signal
+ // handler frame, but the signal handler is already finished.
+ siglongjmp(stack->originalJmp, JMP_FINISH);
+}
+
+/*!
+ \internal
+ \class QAlternateStack
+ \inpublicgroup QtUiTestModule
+ \brief The QAlternateStack class provides a call stack.
+
+ QAlternateStack can be used to switch between two call stacks without
+ using threads.
+
+ There is one anticipated use for this class, and that is to wait for a
+ specific amount of time, while processing events, without hanging if a
+ nested event loop occurs.
+
+ Example:
+ \code
+ void runsInAlternateStack(QAlternateStack* stack, QVariant const& data)
+ {
+ int foo = data.toInt();
+ // ...
+ // Need to wait for about 1500 milliseconds here, while processing events.
+ // Process events in the main stack to avoid hanging on nested event loops.
+ QTimer::singleShot(1500, stack, SLOT(switchTo()));
+ stack->switchFrom();
+
+ // Execution resumes here in ~1500ms, as long as the main stack is
+ // processing events, even if there was a nested event loop.
+ // ...
+
+ // Don't need the stack any more
+ stack->deleteLater();
+ }
+
+ void runsInMainStack()
+ {
+ QAlternateStack* stack = new QAlternateStack;
+ stack->start(runsInAlternateStack, 123);
+ }
+ \endcode
+
+ Using this class makes code more difficult to understand. Use an
+ alternative where possible.
+*/
+
+/*!
+ \relates QAlternateStack
+ \typedef QAlternateStackEntryPoint
+
+ Typedef for a pointer to a function with the signature
+ \c{void my_function(QAlternateStack*,QVariant const&)}.
+
+ Used as an entry point to a new stack.
+*/
+
+/*!
+ Creates an alternate stack of \a size bytes with the given \a parent.
+
+ Behavior is undefined if the alternate stack exceeds \a size.
+*/
+QAlternateStack::QAlternateStack(quint32 size, QObject* parent)
+ : QObject(parent),
+ d(new QAlternateStackPrivate)
+{
+ Q_ASSERT_X(QAlternateStack::isAvailable(), "QAlternateStack",
+ "QAlternateStack is not available on this platform!");
+
+ d->q = this;
+ d->entryFunction = 0;
+
+ d->allocate(size);
+
+#ifdef QTUITEST_HAVE_VALGRIND
+ d->stackValgrindId = VALGRIND_STACK_REGISTER(d->stackBegin, d->stackBegin+d->stackSize);
+#endif
+
+ QAlternateStackPrivate::instances << this;
+}
+
+void QAlternateStackPrivate::allocate(int size)
+{
+ if (!qalternatestack_stackbuf()) {
+ // Allocate space for the new stack.
+ stackBuffer.resize(size);
+ stackBegin = stackBuffer.data();
+ stackSize = size;
+ return;
+ }
+
+ /*
+ On some systems, it has been found that due to limitations in the kernel and/or threading
+ implementation, setting the stack pointer to point to memory allocated anywhere other than
+ the main stack causes a crash (bug 209341).
+
+ This code works around this bug by using a pool of memory which was earlier allocated on
+ the stack. qalternatestack_stackbuf() and qalternatestack_stackbuf_len() must be
+ explicitly initialized to point to a block of memory and to tell us its length.
+ */
+
+ // Find the first chunk of unused memory.
+ char* begin = qalternatestack_stackbuf();
+ char* end = qalternatestack_stackbuf() + qalternatestack_stackbuf_len();
+ char* found = 0;
+ int total_used = 0;
+
+ for (char* buf = begin; buf <= end - size && !found; buf += size) {
+ char* buf_end = buf + size;
+ // Is this block of memory definitely unused?
+ bool used = false;
+ foreach (QAlternateStack* st, QAlternateStackPrivate::instances) {
+ char* st_buf = st->d->stackBegin;
+ char* st_buf_end = st->d->stackBegin + st->d->stackSize;
+ // If we start after this stack ends, or we end before it finishes, we're OK.
+ if (buf >= st_buf_end || buf_end <= st_buf) {
+ } else {
+ used = true;
+ total_used += (st_buf_end - st_buf);
+ break;
+ }
+ }
+ if (!used) found = buf;
+ }
+
+ if (!found) {
+ qFatal( "QtUiTest: QAlternateStack ran out of memory! There seem to be %d stacks using a "
+ "total of %d bytes (out of %d), and a stack of size %d was requested. "
+ "Please increase the size of qalternatestack_stackbuf!",
+ QAlternateStackPrivate::instances.count(), total_used,
+ qalternatestack_stackbuf_len(), size);
+ }
+ stackBegin = found;
+ stackSize = size;
+}
+
+/*!
+ Destroys the alternate stack.
+
+ Behavior is undefined if the stack is destroyed while currently active.
+*/
+QAlternateStack::~QAlternateStack()
+{
+#ifdef QTUITEST_HAVE_VALGRIND
+ VALGRIND_STACK_DEREGISTER(d->stackValgrindId);
+#endif
+
+ delete d;
+ d = 0;
+ QAlternateStackPrivate::instances.removeAll(this);
+}
+
+/*!
+ Switch from the original stack to the alternate stack, and start
+ executing \a entry in the alternate stack.
+ This stack and \a data will be passed as an argument to \a entry.
+
+ This function should be called when first switching to an alternate
+ stack. When resuming a stack that is already active, use switchTo().
+
+ \sa switchTo(), switchFrom()
+*/
+void QAlternateStack::start(QAlternateStackEntryPoint entry, const QVariant& data)
+{
+ Q_ASSERT_X(!isActive(), "QAlternateStack::start",
+ qPrintable(QString("`start' called while already active. sender(): %1")
+ .arg(qobject_to_string(sender()))));
+
+ // Set up the alternate stack to be jumped to.
+ d->alternateStack.ss_sp = d->stackBegin;
+ d->alternateStack.ss_flags = 0;
+ d->alternateStack.ss_size = d->stackSize;
+ qt_sigaltstack(&d->alternateStack, &d->originalStack);
+
+ // Set up signal handler to jump to entry function wrapper in alternate stack.
+ d->alternateAction.sa_handler = qt_entry_function_wrapper;
+ sigemptyset(&d->alternateAction.sa_mask);
+ d->alternateAction.sa_flags = SA_ONSTACK;
+ qt_sigaction(QALTERNATESTACK_SIGNAL, &d->alternateAction, &d->originalAction);
+
+ // Raise the signal, jumping to the alternate stack.
+ qt_next_stack = d;
+ qt_raise(QALTERNATESTACK_SIGNAL);
+
+ // signal handler returns immediately after storing its context into
+ // alternateJmp. Restore the old signal handler.
+ qt_sigaltstack(&d->originalStack, 0);
+ qt_sigaction(QALTERNATESTACK_SIGNAL, &d->originalAction, 0);
+
+ // OK, now store the entry function and data and jump to the new stack.
+ d->entryFunction = entry;
+ d->entryData = data;
+
+ switchTo();
+}
+
+/*!
+ Switch from the original stack to the alternate stack.
+
+ This function can be called to resume execution in an alternate stack.
+
+ If execution has been suspended in the alternate stack by a call to
+ switchFrom(), switchTo() will resume executing at that point.
+ If the alternate stack has completed execution or hasn't started, this
+ function does nothing and returns immediately.
+
+ It is an error to call this function from the alternate stack.
+*/
+void QAlternateStack::switchTo()
+{
+ // We must not be the currently active stack.
+ Q_ASSERT_X(!isCurrentStack(), "QAlternateStack::switchTo",
+ qPrintable(QString("`switchTo' called in currently active stack. sender(): %1")
+ .arg(qobject_to_string(sender()))));
+
+ // Store where we currently are.
+ int value = sigsetjmp(d->originalJmp, 1);
+
+ // Now it really gets tricky.
+ // At this particular point, we could be here for these reasons:
+ //
+ // 1. switchTo() was actually called from the original stack
+ // and we just returned from setjmp.
+ // value == 0.
+ //
+ // 2. The alternate stack switched to the original stack
+ // by calling switchFrom().
+ // value == JMP_SWITCHFROM.
+ //
+ // 3. The alternate stack finished execution and jumped back to us.
+ // value == JMP_FINISH.
+
+ // Case 1: just returned from setjmp.
+ // Jump to the other stack.
+ if (0 == value) {
+ // If there is no entry function, that means `start' has not been called or we have
+ // finished already. In other words, there's no more to process on this stack, so
+ // just return immediately.
+ if (!d->entryFunction) return;
+
+ // This function never returns; from here we will jump back to
+ // the above call to setjmp() via case 2 or 3.
+ siglongjmp(d->alternateJmp, JMP_SWITCHTO);
+ }
+
+ // Case 2: switchFrom() called in alternate stack.
+ if (value == JMP_SWITCHFROM) {
+ // Don't need to do anything, just return.
+ return;
+ }
+
+ // Case 3: The alternate stack finished execution.
+ // Just need to do a little cleanup.
+ if (value == JMP_FINISH) {
+ d->entryFunction = 0;
+ d->entryData = QVariant();
+ return;
+ }
+
+ // Whoops, bad programmer.
+ Q_ASSERT(0);
+}
+
+/*!
+ Switch from the alternate stack to the original stack.
+
+ Once execution takes place in the alternate stack, there are two ways
+ to return to the original stack.
+
+ The first is simply to return from the entry function passed to the
+ constructor, at which point the switchTo() function in the original
+ stack will return.
+
+ The second is to call switchFrom(). This will cause the switchTo()
+ function to return in the original stack. switchFrom() will not
+ return until switchTo() is called again in the original stack, which
+ is not guaranteed to happen.
+
+ It is an error to call this function from the original stack.
+*/
+void QAlternateStack::switchFrom()
+{
+ // We must be the currently active stack.
+ Q_ASSERT_X(isCurrentStack(), "QAlternateStack::switchFrom",
+ qPrintable(QString("`switchFrom' called from wrong stack. sender(): %1")
+ .arg(qobject_to_string(sender()))));
+
+ int value = sigsetjmp(d->alternateJmp, 1);
+
+ // Two possibilities:
+ //
+ // 1. We just called setjmp and will now jump to main stack.
+ // value == 0
+ if (0 == value) {
+ siglongjmp(d->originalJmp, JMP_SWITCHFROM);
+ }
+ // 2. We just jumped to here from main stack.
+ // value == JMP_SWITCHTO
+ else if (JMP_SWITCHTO == value) {
+ }
+ // Whoops, bad programmer.
+ else Q_ASSERT(0);
+}
+
+/*!
+ Returns true if the stack has started (entry function has been called)
+ and not yet finished (entry function has not returned).
+
+ \sa isCurrentStack()
+*/
+bool QAlternateStack::isActive() const
+{ return d->entryFunction; }
+
+/*!
+ Returns true if the currently used stack is this QAlternateStack.
+
+ \sa isActive()
+*/
+bool QAlternateStack::isCurrentStack() const
+{
+ // Test if a stack-allocated variable resides within the alternate
+ // stack buffer.
+ char dummy = 1;
+ quint32 diff = &dummy - d->stackBegin;
+ return (diff < (quint32)d->stackSize);
+}
+
+/*!
+ Returns all created QAlternateStack objects.
+*/
+QList<QAlternateStack*> QAlternateStack::instances()
+{ return QAlternateStackPrivate::instances; }
+
+/*!
+ Returns true if QAlternateStack is usable on this platform.
+
+ QAlternateStack depends on System-V signal stacks, which is not reliable on
+ some platforms. On these platforms, this function will return false.
+
+ Usage of QAlternateStack when this function returns false will typically
+ result in a fatal error at runtime.
+*/
+bool QAlternateStack::isAvailable()
+{
+#ifdef QT_QWS_GREENPHONE
+ // On the Greenphone, it works if and only if the stackbuf has been set up.
+ return qalternatestack_stackbuf();
+#else
+ return true;
+#endif
+}
+
diff --git a/libqtuitest/qalternatestack_win.cpp b/libqtuitest/qalternatestack_win.cpp
new file mode 100644
index 0000000..e0e600e
--- /dev/null
+++ b/libqtuitest/qalternatestack_win.cpp
@@ -0,0 +1,210 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qalternatestack_p.h"
+
+#include <QCoreApplication>
+#include <QThread>
+
+#include <windows.h>
+
+struct QAlternateStackPrivate
+{
+ // All instances of QAlternateStack.
+ static QList<QAlternateStack*> instances;
+
+ // Callback used to start each fiber.
+ static void CALLBACK startFiber(PVOID);
+
+ static LPVOID mainFiber;
+
+ QAlternateStackEntryPoint entryFunction;
+ QVariant entryData;
+ quint32 size;
+
+ LPVOID fiber;
+};
+QList<QAlternateStack*> QAlternateStackPrivate::instances;
+LPVOID QAlternateStackPrivate::mainFiber = 0;
+
+/*
+ Given a Windows error code, return a C string with the corresponding error text.
+ The returned pointer points to static storage, hence this function is not thread safe.
+*/
+const char* qstrwinerror(DWORD errorcode)
+{
+ static char out[256];
+ DWORD ok = FormatMessageA(
+ FORMAT_MESSAGE_FROM_SYSTEM,
+ 0,
+ errorcode,
+ 0,
+ out,
+ sizeof(out)/sizeof(TCHAR),
+ 0
+ );
+ if (!ok) {
+ QByteArray realError = QByteArray::number((int)errorcode);
+ QByteArray nextError = QByteArray::number((int)GetLastError());
+ QByteArray outString = "(error ";
+ outString += realError;
+ outString += "; additionally, error ";
+ outString += nextError;
+ outString += " while looking up error string)";
+ qstrncpy(out, outString.constData(), sizeof(out));
+ }
+ return out;
+}
+
+void CALLBACK QAlternateStackPrivate::startFiber(PVOID _q)
+{
+ QAlternateStack* q = static_cast<QAlternateStack*>(_q);
+ QAlternateStackPrivate* d = q->d;
+
+ d->entryFunction(q, d->entryData);
+
+ /* Setting entryFunction to 0 tells main fiber we are done */
+ d->entryFunction = 0;
+ d->entryData = QVariant();
+
+ q->switchFrom();
+}
+
+QAlternateStack::QAlternateStack(quint32 size, QObject* parent)
+ : QObject(parent),
+ d(new QAlternateStackPrivate)
+{
+ Q_ASSERT_X(QAlternateStack::isAvailable(), "QAlternateStack",
+ "QAlternateStack is not available on this platform!");
+
+ /*
+ Make sure we belong to the main thread to avoid keeping track of whether each thread has
+ been converted to a fiber.
+ */
+ Q_ASSERT_X(QThread::currentThread() == QCoreApplication::instance()->thread(),
+ "QAlternateStack", "Alternate stacks must be created in the main thread!");
+
+ /*
+ The main thread must be a fiber before we can manage any other fibers.
+ Unfortunately, earlier than Windows Vista, it is not possible to test if a thread is
+ a fiber. So it is possible ConvertThreadToFiber will be called more than once for
+ the main thread.
+ */
+ if (!QAlternateStackPrivate::mainFiber) {
+ QAlternateStackPrivate::mainFiber = ConvertThreadToFiber(0);
+ if (!QAlternateStackPrivate::mainFiber) {
+ qFatal("QAlternateStack: failed to convert thread to fiber: %s",
+ qstrwinerror(GetLastError()));
+ }
+ }
+
+ d->entryFunction = 0;
+ d->size = size;
+ d->fiber = 0;
+
+ QAlternateStackPrivate::instances << this;
+}
+
+QAlternateStack::~QAlternateStack()
+{
+ delete d;
+ d = 0;
+ QAlternateStackPrivate::instances.removeAll(this);
+}
+
+void QAlternateStack::start(QAlternateStackEntryPoint entry, const QVariant& data)
+{
+ Q_ASSERT_X(!isActive(), "QAlternateStack::start",
+ qPrintable(QString("`start' called while already active.")));
+
+ d->fiber = CreateFiber(d->size, QAlternateStackPrivate::startFiber, this);
+ if (!d->fiber) {
+ qFatal("QAlternateStack: failed to create fiber: %s", qstrwinerror(GetLastError()));
+ }
+
+ d->entryFunction = entry;
+ d->entryData = data;
+ SwitchToFiber(d->fiber);
+
+ if (!d->entryFunction) {
+ DeleteFiber(d->fiber);
+ d->fiber = 0;
+ }
+}
+
+void QAlternateStack::switchTo()
+{
+ // We must not be the currently active stack.
+ Q_ASSERT_X(!isCurrentStack(), "QAlternateStack::switchTo",
+ qPrintable(QString("`switchTo' called in currently active stack.")));
+
+ // If not active, nothing to do
+ if (!isActive()) return;
+
+ SwitchToFiber(d->fiber);
+
+ if (!d->entryFunction) {
+ DeleteFiber(d->fiber);
+ d->fiber = 0;
+ }
+}
+
+void QAlternateStack::switchFrom()
+{
+ // We must be the currently active stack.
+ Q_ASSERT_X(isCurrentStack(), "QAlternateStack::switchFrom",
+ qPrintable(QString("`switchFrom' called from wrong stack.")));
+
+ SwitchToFiber(QAlternateStackPrivate::mainFiber);
+}
+
+bool QAlternateStack::isActive() const
+{ return d->fiber; }
+
+bool QAlternateStack::isCurrentStack() const
+{ return GetFiberData() == this; }
+
+QList<QAlternateStack*> QAlternateStack::instances()
+{ return QAlternateStackPrivate::instances; }
+
+bool QAlternateStack::isAvailable()
+{ return true; }
+
diff --git a/libqtuitest/qeventwatcher.cpp b/libqtuitest/qeventwatcher.cpp
new file mode 100644
index 0000000..938c2a4
--- /dev/null
+++ b/libqtuitest/qeventwatcher.cpp
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qeventwatcher_p.h"
+
+#include <QSet>
+#include <QPointer>
+#include <QCoreApplication>
+
+struct QEventWatcherPrivate
+{
+ QSet<QObject*> objects;
+ QList<QEventWatcherFilter*> filters;
+ int count;
+};
+
+QEventWatcher::QEventWatcher(QObject* parent)
+ : QObject(parent),
+ d(new QEventWatcherPrivate)
+{
+ d->count = 0;
+}
+
+QEventWatcher::~QEventWatcher()
+{
+ qDeleteAll(d->filters);
+ delete d;
+ d = 0;
+}
+
+void QEventWatcher::addObject(QObject* obj)
+{
+ d->objects << obj;
+ qApp->installEventFilter(this);
+}
+
+void QEventWatcher::addFilter(QEventWatcherFilter* filter)
+{ d->filters << filter; }
+
+int QEventWatcher::count() const
+{ return d->count; }
+
+QString QEventWatcher::toString() const
+{
+ QString ret;
+ QString sep;
+ for (int i = d->filters.count()-1; i >= 0; --i) {
+ ret += sep + d->filters.at(i)->toString();
+ sep = ", ";
+ }
+ return ret;
+}
+
+bool QEventWatcher::eventFilter(QObject* obj, QEvent* e)
+{
+ if (!d->objects.contains(obj)) return false;
+
+ bool accept = (d->filters.count() ? false : true);
+ for (int i = d->filters.count()-1; i >= 0 && !accept; --i) {
+ accept = d->filters.at(i)->accept(obj,e);
+ }
+
+ if (accept) {
+ ++d->count;
+ emit event(obj, e->type());
+ }
+
+ return false;
+}
+
diff --git a/libqtuitest/qeventwatcher_p.h b/libqtuitest/qeventwatcher_p.h
new file mode 100644
index 0000000..96b941b
--- /dev/null
+++ b/libqtuitest/qeventwatcher_p.h
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QEVENTWATCHER_H
+#define QEVENTWATCHER_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtUiTest API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QObject>
+#include <QEvent>
+
+struct QEventWatcherPrivate;
+class QEventWatcherFilter;
+
+class QEventWatcher : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit QEventWatcher(QObject* parent =0);
+ virtual ~QEventWatcher();
+
+ void addObject(QObject*);
+ void addFilter(QEventWatcherFilter*);
+
+ int count() const;
+
+ QString toString() const;
+
+signals:
+ void event(QObject*,int);
+
+protected:
+ bool eventFilter(QObject *obj, QEvent *event);
+
+private:
+ QEventWatcherPrivate* d;
+};
+
+class QEventWatcherFilter
+{
+public:
+ virtual ~QEventWatcherFilter() {}
+
+protected:
+ virtual bool accept(QObject*,QEvent*) const =0;
+ virtual QString toString() const =0;
+
+ friend class QEventWatcher;
+};
+
+#endif
+
diff --git a/libqtuitest/qinputgenerator.cpp b/libqtuitest/qinputgenerator.cpp
new file mode 100644
index 0000000..aa4b091
--- /dev/null
+++ b/libqtuitest/qinputgenerator.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qinputgenerator_p.h"
+
+#include <QApplication>
+#include <QPoint>
+#include <QWidget>
+
+#define QINPUTGENERATOR_DEBUG() if (1); else qDebug() << "QInputGenerator:"
+
+Qt::KeyboardModifier const QInputGenerator::AllModifiers[] =
+ { Qt::ShiftModifier, Qt::ControlModifier, Qt::AltModifier, Qt::MetaModifier };
+
+/*
+ Given a co-ordinate relative to the application's currently active window,
+ maps it to this input generator's co-ordinate system.
+*/
+QPoint QInputGenerator::mapFromActiveWindow(QPoint const& pos) const
+{
+ QPoint ret(pos);
+
+ QWidget *w = QApplication::activeWindow();
+ if (!w) w = QApplication::activePopupWidget();
+ if (!w) w = QApplication::activeModalWidget();
+
+ if (w) {
+ ret = w->mapToGlobal(pos);
+ }
+
+ return ret;
+}
+
+Qt::Key QInputGenerator::modifierToKey(Qt::KeyboardModifier mod)
+{
+ switch (mod) {
+ case Qt::ShiftModifier:
+ return Qt::Key_Shift;
+ case Qt::ControlModifier:
+ return Qt::Key_Control;
+ case Qt::AltModifier:
+ return Qt::Key_Alt;
+ case Qt::MetaModifier:
+ return Qt::Key_Meta;
+ default:
+ break;
+ }
+ return Qt::Key(0);
+}
+
diff --git a/libqtuitest/qinputgenerator_mac.cpp b/libqtuitest/qinputgenerator_mac.cpp
new file mode 100644
index 0000000..2a169e3
--- /dev/null
+++ b/libqtuitest/qinputgenerator_mac.cpp
@@ -0,0 +1,479 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qinputgenerator_p.h"
+
+#include <QtCore>
+#include <QtGui>
+
+#include <ApplicationServices/ApplicationServices.h>
+#include <Carbon/Carbon.h>
+
+#include "qtuitestnamespace.h"
+
+#define QINPUTGENERATOR_DEBUG() if (1); else qDebug() << "QInputGenerator:"
+
+QMap<int,QPair<int,Qt::KeyboardModifiers> > qt_key_to_mac_keycode_make()
+{
+ QMap<int,QPair<int,Qt::KeyboardModifiers> > m;
+
+ static UInt32 deadKeyState = 0L;
+ const UCKeyboardLayout *keyLayout = 0;
+
+#if defined(Q_OS_MAC32)
+ KeyboardLayoutRef keyLayoutRef = 0;
+ KLGetCurrentKeyboardLayout(&keyLayoutRef);
+ OSStatus err;
+ if (keyLayoutRef != 0) {
+ err = KLGetKeyboardLayoutProperty(keyLayoutRef, kKLuchrData,
+ (reinterpret_cast<const void **>(&keyLayout)));
+ if (err != noErr) {
+ qWarning("Qt::internal::unable to get keyboardlayout %ld %s:%d",
+ long(err), __FILE__, __LINE__);
+ }
+ }
+#else
+ QCFType<TISInputSourceRef> inputSource = TISCopyCurrentKeyboardInputSource();
+ Q_ASSERT(inputSource != 0);
+ CFDataRef data = static_cast<CFDataRef>(TISGetInputSourceProperty(inputSource,
+ kTISPropertyUnicodeKeyLayoutData));
+ keyLayout = data ? reinterpret_cast<const UCKeyboardLayout *>(CFDataGetBytePtr(data)) : 0;
+#endif
+
+ if (keyLayout) {
+ UniChar string[4];
+ UniCharCount actualLength;
+
+ for (UInt32 keyCode = 0; keyCode < 128; ++keyCode) {
+ if (noErr == UCKeyTranslate(keyLayout, keyCode, kUCKeyActionDisplay, 0, LMGetKbdType(),
+ kUCKeyTranslateNoDeadKeysMask, &deadKeyState, 4, &actualLength, string))
+ m.insert(int(string[0]), qMakePair(int(keyCode), Qt::KeyboardModifiers(Qt::NoModifier)));
+ if (noErr == UCKeyTranslate(keyLayout, keyCode, kUCKeyActionDisplay, ((shiftKey >> 8) & 0xff), LMGetKbdType(),
+ kUCKeyTranslateNoDeadKeysMask, &deadKeyState, 4, &actualLength, string))
+ m.insert(int(string[0]), qMakePair(int(keyCode), Qt::KeyboardModifiers(Qt::ShiftModifier)));
+ }
+ }
+#ifdef Q_OS_MAC32
+ else {
+ const void *keyboard_layout;
+ KeyboardLayoutRef keyLayoutRef = 0;
+ KLGetCurrentKeyboardLayout(&keyLayoutRef);
+ err = KLGetKeyboardLayoutProperty(keyLayoutRef, kKLKCHRData,
+ reinterpret_cast<const void **>(&keyboard_layout));
+
+ for (UInt32 keyCode = 0; keyCode < 128; ++keyCode) {
+ int translatedChar = KeyTranslate(keyboard_layout, keyCode, &deadKeyState);
+ if (translatedChar >= Qt::Key_Space && translatedChar <= Qt::Key_AsciiTilde) {
+ m.insert(translatedChar, qMakePair(int(keyCode), Qt::KeyboardModifiers(Qt::NoModifier)));
+ }
+ translatedChar = KeyTranslate(keyboard_layout, keyCode | shiftKey, &deadKeyState);
+ if (translatedChar >= Qt::Key_Space && translatedChar <= Qt::Key_AsciiTilde) {
+ m.insert(translatedChar, qMakePair(int(keyCode), Qt::KeyboardModifiers(Qt::ShiftModifier)));
+ }
+
+ }
+ }
+#endif
+
+ m.insert( Qt::Key_Escape, qMakePair(53, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Tab, qMakePair(48, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Backspace, qMakePair(51, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Return, qMakePair(36, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Enter, qMakePair(76, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Insert, qMakePair(114, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Delete, qMakePair(117, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Print, qMakePair(105, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Space, qMakePair(49, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_PageUp, qMakePair(116, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_PageDown, qMakePair(121, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_End, qMakePair(119, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Home, qMakePair(115, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Left, qMakePair(123, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Up, qMakePair(126, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Right, qMakePair(124, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Down, qMakePair(125, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_CapsLock, qMakePair(57, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_NumLock, qMakePair(71, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_F1, qMakePair(122, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_F2, qMakePair(120, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_F3, qMakePair(99, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_F4, qMakePair(118, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_F5, qMakePair(96, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_F6, qMakePair(97, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_F7, qMakePair(98, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_F8, qMakePair(100, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_F9, qMakePair(101, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_F10, qMakePair(109, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_F11, qMakePair(103, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_F12, qMakePair(111, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_F13, qMakePair(105, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_F14, qMakePair(107, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_F15, qMakePair(113, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Menu, qMakePair(110, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Help, qMakePair(114, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_division, qMakePair(75, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_multiply, qMakePair(67, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Minus, qMakePair(78, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Plus, qMakePair(69, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Period, qMakePair(65, Qt::KeyboardModifiers(Qt::NoModifier)) );
+
+ // Modifiers
+ m.insert( Qt::ShiftModifier, qMakePair(56, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Shift, qMakePair(56, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::ControlModifier, qMakePair(55, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Control, qMakePair(55, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::AltModifier, qMakePair(58, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Alt, qMakePair(58, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::MetaModifier, qMakePair(59, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_Meta, qMakePair(55, Qt::KeyboardModifiers(Qt::NoModifier)) );
+ m.insert( Qt::Key_CapsLock, qMakePair(57, Qt::KeyboardModifiers(Qt::NoModifier)) );
+
+ return m;
+}
+
+QMap<int,uint> qt_button_to_mac_button_down_make()
+{
+ QMap<int,uint> m;
+
+ m.insert( Qt::LeftButton, kCGEventLeftMouseDown );
+ m.insert( Qt::MidButton, kCGEventOtherMouseDown );
+ m.insert( Qt::RightButton, kCGEventRightMouseDown );
+ return m;
+}
+
+QMap<int,uint> qt_button_to_mac_button_up_make()
+{
+ QMap<int,uint> m;
+
+ m.insert( Qt::LeftButton, kCGEventLeftMouseUp );
+ m.insert( Qt::MidButton, kCGEventOtherMouseUp );
+ m.insert( Qt::RightButton, kCGEventRightMouseUp );
+ return m;
+}
+
+QMap<int,uint> qt_button_to_mac_button_drag_make()
+{
+ QMap<int,uint> m;
+
+ m.insert( Qt::LeftButton, kCGEventLeftMouseDragged );
+ m.insert( Qt::MidButton, kCGEventOtherMouseDragged );
+ m.insert( Qt::RightButton, kCGEventRightMouseDragged );
+ return m;
+}
+
+QMap<int,uint> qt_button_to_mac_button_make()
+{
+ QMap<int,uint> m;
+
+ m.insert( Qt::LeftButton, kCGMouseButtonLeft );
+ m.insert( Qt::MidButton, kCGMouseButtonCenter );
+ m.insert( Qt::RightButton, kCGMouseButtonRight );
+ return m;
+}
+
+class QInputGeneratorPrivate
+{
+public:
+ QInputGeneratorPrivate();
+ QInputGenerator* q;
+
+ void keyEvent(Qt::Key, bool);
+ void mouseEvent(QPoint const&, Qt::MouseButtons);
+
+ void ensureModifiers(Qt::KeyboardModifiers);
+ Qt::KeyboardModifiers currentModifiers() const;
+
+ QMap<int,QPair<int,Qt::KeyboardModifiers> > const keyMap;
+ QMap<int,uint> const buttonMap;
+ QMap<int,uint> const buttonDownMap;
+ QMap<int,uint> const buttonUpMap;
+ QMap<int,uint> const buttonDragMap;
+
+ QPoint currentPos;
+ Qt::MouseButtons currentButtons;
+};
+
+QInputGeneratorPrivate::QInputGeneratorPrivate()
+ : keyMap(qt_key_to_mac_keycode_make()),
+ buttonMap(qt_button_to_mac_button_make()),
+ buttonDownMap(qt_button_to_mac_button_down_make()),
+ buttonUpMap(qt_button_to_mac_button_up_make()),
+ buttonDragMap(qt_button_to_mac_button_drag_make()),
+ currentPos(),
+ currentButtons(0)
+{
+ //Following line is workaround for a bug in Tiger...
+ CFRelease(CGEventCreate(NULL));
+}
+
+QInputGenerator::QInputGenerator(QObject* parent)
+ : QObject(parent),
+ d(new QInputGeneratorPrivate)
+{
+ d->q = this;
+ QINPUTGENERATOR_DEBUG() << "constructor";
+}
+
+QInputGenerator::~QInputGenerator()
+{
+ QINPUTGENERATOR_DEBUG() << "destructor";
+
+ /*
+ Restore all keyboard modifiers to off.
+ If we don't do this, the current modifiers stay activated
+ even when this application is closed.
+ Note that there is no guarantee this code actually gets run.
+ */
+ d->ensureModifiers(0);
+ if (d->currentButtons) {
+ d->mouseEvent(d->currentPos, 0);
+ }
+
+ d->q = 0;
+ delete d;
+ d = 0;
+}
+
+/*
+ Returns the Qt keyboard modifiers which are currently pressed.
+*/
+Qt::KeyboardModifiers QInputGeneratorPrivate::currentModifiers() const
+{
+ quint32 modifiers = GetCurrentKeyModifiers();
+
+ int state = 0;
+ state |= (modifiers & shiftKey ? Qt::ShiftModifier : Qt::NoModifier);
+ state |= (modifiers & controlKey ? Qt::ControlModifier : Qt::NoModifier);
+ state |= (modifiers & optionKey ? Qt::AltModifier : Qt::NoModifier);
+ state |= (modifiers & cmdKey ? Qt::MetaModifier : Qt::NoModifier);
+
+ return Qt::KeyboardModifier(state);
+}
+
+void QInputGeneratorPrivate::ensureModifiers(Qt::KeyboardModifiers desiredMod)
+{
+ Qt::KeyboardModifiers currentMod = currentModifiers();
+
+ // For each modifier..
+ for (unsigned i = 0; i < sizeof(q->AllModifiers)/sizeof(Qt::KeyboardModifier); ++i) {
+ Qt::KeyboardModifier thisMod = q->AllModifiers[i];
+ // If the modifier is currently disabled but we want it enabled, or vice-versa...
+ if ((desiredMod & thisMod) && !(currentMod & thisMod)) {
+ QINPUTGENERATOR_DEBUG() << "Enabling modifier" << (void*)thisMod << "by press";
+ // press to enable
+ keyEvent(q->modifierToKey(thisMod), true);
+ } else if (!(desiredMod & thisMod) && (currentMod & thisMod)) {
+ QINPUTGENERATOR_DEBUG() << "Disabling modifier" << (void*)thisMod << "by release";
+ // release to disable
+ keyEvent(q->modifierToKey(thisMod), false);
+ }
+ }
+
+ if (currentMod != desiredMod) {
+ currentMod = desiredMod;
+ for (int i = 0;
+ i < 1000 && QApplication::keyboardModifiers() & Qt::KeypadModifier != desiredMod & Qt::KeypadModifier;
+ i += 50, QtUiTest::wait(50))
+ {}
+
+ if (QApplication::keyboardModifiers() & Qt::KeypadModifier != desiredMod & Qt::KeypadModifier)
+ qWarning() << "QtUitest: couldn't set all modifiers to desired state! "
+ "Current state:" << (void*)(int)QApplication::keyboardModifiers() <<
+ "Desired:" << (void*)(int)desiredMod;
+ }
+
+}
+
+void QInputGeneratorPrivate::keyEvent(Qt::Key key, bool is_press)
+{
+ int sym = 0;
+ Qt::KeyboardModifiers modifiers = Qt::KeyboardModifiers(Qt::NoModifier);
+ do {
+ QMap<int,QPair<int,Qt::KeyboardModifiers> >::const_iterator found = keyMap.find(key);
+ if (found != keyMap.end()) {
+ sym = (*found).first;
+ if (key < Qt::Key_A || key > Qt::Key_Z)
+ modifiers = (*found).second;
+ break;
+ }
+
+ qWarning() << "QInputGenerator: don't know how to translate Qt key"
+ << (void*)key << "into Mac keycode";
+ return;
+
+ } while(0);
+
+ if (modifiers) {
+ ensureModifiers(modifiers);
+ }
+
+ //TODO: CGPostKeyboardEvent is deprecated in Snow Leopard, however the alternative (using CGEventPost)
+ // does not work as reliably (at least on Tiger/PPC). Further investigation required.
+ CGPostKeyboardEvent(0, (CGKeyCode)sym, is_press);
+
+#if 0
+ CGEventRef event = CGEventCreateKeyboardEvent(NULL, (CGKeyCode)sym, is_press);
+ CGEventPost(kCGHIDEventTap, event);
+ CFRelease(event);
+#endif
+
+ QINPUTGENERATOR_DEBUG() << (is_press ? "press" : "release") << sym;
+}
+
+void QInputGenerator::keyPress(Qt::Key key, Qt::KeyboardModifiers mod, bool autoRepeat)
+{
+ Q_UNUSED(autoRepeat);
+ d->ensureModifiers(mod);
+ d->keyEvent(key, true);
+ QtUiTest::wait(1);
+}
+
+void QInputGenerator::keyRelease(Qt::Key key, Qt::KeyboardModifiers mod)
+{
+ d->ensureModifiers(mod);
+ d->keyEvent(key, false);
+ QtUiTest::wait(1);
+}
+
+void QInputGenerator::keyClick(Qt::Key key, Qt::KeyboardModifiers mod)
+{
+ keyPress(key,mod);
+ QtUiTest::wait(20);
+ keyRelease(key,mod);
+}
+
+void QInputGeneratorPrivate::mouseEvent(QPoint const& pos, Qt::MouseButtons state)
+{
+ CGPoint p;
+ p.x = (float)(pos.x());
+ p.y = (float)(pos.y());
+
+ ProcessSerialNumber psn;
+ GetCurrentProcess(&psn);
+
+ //TODO: CGPostMouseEvent is deprecated in Snow Leopard, however the alternative (using CGEventPost)
+ // does not work as reliably (at least on Tiger/PPC). Further investigation required.
+ CGPostMouseEvent(p, true, 3, Qt::LeftButton & state, Qt::RightButton & state, Qt::MidButton & state);
+
+#if 0
+ if (currentPos != pos) {
+ currentPos = pos;
+ QINPUTGENERATOR_DEBUG() << "Mouse is at: " << QCursor::pos();
+
+ CGEventType eventType = kCGEventMouseMoved;
+ CGEventRef eventRef = CGEventCreateMouseEvent(NULL, eventType, p, kCGMouseButtonLeft);
+ //This shouldn't be necessary, but it is...
+ CGEventSetType(eventRef, eventType);
+ CGEventPostToPSN(&psn, eventRef);
+ CFRelease(eventRef);
+
+ for (int i = 0;
+ i < 1000 && QCursor::pos() != pos;
+ i += 50, QtUiTest::wait(50))
+ {}
+
+ QINPUTGENERATOR_DEBUG() << "Mouse is now at: " << QCursor::pos();
+
+ if (QCursor::pos() != pos)
+ qWarning() << "QtUitest: couldn't move cursor to desired point! "
+ "Current position:" << QCursor::pos() <<
+ "Desired:" << pos;
+ }
+
+ typedef QPair<uint,uint> ButtonEvent;
+ QList<ButtonEvent> buttonEvents;
+
+ foreach (int button, buttonMap.keys()) {
+ bool desired = button & state;
+ bool current = button & currentButtons;
+
+ // Do we need to release?
+ if (!desired && current) {
+ buttonEvents << qMakePair(buttonUpMap[button], buttonMap[button]);
+ QINPUTGENERATOR_DEBUG() << "releasing " << buttonMap[button];
+ }
+
+ // Do we need to press?
+ if (desired && !current) {
+ buttonEvents << qMakePair(buttonDownMap[button], buttonMap[button]);
+ QINPUTGENERATOR_DEBUG() << "pressing " << buttonMap[button];
+ }
+
+ // Do we need to drag? Is this necessary?
+ if (desired && current) {
+ buttonEvents << qMakePair(buttonDragMap[button], buttonMap[button]);
+ QINPUTGENERATOR_DEBUG() << "dragging " << buttonMap[button];
+ }
+ }
+
+ foreach (ButtonEvent const& event, buttonEvents) {
+ CGEventType eventType = event.first;
+ QINPUTGENERATOR_DEBUG() << "posting Quartz event " << eventType << ", " << event.second;
+ CGEventRef eventRef = CGEventCreateMouseEvent(NULL, eventType, p, event.second);
+ CGEventSetType(eventRef, eventType);
+ CGEventPostToPSN(&psn, eventRef);
+ CFRelease(eventRef);
+ }
+#endif
+
+ currentButtons = state;
+}
+
+void QInputGenerator::mousePress(QPoint const& pos, Qt::MouseButtons state)
+{
+ QINPUTGENERATOR_DEBUG() << "Mouse press" << pos << (void*)(int)state;
+ d->mouseEvent(pos, d->currentButtons | state);
+}
+
+void QInputGenerator::mouseRelease(QPoint const& pos, Qt::MouseButtons state)
+{
+ QINPUTGENERATOR_DEBUG() << "Mouse release" << pos << (void*)(int)(d->currentButtons & ~state);
+ d->mouseEvent(pos, d->currentButtons & ~state);
+}
+
+void QInputGenerator::mouseClick(QPoint const& pos, Qt::MouseButtons state)
+{
+ mousePress (pos,state);
+ QtUiTest::wait(1);
+ mouseRelease(pos,state);
+ QtUiTest::wait(1);
+}
+
diff --git a/libqtuitest/qinputgenerator_p.h b/libqtuitest/qinputgenerator_p.h
new file mode 100644
index 0000000..c18bde6
--- /dev/null
+++ b/libqtuitest/qinputgenerator_p.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QKEYGENERATOR_P_H
+#define QKEYGENERATOR_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtUiTest API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtGlobal>
+#include <QObject>
+#include <qtuitestglobal.h>
+
+class QPoint;
+class QInputGeneratorPrivate;
+
+class QTUITEST_EXPORT QInputGenerator : public QObject
+{
+Q_OBJECT
+public:
+ explicit QInputGenerator(QObject* =0);
+ virtual ~QInputGenerator();
+
+ void keyPress (Qt::Key, Qt::KeyboardModifiers, bool=false);
+ void keyRelease(Qt::Key, Qt::KeyboardModifiers);
+ void keyClick (Qt::Key, Qt::KeyboardModifiers);
+
+ void mousePress (QPoint const&, Qt::MouseButtons);
+ void mouseRelease(QPoint const&, Qt::MouseButtons);
+ void mouseClick (QPoint const&, Qt::MouseButtons);
+
+ QPoint mapFromActiveWindow(QPoint const&) const;
+
+private:
+ QInputGeneratorPrivate* d;
+ friend class QInputGeneratorPrivate;
+
+ static Qt::Key modifierToKey(Qt::KeyboardModifier);
+ static Qt::KeyboardModifier const AllModifiers[4];
+};
+
+#endif
+
diff --git a/libqtuitest/qinputgenerator_qws.cpp b/libqtuitest/qinputgenerator_qws.cpp
new file mode 100644
index 0000000..657f34e
--- /dev/null
+++ b/libqtuitest/qinputgenerator_qws.cpp
@@ -0,0 +1,333 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qinputgenerator_p.h"
+
+#include <QCopChannel>
+#include <QDebug>
+#include <QKeySequence>
+#include <QScreen>
+#include <QWSServer>
+#include <QWidget>
+
+#include "qtuitestnamespace.h"
+
+#ifdef QTOPIA_TARGET
+# include <qtopialog.h>
+# define QINPUTGENERATOR_DEBUG() qLog(QtUitest)
+#else
+# define QINPUTGENERATOR_DEBUG() if (1); else qDebug() << "QInputGenerator:"
+#endif
+
+#define QINPUTGENERATOR_QCOP "QtUiTest/QInputGenerator"
+#define QINPUTGENERATOR_QCOP_KEYEVENT "keyEvent(int,int,int,bool)"
+#define QINPUTGENERATOR_QCOP_VERSION QDataStream::Qt_4_0
+
+struct QInputGeneratorPrivate
+{
+ QInputGeneratorPrivate();
+ QInputGenerator* q;
+
+ enum KeyEventType { KeyPress, KeyRelease, KeyClick };
+ enum MouseEventType { MousePress, MouseRelease, MouseClick };
+
+ void keyEvent (Qt::Key, Qt::KeyboardModifiers, KeyEventType, bool = false);
+ void mouseEvent(QPoint const&, Qt::MouseButtons, MouseEventType);
+
+ void ensureModifiers(Qt::KeyboardModifiers);
+
+ Qt::KeyboardModifiers currentModifiers;
+};
+
+struct QInputGeneratorService : public QCopChannel
+{
+ QInputGeneratorService(QInputGeneratorPrivate*,QObject* =0);
+
+ virtual void receive(QString const&,QByteArray const&);
+
+ QInputGeneratorPrivate* d;
+};
+
+QInputGeneratorService::QInputGeneratorService(QInputGeneratorPrivate* _d, QObject* parent)
+ : QCopChannel(QINPUTGENERATOR_QCOP, parent),
+ d(_d)
+{
+ Q_ASSERT(qApp->type() == qApp->GuiServer);
+}
+
+void QInputGeneratorService::receive(QString const& message, QByteArray const& data)
+{
+ if (message == QLatin1String(QINPUTGENERATOR_QCOP_KEYEVENT)) {
+ int key = 0;
+ int mod = 0;
+ int type = 0;
+ bool autoRepeat = false;
+
+ QByteArray copy(data);
+ QDataStream ds(&copy, QIODevice::ReadOnly);
+ ds.setVersion(QINPUTGENERATOR_QCOP_VERSION);
+ ds >> key >> mod >> type >> autoRepeat;
+
+ if (ds.status() != QDataStream::Ok) {
+ qWarning() << "QtUitest: error deserializing " QINPUTGENERATOR_QCOP_KEYEVENT
+ " message, a key event might be lost.";
+ } else {
+ Qt::KeyboardModifiers qtMod(mod);
+ d->ensureModifiers(qtMod);
+ d->keyEvent(Qt::Key(key), qtMod, static_cast<QInputGeneratorPrivate::KeyEventType>(type), autoRepeat);
+ }
+ } else {
+ qWarning() << "QtUitest: QInputGenerator received unknown message" << message;
+ }
+}
+
+QInputGeneratorPrivate::QInputGeneratorPrivate()
+ : q(0)
+ , currentModifiers(0)
+{}
+
+QInputGenerator::QInputGenerator(QObject* parent)
+ : QObject(parent),
+ d(new QInputGeneratorPrivate)
+{
+ d->q = this;
+ if (qApp->type() == qApp->GuiServer) {
+ new QInputGeneratorService(d, this);
+ }
+}
+
+QInputGenerator::~QInputGenerator()
+{
+ d->ensureModifiers(0);
+ d->q = 0;
+ delete d;
+ d = 0;
+}
+
+void QInputGeneratorPrivate::keyEvent(Qt::Key key, Qt::KeyboardModifiers mod, KeyEventType type, bool autoRepeat)
+{
+ if (qApp->type() != qApp->GuiServer) {
+ QByteArray data;
+ {
+ QDataStream ds(&data,QIODevice::WriteOnly);
+ ds.setVersion(QINPUTGENERATOR_QCOP_VERSION);
+ ds << int(key) << int(mod) << int(type) << autoRepeat;
+ if (ds.status() != QDataStream::Ok) {
+ qWarning() << "QtUitest: error serializing " QINPUTGENERATOR_QCOP_KEYEVENT
+ " message, a key event might be lost.";
+ }
+ }
+ if (!QCopChannel::send(QINPUTGENERATOR_QCOP, QINPUTGENERATOR_QCOP_KEYEVENT, data)) {
+ qWarning() << "QtUitest: error sending " QINPUTGENERATOR_QCOP_KEYEVENT
+ " message, a key event might be lost.";
+ }
+ return;
+ }
+
+ QINPUTGENERATOR_DEBUG() << "about to simulate key"
+ << ((type==KeyPress) ? "press" : ((type==KeyRelease) ? "release" : "click"))
+ << QKeySequence(key|mod).toString() << "autorepeat" << QString("%1").arg(autoRepeat);
+
+ ushort unicode = 0;
+ if (key <= 0xff) {
+ QChar ch(key);
+ // FIXME this should be less of a hack. The case should not implicitly depend on mod.
+ if (mod & Qt::ShiftModifier) ch = ch.toUpper();
+ else ch = ch.toLower();
+ unicode = ch.unicode();
+ }
+
+ /*
+ The screensaver may consume key events.
+ There is no way to query the server to determine if the next key event will be consumed,
+ or even if the screensaver is currently active. All we can do is force the screensaver
+ (if any) to wake up before every key event to ensure none of them are consumed.
+ */
+ if (!QMetaObject::invokeMethod(QWSServer::instance(), "_q_screenSaverWake"))
+ Q_ASSERT(0);
+
+ QWSServer::processKeyEvent(unicode, key, mod, (type != KeyRelease), autoRepeat);
+
+ if (type == KeyClick) {
+ // Key press/release should not occur in same millisecond
+ QtUiTest::wait(10);
+ QWSServer::processKeyEvent(unicode, key, mod, false, autoRepeat);
+ }
+
+ QINPUTGENERATOR_DEBUG() << "simulated key"
+ << ((type==KeyPress) ? "press" : ((type==KeyRelease) ? "release" : "click"))
+ << QKeySequence(key|mod).toString() << "autorepeat" << QString("%1").arg(autoRepeat);
+}
+
+void QInputGenerator::keyPress(Qt::Key key, Qt::KeyboardModifiers mod, bool autoRepeat)
+{
+ if (qApp->type() == qApp->GuiServer) {
+ d->ensureModifiers(mod);
+ }
+ d->keyEvent(key, mod, d->KeyPress, autoRepeat);
+}
+
+void QInputGenerator::keyRelease(Qt::Key key, Qt::KeyboardModifiers mod)
+{
+ if (qApp->type() == qApp->GuiServer) {
+ d->ensureModifiers(mod);
+ }
+ d->keyEvent(key, mod, d->KeyRelease);
+}
+
+void QInputGenerator::keyClick(Qt::Key key, Qt::KeyboardModifiers mod)
+{
+ if (qApp->type() == qApp->GuiServer) {
+ d->ensureModifiers(mod);
+ }
+ d->keyEvent(key, mod, d->KeyClick);
+}
+
+void QInputGeneratorPrivate::mouseEvent(QPoint const& local, Qt::MouseButtons state, MouseEventType type)
+{
+ QPoint pos(q->mapFromActiveWindow(local));
+
+ QINPUTGENERATOR_DEBUG() << "about to simulate mouse"
+ << ((type==MousePress) ? "press" : ((type==MouseRelease) ? "release" : "click"));
+
+ Q_ASSERT(pos.x() >= 0 && pos.x() < QScreen::instance()->width()
+ && pos.y() >= 0 && pos.y() < QScreen::instance()->height());
+
+ // When a mouse click occurs while an input method is currently active,
+ // and the click goes to a non-qpe window, there's a fair chance it will
+ // cause the current IM to change.
+ // We'd better wait for it, because it can cause widgets to be resized
+ // and hence screw up subsequent clicks.
+ struct InputMethods {
+ static QWidget* widget()
+ {
+ static QWidget* inputMethods = 0;
+ if (!inputMethods) {
+ QWidgetList wl(QApplication::topLevelWidgets());
+ foreach (QWidget *w, wl) {
+ inputMethods = w->findChild<QWidget*>("InputMethods");
+ if (inputMethods) break;
+ }
+ }
+ return inputMethods;
+ }
+
+ static QString current()
+ {
+ QString ret;
+ if (InputMethods::widget()) {
+ QMetaObject::invokeMethod(InputMethods::widget(), "currentShown",
+ Qt::DirectConnection, Q_RETURN_ARG(QString, ret));
+ }
+ return ret;
+
+ }
+ };
+
+ QWSWindow *win = QWSServer::instance()->windowAt(pos);
+ QString client_before_click = (win ? win->client()->identity() : QString());
+ QString im_before_click = InputMethods::current();
+
+ QWSServer::sendMouseEvent(pos, (MouseRelease == type) ? Qt::MouseButtons(0) : state, 0);
+
+ if (type == MouseClick) {
+ // This wait is to avoid the mouse press and release occurring in
+ // the same millisecond, which surely won't happen with real
+ // hardware and wouldn't be unlikely to confuse some apps.
+ QtUiTest::wait(10);
+ QWSServer::sendMouseEvent(pos, 0, 0);
+ }
+
+ if (type == MouseClick && client_before_click != "qpe"
+ && !im_before_click.isEmpty()) {
+ for (int i = 0;
+ i < 500 && InputMethods::current() == im_before_click;
+ i += 50, QtUiTest::wait(50)) {}
+ }
+
+ QINPUTGENERATOR_DEBUG() << "simulated mouse"
+ << ((type==MousePress) ? "press" : ((type==MouseRelease) ? "release" : "click"));
+}
+
+void QInputGenerator::mousePress(QPoint const& pos, Qt::MouseButtons state)
+{ d->mouseEvent(pos, state, d->MousePress); }
+
+void QInputGenerator::mouseRelease(QPoint const& pos, Qt::MouseButtons state)
+{ d->mouseEvent(pos, state, d->MouseRelease); }
+
+void QInputGenerator::mouseClick(QPoint const& pos, Qt::MouseButtons state)
+{ d->mouseEvent(pos, state, d->MouseClick); }
+
+void QInputGeneratorPrivate::ensureModifiers(Qt::KeyboardModifiers desiredMod)
+{
+ if (currentModifiers == desiredMod) return;
+
+ Qt::KeyboardModifiers incrementalMod = currentModifiers;
+ // For each modifier..
+ for (unsigned i = 0; i < sizeof(q->AllModifiers)/sizeof(Qt::KeyboardModifier); ++i) {
+ Qt::KeyboardModifier thisMod = q->AllModifiers[i];
+ // If the modifier is currently disabled but we want it enabled, or vice-versa...
+ if ((desiredMod & thisMod) && !(currentModifiers & thisMod)) {
+ QINPUTGENERATOR_DEBUG() << "Enabling modifier" << (void*)thisMod << "by press";
+ incrementalMod |= thisMod;
+ keyEvent(q->modifierToKey(thisMod), incrementalMod, KeyPress, false);
+ } else if (!(desiredMod & thisMod) && (currentModifiers & thisMod)) {
+ QINPUTGENERATOR_DEBUG() << "Disabling modifier" << (void*)thisMod << "by release";
+ incrementalMod &= ~thisMod;
+ keyEvent(q->modifierToKey(thisMod), incrementalMod, KeyRelease, false);
+ }
+ }
+
+ /*
+ On QWS, we cannot check if QApplication::keyboardModifiers() changes to the desired
+ state. That function returns whatever modifiers were set on the last spontaneous
+ input event, and the modifiers set on input events are the modifiers _before_ the
+ event occurred (e.g. the Shift key press event does not have the Shift modifier set,
+ but the next key event does).
+
+ So QApplication::keyboardModifiers() is off-by-one and thus can't be checked until
+ the next event occurs - we're just assuming success.
+ */
+ currentModifiers = desiredMod;
+
+}
+
+
diff --git a/libqtuitest/qinputgenerator_symbian.cpp b/libqtuitest/qinputgenerator_symbian.cpp
new file mode 100644
index 0000000..2adce33
--- /dev/null
+++ b/libqtuitest/qinputgenerator_symbian.cpp
@@ -0,0 +1,425 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qinputgenerator_p.h"
+
+#include <QtCore>
+#include <QtGui>
+
+#include <w32std.h>
+#include <e32event.h>
+#include <e32std.h>
+
+#include <coemain.h>
+
+#include "qtuitestnamespace.h"
+
+#define QINPUTGENERATOR_DEBUG() if (1); else qDebug() << "QInputGenerator:"
+
+QMap<int,int> qt_key_to_symbian_keycode_make()
+{
+ QMap<int,int> m;
+
+ m.insert( Qt::Key_Backspace, EKeyBackspace );
+ m.insert( Qt::Key_Tab, EKeyTab );
+ m.insert( Qt::Key_Enter, EKeyEnter );
+ m.insert( Qt::Key_Escape, EKeyEscape );
+ m.insert( Qt::Key_Space, EKeySpace );
+ m.insert( Qt::Key_Delete, EKeyDelete );
+ m.insert( Qt::Key_SysReq, EKeyPrintScreen );
+ m.insert( Qt::Key_Pause, EKeyPause );
+ m.insert( Qt::Key_Home, EKeyHome );
+ m.insert( Qt::Key_End, EKeyEnd );
+ m.insert( Qt::Key_PageUp, EKeyPageUp );
+ m.insert( Qt::Key_PageDown, EKeyPageDown );
+ m.insert( Qt::Key_Insert, EKeyInsert );
+ m.insert( Qt::Key_Left, EKeyLeftArrow );
+ m.insert( Qt::Key_Right, EKeyRightArrow );
+ m.insert( Qt::Key_Up, EKeyUpArrow );
+ m.insert( Qt::Key_Down, EKeyDownArrow );
+
+ m.insert( Qt::Key_Shift, EKeyLeftShift );
+ m.insert( Qt::Key_Control, EKeyLeftCtrl );
+ m.insert( Qt::Key_Alt, EKeyLeftAlt );
+ m.insert( Qt::Key_AltGr, EKeyRightAlt );
+ m.insert( Qt::Key_Super_L, EKeyLeftFunc );
+ m.insert( Qt::Key_Super_R, EKeyRightFunc );
+ m.insert( Qt::Key_CapsLock, EKeyCapsLock );
+ m.insert( Qt::Key_NumLock, EKeyNumLock );
+ m.insert( Qt::Key_ScrollLock, EKeyScrollLock );
+
+ m.insert( Qt::Key_F1, EKeyF1 );
+ m.insert( Qt::Key_F2, EKeyF2 );
+ m.insert( Qt::Key_F3, EKeyF3 );
+ m.insert( Qt::Key_F4, EKeyF4 );
+ m.insert( Qt::Key_F5, EKeyF5 );
+ m.insert( Qt::Key_F6, EKeyF6 );
+ m.insert( Qt::Key_F7, EKeyF7 );
+ m.insert( Qt::Key_F8, EKeyF8 );
+ m.insert( Qt::Key_F9, EKeyF9 );
+ m.insert( Qt::Key_F10, EKeyF10 );
+ m.insert( Qt::Key_F11, EKeyF11 );
+ m.insert( Qt::Key_F12, EKeyF12 );
+ m.insert( Qt::Key_F13, EKeyF13 );
+ m.insert( Qt::Key_F14, EKeyF14 );
+ m.insert( Qt::Key_F15, EKeyF15 );
+ m.insert( Qt::Key_F16, EKeyF16 );
+ m.insert( Qt::Key_F17, EKeyF17 );
+ m.insert( Qt::Key_F18, EKeyF18 );
+ m.insert( Qt::Key_F19, EKeyF19 );
+ m.insert( Qt::Key_F20, EKeyF20 );
+ m.insert( Qt::Key_F21, EKeyF21 );
+ m.insert( Qt::Key_F22, EKeyF22 );
+ m.insert( Qt::Key_F23, EKeyF23 );
+ m.insert( Qt::Key_F24, EKeyF24 );
+
+ m.insert( Qt::Key_Menu, EKeyMenu );
+ m.insert( Qt::Key_Help, EKeyHelp );
+ m.insert( Qt::Key_Call, EKeyDial );
+
+ m.insert( Qt::Key_Context1, EKeyDevice0 );
+ m.insert( Qt::Key_Context2, EKeyDevice1 );
+ m.insert( Qt::Key_Select, EKeyDevice3 );
+
+ m.insert( Qt::Key_Launch0, EKeyApplication0 );
+ m.insert( Qt::Key_Launch1, EKeyApplication1 );
+ m.insert( Qt::Key_Launch2, EKeyApplication2 );
+ m.insert( Qt::Key_Launch3, EKeyApplication3 );
+ m.insert( Qt::Key_Launch4, EKeyApplication4 );
+ m.insert( Qt::Key_Launch5, EKeyApplication5 );
+ m.insert( Qt::Key_Launch6, EKeyApplication6 );
+ m.insert( Qt::Key_Launch7, EKeyApplication7 );
+ m.insert( Qt::Key_Launch8, EKeyApplication8 );
+ m.insert( Qt::Key_Launch9, EKeyApplication9 );
+ m.insert( Qt::Key_LaunchA, EKeyApplicationA );
+ m.insert( Qt::Key_LaunchB, EKeyApplicationB );
+ m.insert( Qt::Key_LaunchC, EKeyApplicationC );
+ m.insert( Qt::Key_LaunchD, EKeyApplicationD );
+ m.insert( Qt::Key_LaunchE, EKeyApplicationE );
+ m.insert( Qt::Key_LaunchF, EKeyApplicationF );
+
+ m.insert( Qt::Key_Yes, EKeyYes );
+ m.insert( Qt::Key_No, EKeyNo );
+
+ m.insert( Qt::Key_Call, EKeyYes );
+ m.insert( Qt::Key_Hangup, EKeyNo );
+
+ return m;
+}
+
+QMap<int,uint> qt_modifier_to_symbian_modifier_make()
+{
+ QMap<int,uint> m;
+ m.insert( Qt::ShiftModifier, EModifierShift );
+ m.insert( Qt::ControlModifier, EModifierCtrl );
+ m.insert( Qt::AltModifier, EModifierAlt );
+ return m;
+}
+
+QMap<int,uint> qt_button_to_symbian_button_down_make()
+{
+ QMap<int,uint> m;
+
+ m.insert( Qt::LeftButton, TRawEvent::EButton1Down );
+ m.insert( Qt::MidButton, TRawEvent::EButton2Down );
+ m.insert( Qt::RightButton, TRawEvent::EButton3Down );
+ return m;
+}
+
+QMap<int,uint> qt_button_to_symbian_button_up_make()
+{
+ QMap<int,uint> m;
+
+ m.insert( Qt::LeftButton, TRawEvent::EButton1Up );
+ m.insert( Qt::MidButton, TRawEvent::EButton2Up );
+ m.insert( Qt::RightButton, TRawEvent::EButton3Up );
+ return m;
+}
+
+class QInputGeneratorPrivate
+{
+public:
+ QInputGeneratorPrivate();
+ QInputGenerator* q;
+
+ void keyEvent(Qt::Key, bool);
+ void mouseEvent(QPoint const&, Qt::MouseButtons);
+
+ void ensureModifiers(Qt::KeyboardModifiers);
+ Qt::KeyboardModifiers currentModifiers() const;
+
+ QMap<int,int> const keyMap;
+ QMap<int,uint> const buttonDownMap;
+ QMap<int,uint> const buttonUpMap;
+ QMap<int,uint> const buttonDragMap;
+
+ QPoint currentPos;
+ Qt::MouseButtons currentButtons;
+};
+
+QInputGeneratorPrivate::QInputGeneratorPrivate()
+ : keyMap(qt_key_to_symbian_keycode_make()),
+ buttonDownMap(qt_button_to_symbian_button_down_make()),
+ buttonUpMap(qt_button_to_symbian_button_up_make()),
+ currentPos(),
+ currentButtons(0)
+{
+}
+
+QInputGenerator::QInputGenerator(QObject* parent)
+ : QObject(parent),
+ d(new QInputGeneratorPrivate)
+{
+ d->q = this;
+ QINPUTGENERATOR_DEBUG() << "constructor";
+}
+
+QInputGenerator::~QInputGenerator()
+{
+ QINPUTGENERATOR_DEBUG() << "destructor";
+
+ /*
+ Restore all keyboard modifiers to off.
+ If we don't do this, the current modifiers stay activated
+ even when this application is closed.
+ Note that there is no guarantee this code actually gets run.
+ */
+ d->ensureModifiers(0);
+ if (d->currentButtons) {
+ d->mouseEvent(d->currentPos, 0);
+ }
+
+ d->q = 0;
+ delete d;
+ d = 0;
+}
+
+/*
+ Returns the Qt keyboard modifiers which are currently pressed.
+*/
+Qt::KeyboardModifiers QInputGeneratorPrivate::currentModifiers() const
+{
+ quint32 modifiers = 0;//GetCurrentKeyModifiers();
+
+ int state = 0;
+/*
+ state |= (modifiers & shiftKey ? Qt::ShiftModifier : Qt::NoModifier);
+ state |= (modifiers & controlKey ? Qt::ControlModifier : Qt::NoModifier);
+ state |= (modifiers & optionKey ? Qt::AltModifier : Qt::NoModifier);
+ state |= (modifiers & cmdKey ? Qt::MetaModifier : Qt::NoModifier);
+*/
+ return Qt::KeyboardModifier(state);
+}
+
+void QInputGeneratorPrivate::ensureModifiers(Qt::KeyboardModifiers desiredMod)
+{
+ Qt::KeyboardModifiers currentMod = currentModifiers();
+
+ // For each modifier..
+ for (unsigned i = 0; i < sizeof(q->AllModifiers)/sizeof(Qt::KeyboardModifier); ++i) {
+ Qt::KeyboardModifier thisMod = q->AllModifiers[i];
+ // If the modifier is currently disabled but we want it enabled, or vice-versa...
+ if ((desiredMod & thisMod) && !(currentMod & thisMod)) {
+ QINPUTGENERATOR_DEBUG() << "Enabling modifier" << (void*)thisMod << "by press";
+ // press to enable
+ keyEvent(q->modifierToKey(thisMod), true);
+ } else if (!(desiredMod & thisMod) && (currentMod & thisMod)) {
+ QINPUTGENERATOR_DEBUG() << "Disabling modifier" << (void*)thisMod << "by release";
+ // release to disable
+ keyEvent(q->modifierToKey(thisMod), false);
+ }
+ }
+
+ if (currentMod != desiredMod) {
+ currentMod = desiredMod;
+ for (int i = 0;
+ i < 1000 && QApplication::keyboardModifiers() != desiredMod;
+ i += 50, QtUiTest::wait(50))
+ {}
+
+ if (QApplication::keyboardModifiers() != desiredMod)
+ qWarning() << "QtUitest: couldn't set all modifiers to desired state! "
+ "Current state:" << (void*)(int)QApplication::keyboardModifiers() <<
+ "Desired:" << (void*)(int)desiredMod;
+ }
+}
+
+void QInputGeneratorPrivate::keyEvent(Qt::Key key, bool is_press)
+{
+ int sym = 0;
+
+ do {
+ if (key >= Qt::Key_Space && key <= Qt::Key_AsciiTilde) {
+ sym = QChar(key).toUpper().toAscii();
+ break;
+ }
+
+ QMap<int,int>::const_iterator found = keyMap.find(key);
+ if (found != keyMap.end()) {
+ sym = *found;
+ break;
+ }
+
+ qWarning() << "QInputGenerator: don't know how to translate Qt key"
+ << (void*)key << "into Symbian keycode";
+ return;
+
+ } while(0);
+
+ RWsSession wsSession=CCoeEnv::Static()->WsSession();
+ TRawEvent keyEvent;
+ keyEvent.Set(is_press ? TRawEvent::EKeyDown : TRawEvent::EKeyUp, sym);
+ wsSession.SimulateRawEvent(keyEvent);
+ wsSession.Flush();
+
+ QINPUTGENERATOR_DEBUG() << (is_press ? "press" : "release") << sym;
+}
+
+void QInputGenerator::keyPress(Qt::Key key, Qt::KeyboardModifiers mod, bool autoRepeat)
+{
+ Q_UNUSED(autoRepeat);
+ d->ensureModifiers(mod);
+ d->keyEvent(key, true);
+ QtUiTest::wait(1);
+}
+
+void QInputGenerator::keyRelease(Qt::Key key, Qt::KeyboardModifiers mod)
+{
+ d->ensureModifiers(mod);
+ d->keyEvent(key, false);
+ QtUiTest::wait(1);
+}
+
+void QInputGenerator::keyClick(Qt::Key key, Qt::KeyboardModifiers mod)
+{
+ // Using RWsSession::SimulateKeyEvent seems to work more reliably than using
+ // TRawEvent but it only simulates keyclicks (press and release)
+
+ int sym = 0;
+
+ do {
+ if (key >= Qt::Key_Space && key <= Qt::Key_AsciiTilde) {
+ sym = QChar(key).toUpper().toAscii();
+ if (mod == Qt::NoModifier) {
+ sym = sym = QChar(key).toLower().toAscii();
+ }
+ break;
+ }
+
+ QMap<int,int>::const_iterator found = d->keyMap.find(key);
+ if (found != d->keyMap.end()) {
+ sym = *found;
+ break;
+ }
+
+ qWarning() << "QInputGenerator: don't know how to translate Qt key"
+ << (void*)key << "into Symbian keycode";
+ return;
+
+ } while(0);
+
+ RWsSession wsSession=CCoeEnv::Static()->WsSession();
+
+ TKeyEvent keyEvent;
+ keyEvent.iCode = sym;
+ keyEvent.iScanCode = 0; // don't think Qt requires this
+ keyEvent.iModifiers = 0; // should set this
+ keyEvent.iRepeats = 0;
+ wsSession.SimulateKeyEvent(keyEvent);
+ wsSession.Flush();
+ QtUiTest::wait(10);
+}
+
+void QInputGeneratorPrivate::mouseEvent(QPoint const& pos, Qt::MouseButtons state)
+{
+ typedef QPair<uint,uint> ButtonEvent;
+ QList<ButtonEvent> buttonEvents;
+
+ RWsSession wsSession=CCoeEnv::Static()->WsSession();
+
+ // FIXME: This doesn't handle screen orientation yet
+ int x = pos.x();
+ int y = pos.y();
+
+ foreach (int button, buttonDownMap.keys()) {
+ bool desired = button & state;
+ bool current = button & currentButtons;
+
+ // Do we need to release?
+ if (!desired && current) {
+ TRawEvent event;
+ event.Set(TRawEvent::EButton1Up, x, y);
+ wsSession.SimulateRawEvent(event);
+ wsSession.Flush();
+ }
+
+ // Do we need to press?
+ if (desired && !current) {
+ TRawEvent event;
+ event.Set(TRawEvent::EButton1Down, x, y);
+ wsSession.SimulateRawEvent(event);
+ wsSession.Flush();
+ }
+ }
+
+ currentButtons = state;
+}
+
+void QInputGenerator::mousePress(QPoint const& pos, Qt::MouseButtons state)
+{
+ QINPUTGENERATOR_DEBUG() << "Mouse press" << pos << (void*)(int)state;
+ d->mouseEvent(pos, d->currentButtons | state);
+ qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
+}
+
+void QInputGenerator::mouseRelease(QPoint const& pos, Qt::MouseButtons state)
+{
+ QINPUTGENERATOR_DEBUG() << "Mouse release" << pos << (void*)(int)(d->currentButtons & ~state);
+ d->mouseEvent(pos, d->currentButtons & ~state);
+ qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
+}
+
+void QInputGenerator::mouseClick(QPoint const& pos, Qt::MouseButtons state)
+{
+ mousePress (pos,state);
+ QtUiTest::wait(20);
+ mouseRelease(pos,state);
+}
diff --git a/libqtuitest/qinputgenerator_win.cpp b/libqtuitest/qinputgenerator_win.cpp
new file mode 100644
index 0000000..991755b
--- /dev/null
+++ b/libqtuitest/qinputgenerator_win.cpp
@@ -0,0 +1,496 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qinputgenerator_p.h"
+
+#include <QtCore>
+#include <QtGui>
+
+#include <qt_windows.h>
+#include <windows.h>
+#ifdef __GNUC__
+ #include <winable.h>
+#endif
+
+#include "qtuitestnamespace.h"
+
+#define QINPUTGENERATOR_DEBUG() if (1); else qDebug() << "QInputGenerator:"
+
+enum WindowsNativeModifiers {
+ ShiftLeft = 0x00000001,
+ ControlLeft = 0x00000002,
+ AltLeft = 0x00000004,
+ MetaLeft = 0x00000008,
+ ShiftRight = 0x00000010,
+ ControlRight = 0x00000020,
+ AltRight = 0x00000040,
+ MetaRight = 0x00000080,
+ CapsLock = 0x00000100,
+ NumLock = 0x00000200,
+ ScrollLock = 0x00000400,
+ ExtendedKey = 0x01000000,
+
+ // Convenience mappings
+ ShiftAny = 0x00000011,
+ ControlAny = 0x00000022,
+ AltAny = 0x00000044,
+ MetaAny = 0x00000088,
+ LockAny = 0x00000700
+};
+
+QMap<int,int> qt_key_to_win_vk_make()
+{
+ QMap<int,int> m;
+
+ m.insert( Qt::Key_Escape, VK_ESCAPE );
+ m.insert( Qt::Key_Tab, VK_TAB );
+ m.insert( Qt::Key_Backspace, VK_BACK );
+ m.insert( Qt::Key_Return, VK_RETURN );
+ m.insert( Qt::Key_Enter, VK_RETURN );
+ m.insert( Qt::Key_Insert, VK_INSERT );
+ m.insert( Qt::Key_Delete, VK_DELETE );
+ m.insert( Qt::Key_Pause, VK_PAUSE );
+ m.insert( Qt::Key_Print, VK_SNAPSHOT );
+ m.insert( Qt::Key_Mode_switch, VK_MODECHANGE );
+ m.insert( Qt::Key_PageUp, VK_PRIOR );
+ m.insert( Qt::Key_PageDown, VK_NEXT );
+ m.insert( Qt::Key_End, VK_END );
+ m.insert( Qt::Key_Home, VK_HOME );
+ m.insert( Qt::Key_Sleep, VK_SLEEP );
+ m.insert( Qt::Key_Left, VK_LEFT );
+ m.insert( Qt::Key_Up, VK_UP );
+ m.insert( Qt::Key_Right, VK_RIGHT );
+ m.insert( Qt::Key_Down, VK_DOWN );
+ m.insert( Qt::Key_Select, VK_SELECT );
+ m.insert( Qt::Key_Printer, VK_PRINT );
+ m.insert( Qt::Key_Execute, VK_EXECUTE );
+ m.insert( Qt::Key_CapsLock, VK_CAPITAL );
+ m.insert( Qt::Key_NumLock, VK_NUMLOCK );
+ m.insert( Qt::Key_ScrollLock, VK_SCROLL );
+ m.insert( Qt::Key_F1, VK_F1 );
+ m.insert( Qt::Key_F2, VK_F2 );
+ m.insert( Qt::Key_F3, VK_F3 );
+ m.insert( Qt::Key_F4, VK_F4 );
+ m.insert( Qt::Key_F5, VK_F5 );
+ m.insert( Qt::Key_F6, VK_F6 );
+ m.insert( Qt::Key_F7, VK_F7 );
+ m.insert( Qt::Key_F8, VK_F8 );
+ m.insert( Qt::Key_F9, VK_F9 );
+ m.insert( Qt::Key_F10, VK_F10 );
+ m.insert( Qt::Key_F11, VK_F11 );
+ m.insert( Qt::Key_F12, VK_F12 );
+ m.insert( Qt::Key_F13, VK_F13 );
+ m.insert( Qt::Key_F14, VK_F14 );
+ m.insert( Qt::Key_F15, VK_F15 );
+ m.insert( Qt::Key_F16, VK_F16 );
+ m.insert( Qt::Key_F17, VK_F17 );
+ m.insert( Qt::Key_F18, VK_F18 );
+ m.insert( Qt::Key_F19, VK_F19 );
+ m.insert( Qt::Key_F20, VK_F20 );
+ m.insert( Qt::Key_F21, VK_F21 );
+ m.insert( Qt::Key_F22, VK_F22 );
+ m.insert( Qt::Key_F23, VK_F23 );
+ m.insert( Qt::Key_F24, VK_F24 );
+ m.insert( Qt::Key_Menu, VK_APPS );
+ m.insert( Qt::Key_Help, VK_HELP );
+ m.insert( Qt::Key_Cancel, VK_CANCEL );
+ m.insert( Qt::Key_Clear, VK_CLEAR );
+ m.insert( Qt::Key_Play, VK_PLAY );
+ m.insert( Qt::Key_Zoom, VK_ZOOM );
+
+#if (_WIN32_WINNT >= 0x0500)
+#if !defined(VK_OEM_BACKTAB)
+# define VK_OEM_BACKTAB 0xF5
+#endif
+ m.insert( Qt::Key_Backtab, VK_OEM_BACKTAB );
+ m.insert( Qt::Key_Back, VK_BROWSER_BACK );
+ m.insert( Qt::Key_Forward, VK_BROWSER_FORWARD );
+ m.insert( Qt::Key_Refresh, VK_BROWSER_REFRESH );
+ m.insert( Qt::Key_Stop, VK_BROWSER_STOP );
+ m.insert( Qt::Key_Search, VK_BROWSER_SEARCH );
+ m.insert( Qt::Key_Favorites, VK_BROWSER_FAVORITES );
+ m.insert( Qt::Key_HomePage, VK_BROWSER_HOME );
+ m.insert( Qt::Key_VolumeMute, VK_VOLUME_MUTE );
+ m.insert( Qt::Key_VolumeDown, VK_VOLUME_DOWN );
+ m.insert( Qt::Key_VolumeUp, VK_VOLUME_UP );
+ m.insert( Qt::Key_MediaNext, VK_MEDIA_NEXT_TRACK );
+ m.insert( Qt::Key_MediaPrevious, VK_MEDIA_PREV_TRACK );
+ m.insert( Qt::Key_MediaStop, VK_MEDIA_STOP );
+ m.insert( Qt::Key_MediaPlay, VK_MEDIA_PLAY_PAUSE );
+ m.insert( Qt::Key_LaunchMail, VK_LAUNCH_MAIL );
+ m.insert( Qt::Key_LaunchMedia, VK_LAUNCH_MEDIA_SELECT );
+ m.insert( Qt::Key_Launch0, VK_LAUNCH_APP1 );
+ m.insert( Qt::Key_Launch1, VK_LAUNCH_APP2 );
+#endif
+
+
+ // Modifiers
+ m.insert( Qt::ShiftModifier, VK_SHIFT );
+ m.insert( Qt::Key_Shift, VK_SHIFT );
+ m.insert( Qt::ControlModifier, VK_CONTROL );
+ m.insert( Qt::Key_Control, VK_CONTROL );
+ m.insert( Qt::AltModifier, VK_MENU );
+ m.insert( Qt::Key_Alt, VK_MENU );
+ m.insert( Qt::MetaModifier, VK_LWIN );
+ m.insert( Qt::Key_Meta, VK_LWIN );
+
+ return m;
+}
+
+QMap<int,uint> qt_button_to_win_button_down_make()
+{
+ QMap<int,uint> m;
+
+ m.insert( Qt::LeftButton, MOUSEEVENTF_LEFTDOWN );
+ m.insert( Qt::MidButton, MOUSEEVENTF_MIDDLEDOWN );
+ m.insert( Qt::RightButton, MOUSEEVENTF_RIGHTDOWN );
+
+#if (_WIN32_WINNT >= 0x0500)
+ m.insert( Qt::XButton1, MOUSEEVENTF_XDOWN );
+ m.insert( Qt::XButton2, MOUSEEVENTF_XDOWN );
+#endif
+
+ return m;
+}
+
+QMap<int,uint> qt_button_to_win_button_up_make()
+{
+ QMap<int,uint> m;
+
+ m.insert( Qt::LeftButton, MOUSEEVENTF_LEFTUP );
+ m.insert( Qt::MidButton, MOUSEEVENTF_MIDDLEUP );
+ m.insert( Qt::RightButton, MOUSEEVENTF_RIGHTUP );
+
+#if (_WIN32_WINNT >= 0x0500)
+ m.insert( Qt::XButton1, MOUSEEVENTF_XUP );
+ m.insert( Qt::XButton2, MOUSEEVENTF_XUP );
+#endif
+
+ return m;
+}
+
+QMap<int,uint> qt_button_to_win_mousedata_make()
+{
+ QMap<int,uint> m;
+
+#if (_WIN32_WINNT >= 0x0500)
+ m.insert( Qt::XButton1, XBUTTON1 );
+ m.insert( Qt::XButton2, XBUTTON2 );
+#endif
+
+ return m;
+}
+
+class QInputGeneratorPrivate
+{
+public:
+ QInputGeneratorPrivate();
+ QInputGenerator* q;
+
+ void keyEvent(Qt::Key, bool);
+ void mouseEvent(QPoint const&, Qt::MouseButtons);
+
+ void ensureModifiers(Qt::KeyboardModifiers);
+ Qt::KeyboardModifiers currentModifiers() const;
+
+ QMap<int,int> const keyMap;
+ QMap<int,uint> const buttonDownMap;
+ QMap<int,uint> const buttonUpMap;
+ QMap<int,uint> const buttonMouseDataMap;
+
+ QPoint currentPos;
+ Qt::MouseButtons currentButtons;
+};
+
+QInputGeneratorPrivate::QInputGeneratorPrivate()
+ : keyMap(qt_key_to_win_vk_make()),
+ buttonDownMap(qt_button_to_win_button_down_make()),
+ buttonUpMap(qt_button_to_win_button_up_make()),
+ buttonMouseDataMap(qt_button_to_win_mousedata_make()),
+ currentPos(),
+ currentButtons(0)
+{}
+
+QInputGenerator::QInputGenerator(QObject* parent)
+ : QObject(parent),
+ d(new QInputGeneratorPrivate)
+{
+ d->q = this;
+ QINPUTGENERATOR_DEBUG() << "constructor";
+}
+
+QInputGenerator::~QInputGenerator()
+{
+ QINPUTGENERATOR_DEBUG() << "destructor";
+
+ /*
+ Restore all keyboard modifiers to off.
+ Note that there is no guarantee this code actually gets run.
+ */
+ d->ensureModifiers(0);
+ if (d->currentButtons) {
+ d->mouseEvent(d->currentPos, 0);
+ }
+
+ d->q = 0;
+ delete d;
+ d = 0;
+}
+
+/*
+ Returns the Qt keyboard modifiers which are currently pressed.
+*/
+Qt::KeyboardModifiers QInputGeneratorPrivate::currentModifiers() const
+{
+ quint32 nModifiers = 0;
+
+ if (QSysInfo::WindowsVersion < QSysInfo::WV_NT || QSysInfo::WindowsVersion & QSysInfo::WV_CE_based) {
+ nModifiers |= (GetKeyState(VK_SHIFT ) < 0 ? ShiftAny : 0);
+ nModifiers |= (GetKeyState(VK_CONTROL) < 0 ? ControlAny : 0);
+ nModifiers |= (GetKeyState(VK_MENU ) < 0 ? AltAny : 0);
+ nModifiers |= (GetKeyState(VK_LWIN ) < 0 ? MetaLeft : 0);
+ nModifiers |= (GetKeyState(VK_RWIN ) < 0 ? MetaRight : 0);
+ } else {
+ // Map native modifiers to some bit representation
+ nModifiers |= (GetKeyState(VK_LSHIFT ) & 0x80 ? ShiftLeft : 0);
+ nModifiers |= (GetKeyState(VK_RSHIFT ) & 0x80 ? ShiftRight : 0);
+ nModifiers |= (GetKeyState(VK_LCONTROL) & 0x80 ? ControlLeft : 0);
+ nModifiers |= (GetKeyState(VK_RCONTROL) & 0x80 ? ControlRight : 0);
+ nModifiers |= (GetKeyState(VK_LMENU ) & 0x80 ? AltLeft : 0);
+ nModifiers |= (GetKeyState(VK_RMENU ) & 0x80 ? AltRight : 0);
+ nModifiers |= (GetKeyState(VK_LWIN ) & 0x80 ? MetaLeft : 0);
+ nModifiers |= (GetKeyState(VK_RWIN ) & 0x80 ? MetaRight : 0);
+ // Add Lock keys to the same bits
+ nModifiers |= (GetKeyState(VK_CAPITAL ) & 0x01 ? CapsLock : 0);
+ nModifiers |= (GetKeyState(VK_NUMLOCK ) & 0x01 ? NumLock : 0);
+ nModifiers |= (GetKeyState(VK_SCROLL ) & 0x01 ? ScrollLock : 0);
+ }
+
+ int state = 0;
+ state |= (nModifiers & ShiftAny ? Qt::ShiftModifier : 0);
+ state |= (nModifiers & ControlAny ? Qt::ControlModifier : 0);
+ state |= (nModifiers & AltAny ? Qt::AltModifier : 0);
+ state |= (nModifiers & MetaAny ? Qt::MetaModifier : 0);
+
+ return Qt::KeyboardModifier(state);
+}
+
+void QInputGeneratorPrivate::ensureModifiers(Qt::KeyboardModifiers desiredMod)
+{
+ Qt::KeyboardModifiers currentMod = currentModifiers();
+
+ // For each modifier..
+ for (unsigned i = 0; i < sizeof(q->AllModifiers)/sizeof(Qt::KeyboardModifier); ++i) {
+ Qt::KeyboardModifier thisMod = q->AllModifiers[i];
+ // If the modifier is currently disabled but we want it enabled, or vice-versa...
+ if ((desiredMod & thisMod) && !(currentMod & thisMod)) {
+ QINPUTGENERATOR_DEBUG() << "Enabling modifier" << (void*)thisMod << "by press";
+ // press to enable
+ keyEvent(q->modifierToKey(thisMod), true);
+ } else if (!(desiredMod & thisMod) && (currentMod & thisMod)) {
+ QINPUTGENERATOR_DEBUG() << "Disabling modifier" << (void*)thisMod << "by release";
+ // release to disable
+ keyEvent(q->modifierToKey(thisMod), false);
+ }
+ }
+
+ if (currentMod != desiredMod) {
+ currentMod = desiredMod;
+ for (int i = 0;
+ i < 1000 && QApplication::keyboardModifiers() != desiredMod;
+ i += 50, QtUiTest::wait(50))
+ {}
+
+ if (QApplication::keyboardModifiers() != desiredMod)
+ qWarning() << "QtUitest: couldn't set all modifiers to desired state! "
+ "Current state:" << (void*)(int)QApplication::keyboardModifiers() <<
+ "Desired:" << (void*)(int)desiredMod;
+ }
+
+}
+
+void QInputGeneratorPrivate::keyEvent(Qt::Key key, bool is_press)
+{
+ int sym = 0;
+ Qt::KeyboardModifiers mod = 0;
+
+ do {
+ if (key >= Qt::Key_0 && key <= Qt::Key_9 ||
+ key >= Qt::Key_A && key <= Qt::Key_Z) {
+ sym = QChar(key).toUpper().toAscii();
+ break;
+ }
+
+ if (key >= Qt::Key_Space && key <= Qt::Key_AsciiTilde) {
+ sym = VkKeyScan(QChar(key).toAscii());
+ if (sym & 0x0100) mod |= Qt::ShiftModifier;
+ if (sym & 0x0200) mod |= Qt::ControlModifier;
+ if (sym & 0x0400) mod |= Qt::AltModifier;
+ break;
+ }
+
+ QMap<int,int>::const_iterator found = keyMap.find(key);
+ if (found != keyMap.end()) {
+ sym = *found;
+ break;
+ }
+
+ qWarning() << "QInputGenerator: don't know how to translate Qt key"
+ << (void*)key << "into Windows virtual key";
+ return;
+
+ } while(0);
+
+ if (mod) {
+ ensureModifiers(mod);
+ }
+
+ QINPUTGENERATOR_DEBUG() << (is_press ? "press" : "release") << sym;
+
+ KEYBDINPUT kbi = {0};
+ INPUT input = {0};
+
+ kbi.wVk = sym;
+ if (!is_press) kbi.dwFlags = KEYEVENTF_KEYUP;
+
+ input.ki = kbi;
+ input.type = INPUT_KEYBOARD;
+ SendInput(1, &input, sizeof(input));
+}
+
+void QInputGenerator::keyPress(Qt::Key key, Qt::KeyboardModifiers mod, bool autoRepeat)
+{
+ Q_UNUSED(autoRepeat);
+ d->ensureModifiers(mod);
+ d->keyEvent(key, true);
+}
+
+void QInputGenerator::keyRelease(Qt::Key key, Qt::KeyboardModifiers mod)
+{
+ d->ensureModifiers(mod);
+ d->keyEvent(key, false);
+}
+
+void QInputGenerator::keyClick(Qt::Key key, Qt::KeyboardModifiers mod)
+{
+ keyPress(key,mod);
+ keyRelease(key,mod);
+}
+
+void QInputGeneratorPrivate::mouseEvent(QPoint const& pos, Qt::MouseButtons state)
+{
+ if (currentPos != pos) {
+ currentPos = pos;
+
+ MOUSEINPUT mi = {0};
+ INPUT input = {0};
+
+ QRect rect = QApplication::desktop()->screenGeometry(); // FIXME: Uses default screen for now
+
+ mi.dx = LONG(pos.x() * 65535.0 / rect.width() + 8);
+ mi.dy = LONG(pos.y() * 65535.0 / rect.height() + 8);
+ mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE;
+ input.mi = mi;
+ input.type = INPUT_MOUSE;
+ SendInput(1, &input, sizeof(input));
+
+ for (int i = 0;
+ i < 1000 && QCursor::pos() != pos;
+ i += 50, QtUiTest::wait(50))
+ {}
+
+ if (QCursor::pos() != pos)
+ qWarning() << "QtUitest: couldn't move cursor to desired point! "
+ "Current position:" << QCursor::pos() <<
+ "Desired:" << pos;
+
+ }
+
+ typedef QPair<uint,uint> ButtonEvent;
+ QList<ButtonEvent> buttonEvents;
+
+ foreach (int button, buttonDownMap.keys()) {
+ bool desired = button & state;
+ bool current = button & currentButtons;
+
+ // Do we need to release?
+ if (!desired && current) {
+ buttonEvents << qMakePair(buttonUpMap[button], buttonMouseDataMap[button]);
+ }
+
+ // Do we need to press?
+ if (desired && !current) {
+ buttonEvents << qMakePair(buttonDownMap[button], buttonMouseDataMap[button]);
+ }
+ }
+
+ foreach (ButtonEvent const& event, buttonEvents) {
+ MOUSEINPUT mi = {0};
+ INPUT input = {0};
+
+ mi.dwFlags = event.first;
+ mi.mouseData = event.second;
+ input.mi = mi;
+ input.type = INPUT_MOUSE;
+ SendInput(1, &input, sizeof(input));
+ }
+
+ currentButtons = state;
+}
+
+void QInputGenerator::mousePress(QPoint const& pos, Qt::MouseButtons state)
+{
+ QINPUTGENERATOR_DEBUG() << "Mouse press" << pos << (void*)(int)state;
+ d->mouseEvent(pos, d->currentButtons | state);
+}
+
+void QInputGenerator::mouseRelease(QPoint const& pos, Qt::MouseButtons state)
+{
+ QINPUTGENERATOR_DEBUG() << "Mouse release" << pos << (void*)(int)(d->currentButtons & ~state);
+ d->mouseEvent(pos, d->currentButtons & ~state);
+}
+
+void QInputGenerator::mouseClick(QPoint const& pos, Qt::MouseButtons state)
+{
+ mousePress (pos,state);
+ mouseRelease(pos,state);
+}
+
diff --git a/libqtuitest/qinputgenerator_x11.cpp b/libqtuitest/qinputgenerator_x11.cpp
new file mode 100644
index 0000000..11bb7e1
--- /dev/null
+++ b/libqtuitest/qinputgenerator_x11.cpp
@@ -0,0 +1,514 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qinputgenerator_p.h"
+
+#include <QtCore>
+#include <QtGui>
+#include <QX11Info>
+#include <X11/extensions/XTest.h>
+#include <X11/keysym.h>
+
+#include "qtuitestnamespace.h"
+
+#define QINPUTGENERATOR_DEBUG() if (1); else qDebug() << "QInputGenerator:"
+
+
+QMap<int,int> qt_key_to_keysym_make()
+{
+ QMap<int,int> m;
+
+#define QT_K(Qt,X) m.insert(Qt,X)
+ QT_K( '\n', XK_Return );
+ QT_K( Qt::Key_Escape, XK_Escape );
+ QT_K( Qt::Key_Tab, XK_Tab );
+ QT_K( Qt::Key_Backtab, XK_ISO_Left_Tab );
+ QT_K( Qt::Key_Backspace, XK_BackSpace );
+ QT_K( Qt::Key_Return, XK_Return );
+ QT_K( Qt::Key_Enter, XK_KP_Enter );
+ QT_K( Qt::Key_Insert, XK_Insert );
+ QT_K( Qt::Key_Delete, XK_Delete );
+ QT_K( Qt::Key_Pause, XK_Pause );
+ QT_K( Qt::Key_Print, XK_Print );
+ QT_K( Qt::Key_SysReq, XK_Sys_Req );
+ QT_K( Qt::Key_Home, XK_Home );
+ QT_K( Qt::Key_End, XK_End );
+ QT_K( Qt::Key_Left, XK_Left );
+ QT_K( Qt::Key_Up, XK_Up );
+ QT_K( Qt::Key_Right, XK_Right );
+ QT_K( Qt::Key_Down, XK_Down );
+ QT_K( Qt::Key_CapsLock, XK_Caps_Lock );
+ QT_K( Qt::Key_NumLock, XK_Num_Lock );
+ QT_K( Qt::Key_ScrollLock, XK_Scroll_Lock );
+ QT_K( Qt::Key_F1, XK_F1 );
+ QT_K( Qt::Key_F2, XK_F2 );
+ QT_K( Qt::Key_F3, XK_F3 );
+ QT_K( Qt::Key_F4, XK_F4 );
+ QT_K( Qt::Key_F5, XK_F5 );
+ QT_K( Qt::Key_F6, XK_F6 );
+ QT_K( Qt::Key_F7, XK_F7 );
+ QT_K( Qt::Key_F8, XK_F8 );
+ QT_K( Qt::Key_F9, XK_F9 );
+ QT_K( Qt::Key_F10, XK_F10 );
+ QT_K( Qt::Key_F11, XK_F11 );
+ QT_K( Qt::Key_F12, XK_F12 );
+ QT_K( Qt::Key_F13, XK_F13 );
+ QT_K( Qt::Key_F14, XK_F14 );
+ QT_K( Qt::Key_F15, XK_F15 );
+ QT_K( Qt::Key_F16, XK_F16 );
+ QT_K( Qt::Key_F17, XK_F17 );
+ QT_K( Qt::Key_F18, XK_F18 );
+ QT_K( Qt::Key_F19, XK_F19 );
+ QT_K( Qt::Key_F20, XK_F20 );
+ QT_K( Qt::Key_F21, XK_F21 );
+ QT_K( Qt::Key_F22, XK_F22 );
+ QT_K( Qt::Key_F23, XK_F23 );
+ QT_K( Qt::Key_F24, XK_F24 );
+ QT_K( Qt::Key_F25, XK_F25 );
+ QT_K( Qt::Key_F26, XK_F26 );
+ QT_K( Qt::Key_F27, XK_F27 );
+ QT_K( Qt::Key_F28, XK_F28 );
+ QT_K( Qt::Key_F29, XK_F29 );
+ QT_K( Qt::Key_F30, XK_F30 );
+ QT_K( Qt::Key_F31, XK_F31 );
+ QT_K( Qt::Key_F32, XK_F32 );
+ QT_K( Qt::Key_F33, XK_F33 );
+ QT_K( Qt::Key_F34, XK_F34 );
+ QT_K( Qt::Key_F35, XK_F35 );
+ QT_K( Qt::Key_Super_L, XK_Super_L );
+ QT_K( Qt::Key_Super_R, XK_Super_R );
+ QT_K( Qt::Key_Menu, XK_Menu );
+ QT_K( Qt::Key_Hyper_L, XK_Hyper_L );
+ QT_K( Qt::Key_Hyper_R, XK_Hyper_R );
+ QT_K( Qt::Key_Help, XK_Help );
+ QT_K( '/', XK_KP_Divide );
+// QT_K( '*', XK_KP_Multiply );
+ QT_K( '-', XK_KP_Subtract );
+ QT_K( '+', XK_KP_Add );
+ QT_K( Qt::Key_Return, XK_KP_Enter );
+ QT_K( Qt::Key_Kanji, XK_Kanji );
+ QT_K( Qt::Key_Muhenkan, XK_Muhenkan );
+ QT_K( Qt::Key_Henkan, XK_Henkan );
+ QT_K( Qt::Key_Romaji, XK_Romaji );
+ QT_K( Qt::Key_Hiragana, XK_Hiragana );
+ QT_K( Qt::Key_Katakana, XK_Katakana );
+ QT_K( Qt::Key_Hiragana_Katakana, XK_Hiragana_Katakana );
+ QT_K( Qt::Key_Zenkaku, XK_Zenkaku );
+ QT_K( Qt::Key_Hankaku, XK_Hankaku );
+ QT_K( Qt::Key_Zenkaku_Hankaku, XK_Zenkaku_Hankaku );
+ QT_K( Qt::Key_Touroku, XK_Touroku );
+ QT_K( Qt::Key_Massyo, XK_Massyo );
+ QT_K( Qt::Key_Kana_Lock, XK_Kana_Lock );
+ QT_K( Qt::Key_Kana_Shift, XK_Kana_Shift );
+ QT_K( Qt::Key_Eisu_Shift, XK_Eisu_Shift );
+ QT_K( Qt::Key_Eisu_toggle,XK_Eisu_toggle );
+ QT_K( Qt::Key_Hangul, XK_Hangul );
+ QT_K( Qt::Key_Hangul_Start, XK_Hangul_Start );
+ QT_K( Qt::Key_Hangul_End, XK_Hangul_End );
+ QT_K( Qt::Key_Hangul_Hanja, XK_Hangul_Hanja );
+ QT_K( Qt::Key_Hangul_Jamo, XK_Hangul_Jamo );
+ QT_K( Qt::Key_Hangul_Romaja, XK_Hangul_Romaja );
+ QT_K( Qt::Key_Hangul_Jeonja, XK_Hangul_Jeonja );
+ QT_K( Qt::Key_Hangul_Banja, XK_Hangul_Banja );
+ QT_K( Qt::Key_Hangul_PreHanja, XK_Hangul_PreHanja );
+ QT_K( Qt::Key_Hangul_PostHanja,XK_Hangul_PostHanja );
+ QT_K( Qt::Key_Hangul_Special, XK_Hangul_Special );
+
+ // Modifiers
+ QT_K( Qt::ShiftModifier, XK_Shift_L );
+ QT_K( Qt::Key_Shift, XK_Shift_L );
+ QT_K( Qt::ControlModifier,XK_Control_L );
+ QT_K( Qt::Key_Control, XK_Control_L );
+// QT_K( Qt::AltModifier, XK_Alt_L );
+// QT_K( Qt::Key_Alt, XK_Alt_L );
+ QT_K( Qt::MetaModifier, XK_Meta_L );
+ QT_K( Qt::Key_Meta, XK_Meta_L );
+
+ QT_K( Qt::AltModifier, XK_ISO_Level3_Shift );
+ QT_K( Qt::Key_Alt, XK_ISO_Level3_Shift );
+ // FIXME support Qt::KeypadModifier
+
+#undef QT_K
+
+ return m;
+}
+
+QMap<int,uint> qt_button_to_x_button_make()
+{
+ QMap<int,uint> m;
+
+ m.insert(Qt::LeftButton, 1);
+ m.insert(Qt::MidButton, 2);
+ m.insert(Qt::RightButton, 3);
+
+ return m;
+}
+
+QMap<int,int> qt_modifier_to_x_modmask_make()
+{
+ QMap<int,int> m;
+
+ m.insert( Qt::ShiftModifier, ShiftMask );
+ m.insert( Qt::ControlModifier, ControlMask );
+// m.insert( Qt::AltModifier, Mod1Mask );
+ m.insert( Qt::MetaModifier, Mod4Mask );
+ m.insert( Qt::AltModifier, Mod5Mask );
+
+ return m;
+}
+
+struct QInputGeneratorPrivate
+{
+ QInputGeneratorPrivate();
+ QInputGenerator* q;
+
+ void keyEvent(Qt::Key, bool);
+ void mouseEvent(QPoint const&, Qt::MouseButtons);
+
+ void ensureModifiers(Qt::KeyboardModifiers);
+ Qt::KeyboardModifiers currentModifiers() const;
+
+ QMap<int,int> const keymap;
+ QMap<int,uint> const buttonmap;
+
+ QPoint currentPos;
+ Qt::MouseButtons currentButtons;
+};
+
+QInputGeneratorPrivate::QInputGeneratorPrivate()
+ : keymap(qt_key_to_keysym_make()),
+ buttonmap(qt_button_to_x_button_make()),
+ currentPos(),
+ currentButtons(0)
+{}
+
+QInputGenerator::QInputGenerator(QObject* parent)
+ : QObject(parent),
+ d(new QInputGeneratorPrivate)
+{
+ d->q = this;
+ QINPUTGENERATOR_DEBUG() << "constructor";
+}
+
+QInputGenerator::~QInputGenerator()
+{
+ QINPUTGENERATOR_DEBUG() << "destructor";
+
+ /*
+ Restore all keyboard modifiers to off.
+ If we don't do this, the current modifiers stay activated for the current X server
+ even when this application is closed.
+ Note that there is no guarantee this code actually gets run.
+ */
+ d->ensureModifiers(0);
+ if (d->currentButtons) {
+ d->mouseEvent(d->currentPos, 0);
+ }
+
+ d->q = 0;
+ delete d;
+ d = 0;
+}
+
+/*
+ Returns the Qt keyboard modifiers which are currently pressed.
+*/
+Qt::KeyboardModifiers QInputGeneratorPrivate::currentModifiers() const
+{
+ Display* dpy = QX11Info::display();
+ if (!dpy) {
+ /* No X connection */
+ return 0;
+ }
+
+ Window root = 0;
+ Window child = 0;
+ int root_x = 0;
+ int root_y = 0;
+ int win_x = 0;
+ int win_y = 0;
+ uint buttons = 0;
+
+ // Grab all of the pointer info, though all we really care about is the modifiers.
+ bool ok = false;
+ for (int i = 0; i < ScreenCount(dpy) && !ok; ++i) {
+ if (XQueryPointer(dpy, (Window)QX11Info::appRootWindow(i), &root, &child, &root_x, &root_y,
+ &win_x, &win_y, &buttons))
+ ok = true;
+ }
+
+ if (!ok) {
+ qWarning() <<
+ "QInputGenerator: could not determine current state of keyboard modifiers. "
+ "Simulated key events may be incorrect.";
+ return 0;
+ }
+
+ // Convert to Qt::KeyboardModifiers.
+ static const QMap<int,int> modmap = qt_modifier_to_x_modmask_make();
+
+ Qt::KeyboardModifiers ret(0);
+ for (unsigned i = 0; i < sizeof(q->AllModifiers)/sizeof(Qt::KeyboardModifier); ++i) {
+ Qt::KeyboardModifier thisMod = q->AllModifiers[i];
+ int mask = modmap.value(thisMod);
+ if (buttons & mask) {
+ QINPUTGENERATOR_DEBUG() << "mod enabled:" << (void*)(int)thisMod << (void*)mask;
+ ret |= thisMod;
+ }
+ }
+
+ QINPUTGENERATOR_DEBUG() << "current modifiers:" << (void*)buttons << (void*)(int)ret;
+
+ return ret;
+}
+
+void QInputGeneratorPrivate::ensureModifiers(Qt::KeyboardModifiers desiredMod)
+{
+ Qt::KeyboardModifiers currentMod = currentModifiers();
+
+ // For each modifier..
+ for (unsigned i = 0; i < sizeof(q->AllModifiers)/sizeof(Qt::KeyboardModifier); ++i) {
+ Qt::KeyboardModifier thisMod = q->AllModifiers[i];
+ // If the modifier is currently disabled but we want it enabled, or vice-versa...
+ if ((desiredMod & thisMod) && !(currentMod & thisMod)) {
+ QINPUTGENERATOR_DEBUG() << "Enabling modifier" << (void*)thisMod << "by press";
+ // press to enable
+ keyEvent(q->modifierToKey(thisMod), true);
+ } else if (!(desiredMod & thisMod) && (currentMod & thisMod)) {
+ QINPUTGENERATOR_DEBUG() << "Disabling modifier" << (void*)thisMod << "by release";
+ // release to disable
+ keyEvent(q->modifierToKey(thisMod), false);
+ }
+ }
+
+// if (currentMod != desiredMod) {
+// currentMod = desiredMod;
+// for (int i = 0;
+// i < 1000 && QApplication::keyboardModifiers() != desiredMod;
+// i += 50, QtUiTest::wait(50))
+// {}
+//
+// if (QApplication::keyboardModifiers() != desiredMod)
+// qWarning() << "QtUitest: couldn't set all modifiers to desired state! "
+// "Current state:" << (void*)(int)QApplication::keyboardModifiers() <<
+// "Desired:" << (void*)(int)desiredMod;
+// }
+ if (currentMod != desiredMod) {
+ currentMod = desiredMod;
+ for (int i = 0;
+ i < 1000 && currentModifiers() != desiredMod;
+ i += 50, QtUiTest::wait(50))
+ {}
+
+ if (currentModifiers() != desiredMod)
+ qWarning() << "QtUitest: couldn't set all modifiers to desired state! "
+ "Current state:" << (void*)(int)currentModifiers() <<
+ "Desired:" << (void*)(int)desiredMod;
+ }
+
+}
+
+void QInputGeneratorPrivate::keyEvent(Qt::Key key, bool is_press)
+{
+ Display* dpy = QX11Info::display();
+ if (!dpy) {
+ /* No X connection */
+ return;
+ }
+
+ KeySym sym = 0;
+
+ do {
+// if ((key >= Qt::Key_0 && key <= Qt::Key_9) ||
+// (key >= Qt::Key_A && key <= Qt::Key_Z)) {
+// sym = QChar(key).toLower().unicode();
+// break;
+// }
+
+ if (key >= Qt::Key_A && key <= Qt::Key_Z) {
+ sym = QChar(key).toLower().unicode();
+ break;
+ }
+
+
+ QMap<int,int>::const_iterator found = keymap.find(key);
+ if (found != keymap.end()) {
+ sym = *found;
+ break;
+ }
+
+ if ((key < 0x1000 && key >= 0x20 )|| (key >= Qt::Key_0 && key <= Qt::Key_9) ){
+ sym = QChar(key).unicode();
+ KeyCode kc = XKeysymToKeycode(dpy, sym);
+ int syms_per_keycode;
+ KeySym *keymap = XGetKeyboardMapping(dpy, kc, 1, &syms_per_keycode);
+ for(int i=0; i<syms_per_keycode;i++)
+ {
+ QINPUTGENERATOR_DEBUG()<<"keymap["<<i<<"]is:"<<XKeysymToString(keymap[i]);
+ }
+
+ if (sym == keymap[1] && sym != keymap[0]) {
+ ensureModifiers(Qt::ShiftModifier);
+ }
+
+ else if (sym == keymap[4]) {
+ ensureModifiers(Qt::AltModifier);
+ }
+
+ XFree(keymap);
+ break;
+ }
+
+ qWarning() << "QInputGenerator: don't know how to translate Qt key"
+ << (void*)key << "into X11 keysym";
+ return;
+
+ } while(0);
+
+ QINPUTGENERATOR_DEBUG() << (is_press ? "press" : "release") << XKeysymToString(sym);
+
+ XTestFakeKeyEvent(
+ dpy,
+ XKeysymToKeycode(dpy, sym),
+ is_press,
+ 0
+ );
+}
+
+void QInputGenerator::keyPress(Qt::Key key, Qt::KeyboardModifiers mod, bool autoRepeat)
+{
+ Q_UNUSED(autoRepeat);
+ d->ensureModifiers(mod);
+ d->keyEvent(key, true);
+}
+
+void QInputGenerator::keyRelease(Qt::Key key, Qt::KeyboardModifiers mod)
+{
+ d->ensureModifiers(mod);
+ d->keyEvent(key, false);
+}
+
+void QInputGenerator::keyClick(Qt::Key key, Qt::KeyboardModifiers mod)
+{
+ keyPress(key,mod);
+ keyRelease(key,mod);
+}
+
+void QInputGeneratorPrivate::mouseEvent(QPoint const& pos, Qt::MouseButtons state)
+{
+ Display* dpy = QX11Info::display();
+ if (!dpy) {
+ /* No X connection */
+ return;
+ }
+
+ if (currentPos != pos) {
+ currentPos = pos;
+
+ XTestFakeMotionEvent(
+ dpy,
+ QX11Info::appScreen(),
+ pos.x(),
+ pos.y(),
+ 0
+ );
+
+ for (int i = 0;
+ i < 1000 && QCursor::pos() != pos;
+ i += 50, QtUiTest::wait(50))
+ {}
+
+ if (QCursor::pos() != pos)
+ qWarning() << "QtUitest: couldn't move cursor to desired point! "
+ "Current position:" << QCursor::pos() <<
+ "Desired:" << pos;
+
+ }
+
+ typedef QPair<uint,bool> ButtonEvent;
+ QList<ButtonEvent> buttonEvents;
+
+ foreach (int button, buttonmap.keys()) {
+ bool desired = button & state;
+ bool current = button & currentButtons;
+
+ // Do we need to press?
+ if (desired && !current) {
+ buttonEvents << qMakePair(buttonmap[button], true);
+ }
+
+ // Do we need to release?
+ if (!desired && current) {
+ buttonEvents << qMakePair(buttonmap[button], false);
+ }
+ }
+
+ foreach (ButtonEvent const& event, buttonEvents) {
+ QINPUTGENERATOR_DEBUG() << "Button event at" << pos << ":" << event.first << event.second;
+ XTestFakeButtonEvent(
+ dpy,
+ event.first,
+ event.second,
+ 0
+ );
+ }
+
+ currentButtons = state;
+}
+
+void QInputGenerator::mousePress(QPoint const& pos, Qt::MouseButtons state)
+{
+ QINPUTGENERATOR_DEBUG() << "Mouse press" << pos << (void*)(int)state;
+ d->mouseEvent(pos, d->currentButtons | state);
+}
+
+void QInputGenerator::mouseRelease(QPoint const& pos, Qt::MouseButtons state)
+{
+ QINPUTGENERATOR_DEBUG() << "Mouse release" << pos << (void*)(int)(d->currentButtons & ~state);
+ d->mouseEvent(pos, d->currentButtons & ~state);
+}
+
+void QInputGenerator::mouseClick(QPoint const& pos, Qt::MouseButtons state)
+{
+ mousePress (pos,state);
+ mouseRelease(pos,state);
+}
+
diff --git a/libqtuitest/qtestprotocol.cpp b/libqtuitest/qtestprotocol.cpp
new file mode 100644
index 0000000..713d217
--- /dev/null
+++ b/libqtuitest/qtestprotocol.cpp
@@ -0,0 +1,1162 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*
+ This cpp file contains a number of socket related classes that are used heavily in QtUiTest.
+ The classes are documented later in the file.
+*/
+
+#include "qtestprotocol_p.h"
+#include "qtuitestnamespace.h"
+
+#include <QApplication>
+#include <QString>
+#include <QTimer>
+#include <QUuid>
+#include <QFileInfo>
+#include <QDir>
+#include <QTcpSocket>
+#include <QTcpServer>
+#include <QHostAddress>
+#include <QHostInfo>
+#include <QPointer>
+
+#include <QDebug>
+#define qLog(A) if (1); else qDebug()
+
+#if defined(Q_OS_WIN32) && !defined(Q_OS_TEMP)
+# include <io.h>
+#endif
+
+static const int CONNECT_TIMEOUT = 20000;
+
+static const quint32 TEST_MSG_SIGNATURE = 0xEDBAEDBA;
+static const quint32 TEST_MSG_END = 0xEDBAABDE;
+static const quint8 TEST_MSG_VERSION = 3;
+static uint g_unique_id = 0;
+
+bool waitForSignal(QObject* object, const char* signal, int timeout)
+{
+#ifdef QTUITEST_TARGET
+ return QtUiTest::waitForSignal(object, signal, timeout);
+#else
+ QEventLoop loop;
+ QTimer dummy;
+ dummy.setInterval(1000);
+ if (!QObject::connect(object, signal, &dummy, SLOT(start())))
+ return false;
+ if (!QObject::connect(object, signal, &loop, SLOT(quit())))
+ return false;
+ QTimer::singleShot(timeout, &loop, SLOT(quit()));
+ loop.exec();
+ return dummy.isActive();
+#endif
+}
+
+void wait(int timeout)
+{
+#ifdef QTUITEST_TARGET
+ QtUiTest::wait(timeout);
+#else
+ QEventLoop loop;
+ QTimer::singleShot(timeout, &loop, SLOT(quit()));
+ loop.exec();
+#endif
+}
+
+// ********************************************************************************
+// ****************************** QTestMessage ************************************
+// ********************************************************************************
+
+/*
+ \class QTestMessage QTestMessage.h
+ \inpublicgroup QtUiTestModule
+
+ \brief The QTestMessage class can be used for exchanging messages between separate
+ processes. The class is never used directly but instead is used by QTestProtocol.
+
+ The class basically wraps a number of strings (i.e. 'event' and 'message') and binary data
+ (i.e. a bytearray or a file) into a datastream that is sent to a peer using a socket
+ connection. On the receiving side a QTestMessage instance is decoding the datastream
+ and performs a number of sanity checks to make it a bit more robost.
+
+ A TCP connection 'should' be reliable but in exceptional cases bytes may be lost. This
+ would result in the connection becoming useless because all future data reception would
+ be out of sync. To solve this a 'resync' function is implemented that can re-sync the datastream
+ by throwing away bytes until the data seems in sync again. The obvious downside is that
+ at least one message will be lost.
+
+ Message format is as follows:
+
+ Field: Length: Remarks:
+
+ Start signature 4 Fixed value - 0xEDBAEDBA
+ Protocol version 1 Fixed value - 3
+ Message number 2
+ Event length 4 Length of following string
+ Event string Event length QString value
+ Message length 4 Length of following string
+ Messaga string Message length QString value
+ Data length 4 Length of following binary data
+ File data Data length Binary data
+ End signature 4 Fixed value - 0xEDBAABDE
+*/
+
+/*
+ \internal
+
+ Constructs a default (empty) message.
+*/
+
+QTestMessage::QTestMessage(QString const &event, QVariantMap const &map)
+ : m_phase(0)
+ , m_msg_id(0)
+ , m_event(event)
+ , m_map(map)
+{
+}
+
+QTestMessage::QTestMessage(QString const &event, const QTestMessage &other )
+ : m_phase(0)
+ , m_msg_id(other.m_msg_id)
+ , m_map(other.m_map)
+{
+ m_event = event;
+}
+
+QTestMessage::QTestMessage(QString const &event, QString const &queryApp, QString const &queryPath )
+ : m_phase(0)
+ , m_msg_id(0)
+ , m_event(event)
+ , m_map(QVariantMap())
+{
+ m_map["queryapp"] = queryApp;
+ m_map["querypath"] = queryPath;
+}
+
+/*
+ \internal
+
+ Copy constructor.
+*/
+
+QTestMessage::QTestMessage(const QTestMessage &other)
+ : m_phase(0)
+ , m_msg_id(other.m_msg_id)
+ , m_event(other.m_event)
+ , m_map(other.m_map)
+{
+}
+
+/*
+ \internal
+
+ Destroys the message.
+*/
+
+QTestMessage::~QTestMessage()
+{
+}
+
+/*
+ \internal
+
+ Assignment operator.
+*/
+
+QTestMessage& QTestMessage::operator=(const QTestMessage &other)
+{
+ m_msg_id = other.m_msg_id;
+ m_event = other.m_event;
+ m_map = other.m_map;
+
+ return *this;
+}
+
+QVariant &QTestMessage::operator[](QString const &key)
+{
+ return m_map[key.toLower()];
+}
+
+QVariant const QTestMessage::operator[](QString const &key) const
+{
+ return m_map[key.toLower()];
+}
+
+bool QTestMessage::contains(QString const &key) const
+{
+ return m_map.contains(key.toLower());
+}
+
+QList<QString> QTestMessage::keys() const
+{
+ return m_map.keys();
+}
+
+QString QTestMessage::toString() const
+{
+ QString ret;
+ foreach(QString k, m_map.keys()) {
+ if (!m_map[k].isValid()) continue;
+ ret += k + ": ";
+ if (m_map[k].canConvert<QStringList>()) ret += "'" + m_map[k].toStringList().join("','") + "'";
+ else if (m_map[k].canConvert<QString>()) ret += "'" + m_map[k].toString() + "'";
+ else ret += "(data)";
+ ret += "\n";
+ }
+ if (ret.endsWith("\n")) ret.chop(1);
+ return ret;
+}
+
+/*
+ \internal
+ Returns the event that was received.
+*/
+
+QString QTestMessage::event() const
+{
+ return m_event;
+}
+
+/*
+ \internal
+ Returns the message number.
+*/
+
+quint16 QTestMessage::msgId() const
+{
+ return m_msg_id;
+}
+
+bool QTestMessage::statusOK() const
+{
+ return m_map.contains("status") && m_map["status"].toString() == "OK";
+}
+
+bool QTestMessage::isNull() const
+{
+ return m_map.isEmpty();
+}
+
+
+// ********************************************************************************
+// ************************* QTestServerSocket ************************************
+// ********************************************************************************
+
+/* !
+ \class QTestServerSocket qtestserversocket.h
+ \inpublicgroup QtUiTestModule
+
+ \brief The QTestServerSocket class provides a TCP-based server.
+
+ This class is a convenience class for accepting incoming TCP
+ connections. You can specify the port or have QTestServerSocket pick
+ one, and listen on just one address or on all the machine's
+ addresses.
+
+ Using the API is very simple: subclass QTestServerSocket, call the
+ constructor of your choice, and implement onNewConnection() to
+ handle new incoming connections. There is nothing more to do.
+
+ (Note that due to lack of support in the underlying APIs,
+ QTestServerSocket cannot accept or reject connections conditionally.)
+
+ \sa QTcpSocket, QTcpServer, QHostAddress, QSocketNotifier
+*/
+
+
+/* !
+ Creates a server socket object, that will serve the given \a port
+ on all the addresses of this host. If \a port is 0, QTestServerSocket
+ will pick a suitable port in a system-dependent manner. Use \a
+ backlog to specify how many pending connections the server can
+ have.
+
+ \warning On Tru64 Unix systems a value of 0 for \a backlog means
+ that you don't accept any connections at all; you should specify a
+ value larger than 0.
+*/
+
+QTestServerSocket::QTestServerSocket( quint16 port, int backlog )
+ : QTcpServer()
+{
+ setMaxPendingConnections( backlog );
+ listen( QHostAddress::Any, port );
+
+ if (this->serverPort() == 0) {
+ qWarning( QString("ERROR: port '%1' is already in use, application is aborted.").arg(port).toAscii() );
+ QApplication::exit(777);
+ }
+}
+
+/* !
+ Destroys the socket.
+
+ This causes any backlogged connections (connections that have
+ reached the host, but not yet been completely set up
+ to be severed.
+
+ Existing connections continue to exist; this only affects the
+ acceptance of new connections.
+*/
+QTestServerSocket::~QTestServerSocket()
+{
+}
+
+/* !
+ Returns true if the construction succeeded; otherwise returns false.
+*/
+bool QTestServerSocket::ok() const
+{
+ return serverPort() > 0;
+}
+
+/* !
+ Returns the port number on which this server socket listens. This
+ is always non-zero; if you specify 0 in the constructor,
+ QTestServerSocket will pick a non-zero port itself. ok() must be true
+ before calling this function.
+
+ \sa address()
+*/
+quint16 QTestServerSocket::port() const
+{
+ return serverPort();
+}
+
+/* !
+ Returns the address on which this object listens, or 0.0.0.0 if
+ this object listens on more than one address. ok() must be true
+ before calling this function.
+
+ \sa port()
+*/
+QString QTestServerSocket::address() const
+{
+ return serverAddress().toString();
+}
+
+void QTestServerSocket::incomingConnection( int socket )
+{
+ onNewConnection( socket );
+}
+
+// ********************************************************************************
+// *************************** QTestProtocol ************************************
+// ********************************************************************************
+
+/*
+ \class QTestProtocol qtestprotocol.h
+ \inpublicgroup QtUiTestModule
+
+ \brief The QTestProtocol class can be used for exchanging messages between separate
+ processes.
+
+ It is intended to be fast but at the same time ultra reliable and robust communication protocol.
+
+ The main function that is used on the sending side is:
+ \code
+ myConnection.postMessage( "My-Event", "My-Message", ptr_to_my_data );
+ \endcode
+
+ On the receiving side the main function is a re-implemented 'processMessage':
+ \code
+ void MyTestConnection::processMessage( QTestMessage *msg )
+ {
+ if (msg->event() == "My-Event") {
+ print( msg->message() );
+ }
+ }
+ \endcode
+*/
+
+#include <stdio.h>
+
+QTestProtocol::QTestProtocol()
+ : QTcpSocket()
+ , tx_msg_id(1)
+ , host()
+ , port(0)
+ , onData_busy(false)
+ , enable_reconnect(false)
+ , reconnect_interval(10000)
+ , connect_timer()
+ , last_data_received(false)
+ , connection_valid(false)
+ , ping_enabled(false)
+ , ping_interval(10000)
+ , ping_timer()
+ , ping_count(0)
+ , ping_timeout_warning_issued(false)
+ , last_send_cmd("")
+ , unique_id()
+ , debug_on(false)
+{
+ static int id1 = qRegisterMetaType<QTestMessage>(); Q_UNUSED(id1);
+ static int id2 = qRegisterMetaType<QTestMessage*>(); Q_UNUSED(id2);
+ static int id3 = qRegisterMetaType<const QTestMessage*>(); Q_UNUSED(id3);
+
+ unique_id = QString("%1").arg(++g_unique_id);
+ if (debug_on) {
+ qLog(QtUitest) << QString("%1 QTestProtocol::QTestProtocol()").arg(uniqueId()).toLatin1();
+ }
+ cur_message = 0;
+ rx_busy = false;
+
+ QObject::connect( &connect_timer, SIGNAL(timeout()), this, SLOT(connectTimeout()), Qt::DirectConnection );
+
+ QObject::connect( this,SIGNAL(connected()),this,SLOT(onSocketConnected()), Qt::DirectConnection );
+ QObject::connect( this,SIGNAL(disconnected()),this,SLOT(onSocketClosed()), Qt::DirectConnection );
+ QObject::connect( this,SIGNAL(readyRead()),this,SLOT(onData()), Qt::DirectConnection );
+
+ // initialize. Any time is better than no time.
+ rx_timer.start();
+}
+
+/*!
+ Destructs the instance of QTestProtocol.
+*/
+
+QTestProtocol::~QTestProtocol()
+{
+ if (debug_on) {
+ qLog(QtUitest) << QString("%1 QTestProtocol::~QTestProtocol()").arg(uniqueId()).toLatin1();
+ }
+ enableReconnect( false, 0 );
+
+ // we can't send any more messages so disable pinging
+ enablePing( false );
+
+ // anything that is still in the tx buffer gets lost
+ abort();
+ close();
+
+ while (send_msg_replies.count() > 0)
+ delete send_msg_replies.takeFirst();
+ while (unhandled_msg.count() > 0)
+ delete unhandled_msg.takeFirst();
+}
+
+void QTestProtocol::setSocket( int socket )
+{
+ if (debug_on) {
+ qLog(QtUitest) << ( QString("%1 QTestProtocol::setSocket(socket=%2)").
+ arg(uniqueId()).
+ arg(socket).toLatin1());
+ }
+ setSocketDescriptor( socket );
+
+ rx_timer.start();
+ testConnection();
+}
+
+void QTestProtocol::enableReconnect( bool enable, uint reconnectInterval )
+{
+ if (debug_on) {
+ qLog(QtUitest) << ( QString("%1 QTestProtocol::enableReconnect( enable=%2, interval=%3)").
+ arg(uniqueId()).
+ arg(enable).
+ arg(reconnectInterval).toLatin1());
+ }
+ enable_reconnect = enable;
+ reconnect_interval = reconnectInterval;
+}
+
+/*!
+ Opens a socket connection to the specified \a hostname and \a port.
+
+ After a connection is successfully opened the instance will listen for and process
+ incoming commands received from the remote host.
+*/
+void QTestProtocol::connect( const QString& hostname, int port )
+{
+ if (debug_on) {
+ qLog(QtUitest) << ( QString("%1 QTestProtocol::connect(%2:%3)").
+ arg(uniqueId()).
+ arg(hostname).
+ arg(port).toLatin1());
+ }
+
+ if (state() == ConnectedState) {
+ if (hostname == this->host && port == this->port)
+ return;
+ disconnect();
+ }
+
+ rx_timer.start();
+
+ this->host = hostname;
+ this->port = port;
+
+ reconnect();
+}
+
+void QTestProtocol::disconnect( bool disableReconnect )
+{
+ if (state() == ConnectedState) {
+ if (debug_on) {
+ qLog(QtUitest) << ( QString("%1 QTestProtocol::disconnect(disableReconnect=%2)").
+ arg(uniqueId()).
+ arg(disableReconnect).toLatin1());
+ }
+ // be polite and tell the other side we are closing
+ postMessage( QTestMessage("QTEST_CLOSING_CONNECTION") );
+
+ // we are closing ourselves, so we don't want to reconnect
+ if (disableReconnect) enable_reconnect = false;
+
+ onSocketClosed();
+ }
+}
+
+bool QTestProtocol::isConnected()
+{
+ return (state() == ConnectedState && connection_valid);
+}
+
+bool QTestProtocol::waitForConnected( int timeout )
+{
+ QtUiTestElapsedTimer t;
+ if (QTcpSocket::waitForConnected(timeout)) {
+ if (debug_on) {
+ qLog(QtUitest) << QString("%1 QTestProtocol::waitForConnected() ... testing connection").arg(uniqueId()).toLatin1();
+ }
+ while (t.elapsed() < timeout && !isConnected()) {
+ wait(500);
+ postMessage( QTestMessage("QTEST_NEW_CONNECTION") );
+ }
+ }
+ bool ok = isConnected();
+ if (debug_on) {
+ qLog(QtUitest) << QString("%1 QTestProtocol::waitForConnected() ... %2").arg(uniqueId()).arg(ok ? "OK" : "FAILED" ).toLatin1();
+ }
+ return ok;
+}
+
+/*!
+ \internal
+ Posts (e.g. non blocking) an \a event, \a message and contents of \a fileName to the remote host.
+*/
+
+uint QTestProtocol::postMessage(QTestMessage const &message )
+{
+ if (debug_on && message.event() != "PING" && message.event() != "PONG") {
+ qLog(QtUitest) << ( QString("%1 QTestProtocol::postMessage(%2)").
+ arg(uniqueId()).
+ arg(message.event()).toLatin1());
+ }
+ if (state() != ConnectedState)
+ return 0;
+ QTestMessage msg(message);
+ msg.m_msg_id = tx_msg_id++;
+ send( msg );
+ return msg.m_msg_id;
+}
+
+void QTestProtocol::onReplyReceived( QTestMessage* /*reply*/ )
+{
+}
+
+/*!
+ \internal
+ Sends an \a event, \a message and \a data to the remote host and waits for up to
+ \a timeout milliseconds for a reply. If a reply is received, the reply's message
+ string is placed in \a reply.
+*/
+bool QTestProtocol::sendMessage( QTestMessage const &message, QTestMessage &reply, int timeout )
+{
+ QTestMessage msg(message);
+ QPointer<QTestProtocol> safeThis(this);
+ bool safeDebugOn(debug_on);
+ QString safeUniqueId(uniqueId());
+
+ last_send_cmd = message.event();
+
+ if (state() == ConnectingState) {
+ wait(4000);
+ }
+
+ if (state() == ConnectedState) {
+ msg.m_msg_id = tx_msg_id++;
+
+ if (debug_on) {
+ qLog(QtUitest) << ( QString("%1 QTestProtocol::sendMessage(%2) msgid=%3)").
+ arg(uniqueId()).
+ arg(msg.event()).
+ arg(msg.msgId()).
+ toLatin1());
+ }
+
+ send( msg );
+
+ QtUiTestElapsedTimer t;
+ QtUiTestElapsedTimer t2;
+ bool first_time = true;
+ while ( (state() == ConnectedState) && (timeout < 0 || t.elapsed() < timeout) ) {
+
+ if (debug_on) {
+ if (first_time || t2.elapsed() > 1000) {
+ qLog(QtUitest) << ( QString("%1 QTestProtocol::sendMessage(%2) ... waiting for reply").
+ arg(uniqueId()).
+ arg(message.event()).toLatin1());
+ t2.start();
+ first_time = false;
+ }
+ }
+
+
+ waitForSignal(this, SIGNAL(replyReceived()), 500);
+
+ if (!safeThis) {
+ if (message["expectClose"].isValid()) {
+ return true;
+ }
+ if (safeDebugOn) {
+ qLog(QtUitest) << ( QString("%1 QTestProtocol::sendMessage(%2) ... object deleted unexpectedly").
+ arg(safeUniqueId).
+ arg(message.event()).toLatin1());
+ }
+ reply["status"] = "ERROR: Connection was terminated unexpectedly. This may be caused by an application crash.";
+ reply["_q_inResponseTo"] = QString("%1\n%2").arg(message.event()).arg(message.toString());
+ return false;
+ } else {
+ if (send_msg_replies.count() > 0) {
+ if (debug_on) {
+ qLog(QtUitest) << ( QString("%1 QTestProtocol::sendMessage(%2) ... check replies").
+ arg(uniqueId()).
+ arg(message.event()).toLatin1());
+ }
+ for (int i=0; i<send_msg_replies.size(); i++) {
+ QTestMessage * possible_reply = send_msg_replies.at(i);
+ if (possible_reply && possible_reply->m_msg_id == msg.m_msg_id) {
+
+ reply = *possible_reply;
+ delete send_msg_replies.takeAt( i );
+
+ if (debug_on) {
+ qLog(QtUitest) << ( QString("%1 QTestProtocol::sendMessage(%2) ... reply received").
+ arg(uniqueId()).
+ arg(message.event()).toLatin1());
+ }
+
+ onReplyReceived(&reply);
+ return true;
+ }
+ }
+ }
+ }
+ }
+ if (state() != ConnectedState) {
+ reply["status"] = "ERROR: Connection lost. This is likely caused by a crash in the Application Under Test.";
+ reply["_q_inResponseTo"] = QString("%1\n%2").arg(message.event()).arg(message.toString());
+ }
+ else {
+ reply["status"] = "ERROR_REPLY_TIMEOUT";
+ reply["_q_inResponseTo"] = QString("%1\n%2").arg(message.event()).arg(message.toString());
+ }
+ reply["location"] = QString("%1:%2").arg(__FILE__).arg(__LINE__);
+ } else {
+ reply["status"] = "ERROR_NO_CONNECTION";
+ reply["_q_inResponseTo"] = QString("%1\n%2").arg(message.event()).arg(message.toString());
+ reply["location"] = QString("%1:%2").arg(__FILE__).arg(__LINE__);
+ }
+
+ if (debug_on) {
+ qLog(QtUitest) << ( QString("%1 QTestProtocol::sendMessage(%2) ... done. Status: %3").
+ arg(uniqueId()).
+ arg(message.event()).arg(reply["status"].toString()).toLatin1());
+ }
+
+ return false;
+}
+
+/*!
+ Send the string \a result as a reply to \a originalMsg.
+*/
+
+void QTestProtocol::replyMessage( QTestMessage *originalMsg, QTestMessage const &message )
+{
+ if (debug_on) {
+ qLog(QtUitest) << ( QString("%1 QTestProtocol::replyMessage(%2)").
+ arg(uniqueId()).
+ arg(originalMsg->event()).toLatin1());
+ }
+
+ QTestMessage msg(message);
+ msg.m_msg_id = originalMsg->msgId();
+ msg.m_event = "@REPLY@";
+ send( msg );
+}
+
+bool QTestProtocol::lastDataReceived()
+{
+ return last_data_received;
+}
+
+QString QTestProtocol::errorStr()
+{
+ QString S = "Connection error: ";
+ switch (error()) {
+ case ConnectionRefusedError: S += "A connection attempt was rejected by the peer"; break;
+ case HostNotFoundError: S += "Host not found"; break;
+ case RemoteHostClosedError: S += "RemoteHostClosedError"; break;
+ case SocketAccessError: S += "SocketAccessError"; break;
+ case SocketResourceError: S += "SocketResourceError"; break;
+ case SocketTimeoutError: S += "SocketTimeoutError"; break;
+ case DatagramTooLargeError: S += "DatagramTooLargeError"; break;
+ case NetworkError: S += "NetworkError"; break;
+ case AddressInUseError: S += "AddressInUseError"; break;
+ case SocketAddressNotAvailableError: S += "SocketAddressNotAvailableError"; break;
+ case UnsupportedSocketOperationError: S += "UnsupportedSocketOperationError"; break;
+ case UnknownSocketError: S += "UnknownSocketError"; break;
+ default: S += " Unknown error";
+ }
+
+ return S;
+}
+
+void QTestProtocol::onConnectionFailed( const QString &reason )
+{
+ emit connectionFailed( this, reason );
+}
+
+void QTestProtocol::testConnection()
+{
+ if (debug_on) {
+ qLog(QtUitest) << QString("%1 QTestProtocol::testConnection()").arg(uniqueId()).toLatin1();
+ }
+
+ while (send_msg_replies.count() > 0)
+ delete send_msg_replies.takeFirst();
+
+ enablePing( true );
+ postMessage( QTestMessage("QTEST_NEW_CONNECTION") );
+}
+
+void QTestProtocol::send( QTestMessage const &message )
+{
+ QByteArray data;
+ if (!message.m_map.isEmpty()) {
+ QDataStream s(&data, QIODevice::WriteOnly);
+ s << message.m_map;
+ }
+
+ QDataStream tmp(this);
+ sendPreamble( &tmp, message.msgId(), message.event() );
+
+ quint32 len = data.count();
+ tmp << len; // phase 2
+ if (len > 0) {
+ tmp.writeRawData( data.data(), (int)len ); // phase 3
+ }
+
+ tmp << TEST_MSG_END; // phase 4
+
+ flush(); // Force socket to send data now
+}
+
+void QTestProtocol::sendPreamble( QDataStream *ds, quint16 msgId, const QString &event )
+{
+ quint32 len;
+ *ds << TEST_MSG_SIGNATURE; // phase 0
+ *ds << TEST_MSG_VERSION;
+ *ds << msgId;
+
+ len = (event.length() *2) + 4;
+ *ds << len;
+ *ds << event; // phase 1
+}
+
+bool QTestProtocol::receive( QTestMessage *msg, bool &syncError )
+{
+ syncError = false;
+
+ QDataStream stream(this);
+
+ quint8 rx_version;
+ if (msg->m_phase == uint(0)) {
+ msg->m_len = 0;
+ quint32 sig;
+ if (bytesAvailable() >= sizeof( sig ) + sizeof( rx_version ) + sizeof( msg->m_msg_id ) + sizeof( msg->m_len )) {
+ stream >> sig;
+ if (sig != TEST_MSG_SIGNATURE) {
+ qWarning( QString("QTestMessage::receive(), Invalid start signature (0x%1)").arg(sig,8,16).toLatin1() );
+ syncError = true;
+ return false;
+ } else {
+ stream >> rx_version; // FIXME: something should be done to verify the version.
+ stream >> msg->m_msg_id;
+ stream >> msg->m_len;
+ msg->m_phase++;
+ }
+ }
+ }
+
+ if (msg->m_phase == uint(1)) {
+ if (bytesAvailable() >= msg->m_len) {
+ stream >> msg->m_event;
+ msg->m_phase++;
+ }
+ }
+
+ if (msg->m_phase == uint(2)) {
+ if (bytesAvailable() >= sizeof( msg->m_len )) {
+ stream >> msg->m_len;
+ msg->m_phase++;
+ }
+ }
+
+ if (msg->m_phase == uint(3)) {
+ if (msg->m_len > 0) {
+ QByteArray buf;
+ quint32 len = msg->m_len;
+ uint bytes_available = bytesAvailable();
+ if (bytes_available < len)
+ len = bytes_available;
+ buf.resize( len );
+ stream.readRawData( buf.data(), len );
+
+ static QMap<QTestMessage*, QByteArray> data;
+ data[msg].append(buf);
+
+ msg->m_len -= len;
+ if (msg->m_len == 0) {
+ QDataStream s(&data[msg], QIODevice::ReadOnly);
+ s >> msg->m_map;
+ data.remove(msg);
+ msg->m_phase++;
+ // received OK
+ } else {
+ // waiting for more data
+ return false;
+ }
+ } else {
+ msg->m_phase++;
+ }
+ }
+
+ if (msg->m_phase == uint(4)) {
+ quint32 id2;
+ if (bytesAvailable() >= sizeof( id2 )) {
+ stream >> id2;
+ msg->m_phase = 0;
+ if (id2 != TEST_MSG_END) {
+ qWarning( QString("QTestMessage::receive(), Invalid end signature (0x%2)").arg(id2,8,16).toLatin1() );
+ syncError = true;
+ return false;
+ } else {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+bool QTestProtocol::rxBusy()
+{
+ return rx_busy;
+}
+
+/*!
+ Reads the remote control connection and responds to received commands.
+*/
+
+void QTestProtocol::onData()
+{
+ if (onData_busy) return;
+ onData_busy = true;
+
+ int sync_error_count = 0;
+ bool msg_received = true;
+ while (msg_received && bytesAvailable() > 0) {
+ msg_received = false;
+ // set the time to now :-)
+ rx_timer.start();
+ ping_timeout_warning_issued = false;
+
+ bool sync_error;
+ if (cur_message == 0)
+ cur_message = new QTestMessage();
+
+ if (receive( cur_message, sync_error )) {
+ msg_received = true;
+ QString last_event = cur_message->event();
+
+ if (debug_on) {
+ qLog(QtUitest) << ( QString("%1 QTestProtocol::onData(%2) msgid = %3").
+ arg(uniqueId()).
+ arg(last_event).
+ arg(cur_message->m_msg_id).
+ toLatin1());
+ }
+
+ // We received a full message
+ if (last_event == "@REPLY@") {
+ send_msg_replies.append( cur_message ); // add the reply to a list
+ int id = cur_message->m_msg_id;
+ QTestMessage *received_message(cur_message);
+ cur_message = 0; // and make sure we create a new one
+ emit replyReceived( id, received_message );
+ } else if (last_event == "QTEST_NEW_CONNECTION") {
+ postMessage( QTestMessage("QTEST_ACK_CONNECTION") ); // Acknowledge the other side we can receive data
+ } else if (last_event == "QTEST_ACK_CONNECTION") {
+ connection_valid = true; // we don't assume we have a connection until both sides have actually received data from the other side
+ onConnected();
+ connect_timer.stop();
+ } else if (last_event == "QTEST_CLOSING_CONNECTION") {
+ last_data_received = true;
+ QTimer::singleShot( 0, this, SLOT(onSocketClosed()));
+ } else if (last_event == "PONG") {
+ // Do nothing
+ } else if (last_event == "TEST") {
+ if (!debug_on) {
+ // don't show the same information twice
+ qLog(QtUitest) << QString("%1 Test message received").arg(uniqueId()).toLatin1();
+ }
+ } else if (last_event == "PING") {
+ postMessage( QTestMessage("PONG") );
+ } else {
+ unhandled_msg.append( cur_message ); // add the msg to a list
+ cur_message = 0;
+ QTimer::singleShot(0,this,SLOT(processMessages()));
+ }
+
+ delete cur_message;
+ cur_message = 0;
+ } else {
+ // We didn't receive a full message
+ if (sync_error) {
+ sync_error_count++;
+ if (sync_error_count > 10)
+ return;
+ // receiving garbage messages - nothing can be done but closing the connection and try again.
+ delete cur_message;
+ cur_message = 0;
+ disconnect(!enable_reconnect);
+ reconnect();
+ }
+ // else we are waiting on more fragments to arrive
+ }
+ }
+ onData_busy = false;
+}
+
+void QTestProtocol::processMessages()
+{
+ while (!rx_busy && unhandled_msg.count() > 0) {
+ QTestMessage *tmp = unhandled_msg.takeFirst();
+ if (tmp) {
+ rx_busy = true;
+ processMessage( tmp );
+ delete tmp;
+ rx_busy = false;
+ }
+ }
+}
+
+/*!
+ Signals the instance that the other side has closed the connection.
+*/
+void QTestProtocol::onSocketClosed()
+{
+ if (debug_on) {
+ qLog(QtUitest) << QString("%1 QTestProtocol::onSocketClosed()").arg(uniqueId()).toLatin1();
+ }
+
+ // we can't send any more messages so disable pinging
+ enablePing( false );
+
+ // anything that is still in the tx buffer gets lost
+ abort();
+
+ close();
+
+ connection_valid = false;
+
+ // if the close was spontaneous and we want to keep the connection alive, we try to reconnect
+ if (enable_reconnect) {
+ if (debug_on) {
+ qLog(QtUitest) <<
+ QString("%1 QTestProtocol::onSocketClosed() singleshot reconnect in .5 seconds").arg(uniqueId()).toLatin1();
+ }
+ QTimer::singleShot(500,this,SLOT(reconnect()));
+ }
+
+ // tell the world we are closed
+ QTimer::singleShot(0, this, SLOT(emitConnectionClosed()));
+}
+
+/*!
+ Signals the instance that a connection is established with a remote control host.
+*/
+void QTestProtocol::onSocketConnected()
+{
+ connect_timer.stop();
+ if (debug_on) {
+ qLog(QtUitest) << QString("%1 QTestProtocol::onSocketConnected()").arg(uniqueId()).toLatin1();
+ }
+ testConnection();
+}
+
+void QTestProtocol::reconnect()
+{
+ if (host != "" && state() != ConnectedState) {
+ if (debug_on) {
+ qLog(QtUitest) << QString("%1 QTestProtocol::reconnect()").arg(uniqueId()).toLatin1();
+ }
+
+ connect_timer.stop();
+ connect_timer.start( CONNECT_TIMEOUT );
+
+ // if we are trying to connect to the local machine, always use 127.0.0.1
+ // (and avoid the need for dns)
+ QString hostname = QHostInfo::localHostName().toUpper();
+ if (hostname == host.toUpper() || hostname.startsWith( host.toUpper() + "." ))
+ host = "127.0.0.1";
+
+ close();
+ connectToHost( host, port );
+ } else {
+ if (host == "") {
+ qWarning( "QTestProtocol::reconnect() FAILED, no host specified" );
+ enable_reconnect = false;
+ }
+ }
+}
+
+void QTestProtocol::connectTimeout()
+{
+ if (debug_on) {
+ qLog(QtUitest) << QString("%1 QTestProtocol::connectTimeout()").arg(uniqueId()).toLatin1();
+ }
+
+ connect_timer.stop();
+ if (enable_reconnect) {
+ reconnect();
+ } else {
+ onConnectionFailed( errorStr() );
+ }
+}
+
+void QTestProtocol::pingTimeout()
+{
+ if (!ping_enabled) return;
+
+ if (state() == ConnectedState) {
+ int elapsed = rx_timer.elapsed();
+ if (state() == ClosingState) {
+ if (elapsed > 30000) { // no activity for x seconds when we are closing?
+ enablePing( false );
+ if (enable_reconnect) {
+ disconnect();
+ // close has reset the enable_reconnect value, so enable it again
+ enableReconnect( true, reconnect_interval );
+ reconnect();
+ } else {
+ disconnect();
+ }
+ } else if (elapsed > 2000 ) {
+ postMessage( QTestMessage("PING") );
+ }
+ } else {
+ if (elapsed > 10000) {
+ postMessage( QTestMessage("PING") );
+ if (elapsed > 300000) { // no activity for 5 minutes in 'normal' cases??
+ if (!ping_timeout_warning_issued)
+ qWarning( QString("%1 QTestProtocol::pingTimeout() WARNING: Did not receive a msg for %2 ms").arg(uniqueId()).arg(elapsed).toLatin1() );
+ ping_timeout_warning_issued = true;
+ }
+ }
+ }
+ } else {
+ if (enable_reconnect) {
+ // Connection seems to be closed, try to reconnect
+ disconnect();
+
+ // disconnect has reset the enable_reconnect value, so enable it again
+ enableReconnect( true, reconnect_interval );
+ reconnect();
+ }
+ }
+}
+
+void QTestProtocol::emitConnectionClosed()
+{
+ if (debug_on) {
+ qLog(QtUitest) << ( QString("%1 QTestProtocol::emitConnectionClosed()").arg(uniqueId()).toLatin1());
+ }
+
+ emit replyReceived(); // force sendMessage to quit
+ emit connectionClosed( this );
+}
+
+void QTestProtocol::enablePing( bool enable )
+{
+ if (ping_enabled != enable) {
+ ping_timer.stop();
+ ping_enabled = enable;
+ if (enable) {
+ QObject::connect( &ping_timer, SIGNAL(timeout()), this, SLOT(pingTimeout()), Qt::DirectConnection );
+ ping_timer.start( ping_interval );
+ } else {
+ QObject::disconnect( &ping_timer, SIGNAL(timeout()), this, SLOT(pingTimeout()) );
+ }
+ }
+}
+
+QString QTestProtocol::uniqueId()
+{
+ return QString("%1 %2").arg(unique_id).arg(qApp->applicationName());
+}
+
+void QTestProtocol::enableDebug( bool debugOn )
+{
+ debug_on = debugOn;
+ qLog(QtUitest) << QString("Debugging is switched %1 for Test Protocol %2").arg(debugOn ? "ON" : "OFF").arg(uniqueId()).toLatin1() ;
+}
+
+void QTestProtocol::disableDebug()
+{
+ debug_on = false;
+ qLog(QtUitest) << QString("Debugging is switched %1 for Test Protocol %2").arg(debug_on ? "ON" : "OFF").arg(uniqueId()).toLatin1() ;
+}
+
diff --git a/libqtuitest/qtestprotocol_p.h b/libqtuitest/qtestprotocol_p.h
new file mode 100644
index 0000000..ca274f3
--- /dev/null
+++ b/libqtuitest/qtestprotocol_p.h
@@ -0,0 +1,228 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTESTPROTOCOL_P_H
+#define QTESTPROTOCOL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtUiTest API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QTimer>
+#include <QTime>
+#include <QObject>
+#include <QString>
+#include <QFile>
+#include <QVariant>
+#include <QMap>
+#include <QtNetwork/QTcpSocket>
+#include <QtNetwork/QTcpServer>
+#include <qtuitestglobal.h>
+
+#include "qtuitestelapsedtimer_p.h"
+
+#define REMOTE_CONNECT_ERROR 99
+
+class QTUITEST_EXPORT QTestMessage
+{
+public:
+ QTestMessage(QString const &event = QString(), QVariantMap const &map = QVariantMap() );
+ QTestMessage(QString const &event, const QTestMessage &other );
+ QTestMessage(QString const &event, QString const &queryApp, QString const &queryPath = QString() );
+ QTestMessage(const QTestMessage &other);
+ virtual ~QTestMessage();
+
+ QTestMessage& operator=(const QTestMessage &other);
+
+ QString event() const;
+ quint16 msgId() const;
+
+ QVariant const operator[](QString const &key) const;
+ QVariant &operator[](QString const &key);
+ bool contains(QString const &key) const;
+ QList<QString> keys() const;
+
+ QString toString() const;
+
+ bool statusOK() const;
+ bool isNull() const;
+
+protected:
+ uint m_phase;
+ quint32 m_len;
+
+ quint16 m_msg_id;
+ QString m_event;
+
+ QVariantMap m_map;
+
+ friend class QTestProtocol;
+};
+Q_DECLARE_METATYPE( QTestMessage )
+Q_DECLARE_METATYPE( QTestMessage* )
+Q_DECLARE_METATYPE( const QTestMessage* )
+
+class QTUITEST_EXPORT QTestServerSocket : public QTcpServer
+{
+ Q_OBJECT
+public:
+ QTestServerSocket( quint16 port, int backlog = 1 );
+ virtual ~QTestServerSocket();
+
+ bool ok() const;
+ quint16 port() const;
+ QString address() const;
+
+ virtual void onNewConnection( int socket ) = 0;
+
+private:
+ virtual void incomingConnection( int socket );
+};
+
+class QTUITEST_EXPORT QTestProtocol : public QTcpSocket
+{
+ Q_OBJECT
+public:
+
+ QTestProtocol();
+ virtual ~QTestProtocol();
+
+ virtual void setSocket( int socket );
+
+ void enableReconnect( bool enable, uint reconnectInterval = 5000 );
+
+ void connect( const QString& hostname, int port );
+ void disconnect( bool disableReconnect = true );
+ bool isConnected();
+ virtual bool waitForConnected( int timeout = 10000 );
+
+ virtual uint postMessage( QTestMessage const &message );
+
+ virtual bool sendMessage( QTestMessage const &message, QTestMessage &reply, int timeout );
+ virtual void replyMessage( QTestMessage *originalMsg, QTestMessage const &message );
+
+ bool lastDataReceived();
+ bool rxBusy();
+ virtual void onReplyReceived( QTestMessage *reply );
+
+ QString errorStr();
+
+ virtual void onConnectionFailed( const QString &reason );
+ virtual void onConnected() {}; // re-implement in derived class
+
+ QString uniqueId();
+ void enableDebug( bool debugOn );
+
+public slots:
+ void reconnect();
+ void disableDebug();
+
+protected:
+ virtual void processMessage( QTestMessage *msg ) = 0;
+
+ void send( QTestMessage const &message );
+ static void sendPreamble( QDataStream *ds, quint16 msgId, const QString &event );
+
+ bool receive( QTestMessage *msg, bool &syncError );
+
+signals:
+ void connectionClosed( QTestProtocol *socket );
+ void connectionFailed( QTestProtocol *socket, const QString &reason );
+ void replyReceived(int id = -1, QTestMessage const *message = 0);
+ void replyConfirmed();
+
+protected slots:
+ void onData();
+ void onSocketConnected();
+ void onSocketClosed();
+ void connectTimeout();
+ void pingTimeout();
+ void emitConnectionClosed();
+ void processMessages();
+ void testConnection();
+
+private:
+ void enablePing( bool enable );
+
+ quint16 tx_msg_id;
+ QString host;
+ int port;
+ bool onData_busy;
+ bool enable_reconnect;
+ uint reconnect_interval;
+ QTimer connect_timer;
+ QtUiTestElapsedTimer rx_timer;
+ bool last_data_received;
+ bool rx_busy;
+ bool connection_valid;
+
+ QList<QTestMessage*> send_msg_replies;
+ QList<QTestMessage*> unhandled_msg;
+ QTestMessage *cur_message;
+
+ bool ping_enabled;
+ uint ping_interval;
+ QTimer ping_timer;
+ uint ping_count;
+ bool ping_timeout_warning_issued;
+ QString last_send_cmd;
+ QString unique_id;
+ bool debug_on;
+};
+
+#define TAB_BAR_ALIAS ">@TAB_BAR@<"
+#define OPTIONS_MENU_ALIAS ">@OPTIONS_MENU@<"
+#define LAUNCHER_MENU_ALIAS ">@LAUNCHER_MENU@<" // launcher menu _can_ be a grid menu, but also a wheel menu, etc
+#define SOFT_MENU_ALIAS ">@SOFT_MENU@<"
+#define PROGRESS_BAR_ALIAS ">@PROGRESS_BAR@<"
+#define CALL_ACCEPT_ALIAS ">@CALL_ACCEPT@<"
+#define CALL_HANGUP_ALIAS ">@CALL_HANGUP@<"
+#define MENU_BAR_ALIAS ">@MENU_BAR@<"
+
+#endif
+
diff --git a/libqtuitest/qtuitestconnectionmanager.cpp b/libqtuitest/qtuitestconnectionmanager.cpp
new file mode 100644
index 0000000..f7ae638
--- /dev/null
+++ b/libqtuitest/qtuitestconnectionmanager.cpp
@@ -0,0 +1,165 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qtuitestconnectionmanager_p.h"
+
+#include <QCoreApplication>
+#include <QObject>
+#include <QThread>
+
+// from qobject_p.h
+struct QSignalSpyCallbackSet
+{
+ typedef void (*BeginCallback)(QObject*,int,void**);
+ typedef void (*EndCallback)(QObject*,int);
+ BeginCallback signal_begin_callback,
+ slot_begin_callback;
+ EndCallback signal_end_callback,
+ slot_end_callback;
+};
+extern void Q_CORE_EXPORT qt_register_signal_spy_callbacks(QSignalSpyCallbackSet const&);
+void qtuitest_signal_begin(QObject*,int,void**);
+
+Q_GLOBAL_STATIC(QtUiTestConnectionManager,_q_qtUiTestConnectionManager);
+
+QtUiTestConnectionManager::QtUiTestConnectionManager()
+{
+ QSignalSpyCallbackSet callbacks = { qtuitest_signal_begin, 0, 0, 0 };
+ qt_register_signal_spy_callbacks(callbacks);
+}
+
+QtUiTestConnectionManager::~QtUiTestConnectionManager()
+{
+ QSignalSpyCallbackSet callbacks = { 0, 0, 0, 0 };
+ qt_register_signal_spy_callbacks(callbacks);
+}
+
+void qtuitestconnectionmanager_cleanup()
+{ delete _q_qtUiTestConnectionManager(); }
+
+QtUiTestConnectionManager* QtUiTestConnectionManager::instance()
+{
+ return _q_qtUiTestConnectionManager();
+}
+
+void qtuitest_signal_begin(QObject* sender, int signal, void** argv)
+{
+ QtUiTestConnectionManager* cm = QtUiTestConnectionManager::instance();
+
+ // Should only ever be null when the application is shutting down, but in that case,
+ // this callback should already have been unregistered.
+ Q_ASSERT(cm);
+
+ // During the destructor it isn't safe to check which thread we are.
+ // We'll just ignore all signals during this time.
+ if (QCoreApplication::closingDown()) return;
+
+ // Connections are only supported in the main thread.
+ if (QThread::currentThread() != QCoreApplication::instance()->thread()) return;
+
+ cm->activateConnections(sender,signal,argv);
+}
+
+void QtUiTestConnectionManager::connect(QObject const* sender, int senderMethod,
+ QObject const* receiver, int receiverMethod)
+{
+ Q_ASSERT(QThread::currentThread() == QCoreApplication::instance()->thread());
+
+ Connection c = {
+ const_cast<QObject*>(sender), senderMethod,
+ const_cast<QObject*>(receiver), receiverMethod
+ };
+ m_connections << c;
+}
+
+bool QtUiTestConnectionManager::disconnect(QObject const* sender, int senderMethod,
+ QObject const* receiver, int receiverMethod)
+{
+ Q_ASSERT(QThread::currentThread() == QCoreApplication::instance()->thread());
+
+ bool ret = false;
+
+ QList<Connection>::iterator iter = m_connections.begin();
+ while (iter != m_connections.end())
+ {
+ bool remove = true;
+
+ if (sender && (sender != iter->sender)) remove = false;
+ if ((senderMethod != -1) && (senderMethod != iter->senderMethod)) remove = false;
+ if (receiver && (receiver != iter->receiver)) remove = false;
+ if ((receiverMethod != -1) && (receiverMethod != iter->receiverMethod)) remove = false;
+
+ if (remove) {
+ ret = true;
+ iter = m_connections.erase(iter);
+ }
+ else {
+ ++iter;
+ }
+ }
+
+ return ret;
+}
+
+void QtUiTestConnectionManager::activateConnections(QObject* sender, int senderMethod, void** argv)
+{
+ static const int destroyedMethod = QObject::staticMetaObject.indexOfSignal("destroyed(QObject*)");
+ const bool destroyed = (senderMethod == destroyedMethod);
+
+ // Find all of the connections we need to activate.
+ QList<Connection> toActivate;
+ QList<Connection>::iterator iter = m_connections.begin();
+ while (iter != m_connections.end())
+ {
+ if (sender == iter->sender && senderMethod == iter->senderMethod)
+ toActivate << *iter;
+
+ // Remove this connection if either the sender or receiver is being destroyed
+ if (destroyed && (sender == iter->sender || sender == iter->receiver))
+ iter = m_connections.erase(iter);
+ else
+ ++iter;
+ }
+
+ foreach (Connection const& c, toActivate)
+ { c.receiver->qt_metacall(QMetaObject::InvokeMetaMethod, c.receiverMethod, argv); }
+}
+
diff --git a/libqtuitest/qtuitestconnectionmanager_p.h b/libqtuitest/qtuitestconnectionmanager_p.h
new file mode 100644
index 0000000..13a1017
--- /dev/null
+++ b/libqtuitest/qtuitestconnectionmanager_p.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTUITESTCONNECTIONMANAGER_P_H
+#define QTUITESTCONNECTIONMANAGER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtUiTest API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QList>
+#include <qtuitestglobal.h>
+
+class QObject;
+
+class QTUITEST_EXPORT QtUiTestConnectionManager
+{
+public:
+ static QtUiTestConnectionManager* instance();
+
+ void connect (QObject const*,int,QObject const*,int);
+ bool disconnect(QObject const*,int,QObject const*,int);
+
+ QtUiTestConnectionManager();
+ ~QtUiTestConnectionManager();
+
+ void activateConnections(QObject*,int,void**);
+
+ struct Connection {
+ QObject* sender;
+ int senderMethod;
+ QObject* receiver;
+ int receiverMethod;
+ };
+ QList<Connection> m_connections;
+};
+
+#endif
+
diff --git a/libqtuitest/qtuitestelapsedtimer.cpp b/libqtuitest/qtuitestelapsedtimer.cpp
new file mode 100644
index 0000000..5e9a593
--- /dev/null
+++ b/libqtuitest/qtuitestelapsedtimer.cpp
@@ -0,0 +1,103 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qtuitestelapsedtimer_p.h"
+
+#include <time.h>
+#include <errno.h>
+#include <string.h>
+#include <QtGlobal>
+
+/*!
+ \internal
+ \class QtUiTestElapsedTimer
+ \inpublicgroup QtUiTestModule
+
+ QtUiTestElapsedTimer provides a lightweight
+ subset of the QTime API while keeping correct time even if the system time
+ is changed.
+*/
+
+int qtuitestelapsedtimer_gettime() {
+#if _POSIX_TIMERS
+ struct timespec tms;
+ if (-1 == clock_gettime(
+#ifdef _POSIX_MONOTONIC_CLOCK
+ CLOCK_MONOTONIC
+#else
+ CLOCK_REALTIME
+#endif
+ , &tms)) {
+ qFatal("QtUitest: clock_gettime failed: %s",
+ strerror(errno));
+ }
+ return tms.tv_sec*1000 + tms.tv_sec/1000000;
+#else
+ /*
+ FIXME: won't keep correct time if system time is changed during test.
+ Should warn about this?
+ */
+ return time(0)*1000;
+#endif
+}
+
+/*!
+ Creates a new timer.
+ start() is automatically called on the new timer.
+*/
+QtUiTestElapsedTimer::QtUiTestElapsedTimer()
+{ start(); }
+
+/*!
+ Starts or restarts the timer.
+*/
+void QtUiTestElapsedTimer::start()
+{ start_ms = qtuitestelapsedtimer_gettime(); }
+
+/*!
+ Returns the elapsed time (in milliseconds) since start() was called.
+
+ This function returns the correct value even if the system time has
+ been changed. The value may overflow, however.
+ */
+int QtUiTestElapsedTimer::elapsed()
+{ return qtuitestelapsedtimer_gettime() - start_ms; }
+
diff --git a/libqtuitest/qtuitestelapsedtimer_p.h b/libqtuitest/qtuitestelapsedtimer_p.h
new file mode 100644
index 0000000..1536d88
--- /dev/null
+++ b/libqtuitest/qtuitestelapsedtimer_p.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTUITESTELAPSEDTIMER_P_H
+#define QTUITESTELAPSEDTIMER_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtUiTest API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <qtuitestglobal.h>
+
+class QTUITEST_EXPORT QtUiTestElapsedTimer
+{
+public:
+ QtUiTestElapsedTimer();
+
+ void start();
+ int elapsed();
+
+private:
+ int start_ms;
+};
+
+#endif
+
diff --git a/libqtuitest/qtuitestglobal.h b/libqtuitest/qtuitestglobal.h
new file mode 100644
index 0000000..cb46581
--- /dev/null
+++ b/libqtuitest/qtuitestglobal.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTUITEST_GLOBAL_H
+#define QTUITEST_GLOBAL_H
+
+#include <QtGlobal>
+
+#if defined(Q_OS_WIN32)
+# if defined(QTUITEST_TARGET)
+# define QTUITEST_EXPORT Q_DECL_EXPORT
+# else
+# define QTUITEST_EXPORT Q_DECL_IMPORT
+# endif
+# if defined(QTSLAVE_TARGET)
+# define QTSLAVE_EXPORT Q_DECL_EXPORT
+# else
+# define QTSLAVE_EXPORT Q_DECL_IMPORT
+# endif
+#else
+# define QTUITEST_EXPORT Q_DECL_EXPORT
+# define QTSLAVE_EXPORT Q_DECL_EXPORT
+#endif
+
+#if defined(Q_OS_WIN32) || defined(Q_OS_SYMBIAN)
+# if defined(QSYSTEMTEST_TARGET)
+# define QSYSTEMTEST_EXPORT Q_DECL_EXPORT
+# else
+# define QSYSTEMTEST_EXPORT Q_DECL_IMPORT
+# endif
+# if defined(QTUITESTRUNNER_TARGET)
+# define QTUITESTRUNNER_EXPORT Q_DECL_EXPORT
+# else
+# define QTUITESTRUNNER_EXPORT Q_DECL_IMPORT
+# endif
+#else
+# define QSYSTEMTEST_EXPORT Q_DECL_EXPORT
+# define QTUITESTRUNNER_EXPORT Q_DECL_EXPORT
+#endif
+
+#endif
+
diff --git a/libqtuitest/qtuitestnamespace.cpp b/libqtuitest/qtuitestnamespace.cpp
new file mode 100644
index 0000000..09d838f
--- /dev/null
+++ b/libqtuitest/qtuitestnamespace.cpp
@@ -0,0 +1,1085 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qtuitestnamespace.h"
+
+#include "qalternatestack_p.h"
+#include "qtuitestelapsedtimer_p.h"
+#include "qeventwatcher_p.h"
+#include "qtuitestconnectionmanager_p.h"
+#include "qtuitestwidgets_p.h"
+
+#include <QAction>
+#include <QDebug>
+#include <QEventLoop>
+#include <QKeyEvent>
+#include <QKeySequence>
+#include <QPointer>
+#include <QTimer>
+
+/*
+ A simple auto pointer class which deletes the pointed-to QObject
+ later via deleteLater()
+*/
+template <typename T>
+class QDelayedAutoPointer
+{
+public:
+ inline QDelayedAutoPointer(T* thing)
+ : raw(thing)
+ {}
+ inline ~QDelayedAutoPointer()
+ {
+ QObject::disconnect(raw, 0, 0, 0);
+ raw->deleteLater();
+ }
+
+ inline T* operator->()
+ { return raw; }
+
+ inline operator T*()
+ { return raw; }
+
+private:
+ T* raw;
+};
+
+/*
+ A helper class to encapsulate generation of input events
+*/
+struct QtUiTestInput
+{
+ virtual ~QtUiTestInput() {}
+ virtual void post() const =0;
+ virtual QString toString() const =0;
+};
+
+
+namespace QtUiTest {
+ QString objectName(QObject* obj)
+ {
+ QString ret = obj->objectName();
+ QAction* act(0);
+ if (ret.isEmpty() && (act = qobject_cast<QAction*>(obj))) {
+ ret = act->text();
+ if (ret.isEmpty()) ret = act->iconText();
+ }
+ return ret;
+ }
+ QString toString(QObject* obj)
+ {
+ if (!obj) return "QObject(0x0)";
+ return QString("%1(0x%2 \"%3\")")
+ .arg(obj->metaObject()->className())
+ .arg(QString::number(qptrdiff(obj), 16))
+ .arg(objectName(obj))
+ ;
+ }
+
+ QString toString(QEvent::Type type)
+ {
+#define DO(A) if (type == QEvent::A) return #A
+ DO(KeyPress);
+ DO(KeyRelease);
+ DO(MouseButtonPress);
+ DO(MouseButtonRelease);
+ DO(Show);
+ DO(Hide);
+ DO(FocusIn);
+ DO(FocusOut);
+#ifdef QT_KEYPAD_NAVIGATION
+ DO(EnterEditFocus);
+ DO(LeaveEditFocus);
+#endif
+ DO(WindowBlocked);
+#undef DO
+ return QString::number(int(type));
+ }
+
+ QString toString(QList<QEvent::Type> const& types)
+ {
+ QString ret;
+ QString sep;
+ foreach (QEvent::Type type, types) {
+ ret += sep + toString(type);
+ sep = ",";
+ }
+ return ret;
+ }
+
+ QString toString(Qt::Key key)
+ { return QKeySequence(key).toString(); }
+
+ QString toString(QPoint const& pos)
+ { return QString("(%1,%2)").arg(pos.x()).arg(pos.y()); }
+
+ QString toString(Qt::MouseButtons const& buttons)
+ {
+ QStringList ret;
+#define DO(A) if (buttons & Qt::A) ret << #A
+ DO(LeftButton);
+ DO(RightButton);
+ DO(MidButton);
+ DO(XButton1);
+ DO(XButton2);
+#undef DO
+ return ret.join(",");
+ }
+
+ bool keyClick(QObject*, QList<QEvent::Type> const&, int, Qt::KeyboardModifiers,
+ QtUiTest::InputOption);
+ bool mouseClick(QObject*, QList<QEvent::Type> const&, QPoint const&, Qt::MouseButtons,
+ QtUiTest::InputOption);
+ bool inputWithEvent(QObject*, QList<QEventWatcherFilter*> const&, QtUiTestInput const&);
+ bool inputWithSignal(QObject*, QByteArray const&, QtUiTestInput const&);
+};
+
+struct QtUiTestKeyClick : public QtUiTestInput
+{
+ QtUiTestKeyClick(Qt::Key key, Qt::KeyboardModifiers modifiers, QtUiTest::InputOption options)
+ : m_key(key), m_modifiers(modifiers), m_options(options)
+ {}
+
+ virtual void post() const
+ { QtUiTest::keyClick(m_key, m_modifiers, m_options); }
+
+ virtual QString toString() const
+ { return QString("Key click \"%1\"").arg(QtUiTest::toString(m_key)); }
+
+ Qt::Key m_key;
+ Qt::KeyboardModifiers m_modifiers;
+ QtUiTest::InputOption m_options;
+};
+
+struct QtUiTestMouseClick : public QtUiTestInput
+{
+ QtUiTestMouseClick(QPoint const& pos, Qt::MouseButtons buttons, QtUiTest::InputOption options)
+ : m_pos(pos), m_buttons(buttons), m_options(options)
+ {}
+
+ virtual void post() const
+ { QtUiTest::mouseClick(m_pos, m_buttons, m_options); }
+
+ virtual QString toString() const
+ {
+ return QString("Mouse click \"%1\" at %2")
+ .arg(QtUiTest::toString(m_buttons))
+ .arg(QtUiTest::toString(m_pos))
+ ;
+ }
+
+ QPoint const& m_pos;
+ Qt::MouseButtons m_buttons;
+ QtUiTest::InputOption m_options;
+};
+
+/*
+ Filter which implements watching for events of a specific type.
+*/
+class QEventWatcherTypeFilter : public QEventWatcherFilter
+{
+public:
+ QEventWatcherTypeFilter(QEvent::Type type)
+ : m_type(type)
+ {}
+
+protected:
+ virtual bool accept(QObject*,QEvent* e) const
+ { return e->type() == m_type; }
+
+ virtual QString toString() const
+ { return QString("event of type %1").arg(QtUiTest::toString(m_type)); }
+
+private:
+ QEvent::Type m_type;
+};
+
+/*
+ Filter which implements watching for specific key events.
+*/
+
+class QEventWatcherKeyFilter : public QEventWatcherTypeFilter
+{
+public:
+ QEventWatcherKeyFilter(Qt::Key key, QEvent::Type type)
+ : QEventWatcherTypeFilter(type)
+ , m_key(key)
+ {}
+
+ static QEvent::Type keyPressType()
+ { static int ret = QEvent::registerEventType(); return QEvent::Type(ret); }
+
+ static QEvent::Type keyReleaseType()
+ { static int ret = QEvent::registerEventType(); return QEvent::Type(ret); }
+
+protected:
+ virtual bool accept(QObject* o, QEvent* e) const
+ {
+ if (!QEventWatcherTypeFilter::accept(o,e))
+ return false;
+ if (e->type() != QEvent::KeyPress && e->type() != QEvent::KeyRelease)
+ return false;
+ return static_cast<QKeyEvent*>(e)->key() == m_key;
+ }
+
+ virtual QString toString() const
+ {
+ return QString("%1 (key:%2)")
+ .arg(QEventWatcherTypeFilter::toString())
+ .arg(QtUiTest::toString(m_key));
+ }
+
+private:
+ Qt::Key m_key;
+};
+
+
+/*!
+ \preliminary
+ \namespace QtUiTest
+ \inpublicgroup QtUiTestModule
+
+ \brief The QtUiTest namespace provides the plugin interfaces used for
+ customizing the behaviour of QtUiTest.
+
+ When running a \l{QSystemTest}{QtUiTest system test}, functions such as
+ \l{QSystemTest::}{select()} and \l{QSystemTest::}{getText()} are used to
+ perform actions and retrieve information from widgets.
+ This is implemented by wrapping each conceptual widget (which is not
+ necessarily a QWidget) with a test widget class.
+
+ These test widgets each implement one or more of the widget interfaces
+ in the QtUiTest namespace. The interfaces are used to determine
+ what actions can be taken on a particular widget, and how to perform
+ them.
+
+ For example, when the following system test code executes:
+ \code
+ select("Dog", "Favorite Animal");
+ \endcode
+
+ QtUiTest will first look up the QWidget which is labelled by the
+ text "Favorite Animal". It will then use qtuitest_cast to cast
+ this widget to a QtUiTest::SelectWidget. If this is successful, it
+ will then call \l{QtUiTest::SelectWidget::select()}{select("Dog")}
+ on the list widget.
+
+ It is possible to customize the behavior of QtUiTest for particular
+ widgets by creating custom test widget classes and a
+ QtUiTest::WidgetFactory factory class to wrap QObject instances in
+ test widgets.
+*/
+
+/*!
+ \fn T QtUiTest::qtuitest_cast_helper(QObject* object,T dummy)
+ \internal
+*/
+
+/*!
+ \relates QtUiTest
+ \fn T qtuitest_cast(const QObject *object)
+
+ Casts \a object to the specified QtUiTest test widget interface \c{T}.
+
+ If \a object already implements \c{T}, it is simply casted and returned.
+ Otherwise, QtUiTest will attempt to find or create a test widget to
+ wrap \a object, using all loaded QtUiTest::WidgetFactory plugins.
+ If a test widget cannot be created to wrap \a object, 0 is returned.
+
+ In either case, the returned value must not be deleted by the caller.
+
+ Example:
+ \code
+ // Attempt to select the item "Foo" from the given widget
+ bool selectFoo(QWidget *widget) {
+ QtUiTest::SelectWidget* sw
+ = qtuitest_cast<QtUiTest::SelectWidget*>(widget);
+ if (!sw || !sw->canSelect("Foo")) {
+ return false;
+ }
+ return sw->select("Foo");
+ }
+ \endcode
+*/
+
+
+/*!
+ \enum QtUiTest::InputOption
+
+ This enum type specifies the options to be used when simulating key
+ and mouse events.
+
+ \value NoOptions no options.
+ \value DemoMode when simulating, force artificial delays between key
+ and mouse events, and animate some events.
+ \value KeyRepeat when simulating key press events, simulate auto-repeat
+ key press events. The default is to simulate regular key
+ press events.
+*/
+
+/*!
+ \enum QtUiTest::WidgetType
+
+ This enum type specifies different types of widgets which can be retrieved
+ via QtUiTest::findWidget().
+
+ \value Focus The widget which currently has keyboard focus. Note that this
+ need not be located in the current application.
+ \value InputMethod A currently active input method widget.
+ \value SoftMenu A currently displayed \l{QSoftMenuBar}{soft menu bar}.
+ \value OptionsMenu The context/options menu which is currently shown, or
+ would be shown if the user attempted to raise a context
+ menu (typically by pressing Qt::Key_Context1).
+ \value TabBar The \l{QTabBar}{tab bar} for the currently active
+ \l{QTabWidget}{tab widget}, if one exists.
+ QtUiTest is not designed to handle multiple nested
+ tab widgets.
+ \value HomeScreen The home screen widget.
+ \value Launcher The widget (typically a grid-like menu) in the server
+ process used for launching applications.
+*/
+
+/*!
+ \enum QtUiTest::Key
+
+ This enum provides mappings for high-level conceptual keys to platform-specific
+ values of Qt::Key.
+
+ \value Key_Activate Key used to activate generic UI elements.
+ \value Key_ActivateButton Key used to activate buttons.
+ \value Key_Select Key used to select an item from lists.
+*/
+
+/*!
+ Set or clear the specified \a option for subsequent simulated input
+ events. The option is set if \a on is true, otherwise it is cleared.
+*/
+void QtUiTest::setInputOption(QtUiTest::InputOption option, bool on)
+{ QtUiTestWidgets::instance()->setInputOption(option, on); }
+
+/*!
+ Returns true if \a option is currently set.
+*/
+bool QtUiTest::testInputOption(QtUiTest::InputOption option)
+{ return QtUiTestWidgets::instance()->testInputOption(option); }
+
+/*!
+ Simulate a mouse press event at the co-ordinates given by \a pos,
+ for the specified \a buttons. \a options are applied to the simulated
+ event.
+
+ \a pos is interpreted as local co-ordinates for the currently active
+ window in this application.
+*/
+void QtUiTest::mousePress(QPoint const& pos, Qt::MouseButtons buttons,
+ QtUiTest::InputOption options)
+{ QtUiTestWidgets::instance()->mousePress(pos, buttons, options); }
+
+
+/*!
+ Simulate a mouse release event at the global co-ordinates given by \a pos,
+ for the specified \a buttons. \a options are applied to the simulated
+ event.
+
+ \a pos is interpreted as local co-ordinates for the currently active
+ window in this application.
+*/
+void QtUiTest::mouseRelease(QPoint const& pos, Qt::MouseButtons buttons,
+ QtUiTest::InputOption options)
+{ QtUiTestWidgets::instance()->mouseRelease(pos, buttons, options); }
+
+/*!
+ Simulate a mouse click event at the global co-ordinates given by \a pos,
+ for the specified \a buttons. \a options are applied to the simulated
+ event.
+
+ \a pos is interpreted as local co-ordinates for the currently active
+ window in this application.
+*/
+void QtUiTest::mouseClick(QPoint const& pos, Qt::MouseButtons buttons,
+ QtUiTest::InputOption options)
+{ QtUiTestWidgets::instance()->mouseClick(pos, buttons, options); }
+
+/*!
+ \overload
+ Simulate a mouse click event.
+ Returns true if the event appears to be delivered to \a object within maximumUiTimeout()
+ milliseconds.
+ If it does not, the errorString() will be set accordingly.
+*/
+bool QtUiTest::mouseClick(QObject* object, QPoint const& pos, Qt::MouseButtons buttons,
+ QtUiTest::InputOption options)
+{
+ return mouseClick(object,
+ QList<QEvent::Type>() << QEvent::MouseButtonRelease << QEvent::Hide << QEvent::WindowBlocked,
+ pos, buttons, options
+ );
+}
+
+/*!
+ \internal
+*/
+bool QtUiTest::mouseClick(QObject* object, QList<QEvent::Type> const& types, QPoint const& pos,
+ Qt::MouseButtons buttons, QtUiTest::InputOption options)
+{
+ QList<QEventWatcherFilter*> filters;
+ foreach (QEvent::Type type, types) {
+ filters << new QEventWatcherTypeFilter(type);
+ }
+ return inputWithEvent(object, filters, QtUiTestMouseClick(pos, buttons, options));
+}
+
+/*!
+ \overload
+ Simulate a mouse click event.
+ Returns true if the event causes \a object to emit \a signal within maximumUiTimeout()
+ milliseconds.
+ If it does not, the errorString() will be set accordingly.
+*/
+bool QtUiTest::mouseClick(QObject* object, QByteArray const& signal, QPoint const& pos,
+ Qt::MouseButtons buttons, QtUiTest::InputOption options)
+{ return inputWithSignal(object, signal, QtUiTestMouseClick(pos, buttons, options)); }
+
+/*!
+ Simulate a key press event, using the given \a key and \a modifiers.
+ \a key must be a valid Qt::Key or QtUiTest::Key.
+ \a options are applied to the simulated event.
+*/
+void QtUiTest::keyPress(int key, Qt::KeyboardModifiers modifiers,
+ QtUiTest::InputOption options)
+{ QtUiTestWidgets::instance()->keyPress(static_cast<Qt::Key>(key), modifiers, options); }
+
+/*!
+ Simulate a key release event, using the given \a key and \a modifiers.
+ \a key must be a valid Qt::Key or QtUiTest::Key.
+ \a options are applied to the simulated event.
+*/
+void QtUiTest::keyRelease(int key, Qt::KeyboardModifiers modifiers,
+ QtUiTest::InputOption options)
+{ QtUiTestWidgets::instance()->keyRelease(static_cast<Qt::Key>(key), modifiers, options); }
+
+/*!
+ Simulate a key click event, using the given \a key and \a modifiers.
+ \a key must be a valid Qt::Key or QtUiTest::Key.
+ \a options are applied to the simulated event.
+*/
+void QtUiTest::keyClick(int key, Qt::KeyboardModifiers modifiers,
+ QtUiTest::InputOption options)
+{ QtUiTestWidgets::instance()->keyClick(static_cast<Qt::Key>(key), modifiers, options); }
+
+/*!
+ \overload
+ Simulate a key click event.
+ Returns true if the event appears to be delivered to \a object within maximumUiTimeout()
+ milliseconds.
+ If it does not, the errorString() will be set accordingly.
+*/
+bool QtUiTest::keyClick(QObject* object, int key, Qt::KeyboardModifiers modifiers,
+ QtUiTest::InputOption options)
+{
+ return keyClick(object,
+ QList<QEvent::Type>() << QEventWatcherKeyFilter::keyReleaseType()
+ << QEvent::Hide << QEvent::WindowBlocked << QEvent::Show,
+ key, modifiers, options
+ );
+}
+
+/*!
+ \internal
+*/
+bool QtUiTest::inputWithEvent(QObject* object, QList<QEventWatcherFilter*> const& filters,
+ QtUiTestInput const& event)
+{
+ QPointer<QObject> sender = object;
+ QDelayedAutoPointer<QEventWatcher> w = new QEventWatcher;
+ w->addObject(sender);
+ foreach (QEventWatcherFilter* filter, filters)
+ w->addFilter(filter);
+
+ event.post();
+
+ if (!w->count() && !QtUiTest::waitForSignal(w, SIGNAL(event(QObject*,int)))) {
+ setErrorString(QString(
+ "%1 was expected to result in %2 receiving an event matching one of the following, "
+ "but it didn't:\n%3")
+ .arg(event.toString())
+ .arg(toString(sender))
+ .arg(w->toString()));
+ return false;
+ }
+ return true;
+}
+
+/*!
+ \internal
+*/
+bool QtUiTest::inputWithSignal(QObject* object, QByteArray const& signal,
+ QtUiTestInput const& event)
+{
+ if (signal.isEmpty()) return false;
+ QPointer<QObject> sender = object;
+
+ QTimer dummy;
+ dummy.setInterval(1000);
+ if (!QtUiTest::connectFirst(sender, signal, &dummy, SLOT(start()))) {
+ setErrorString(QString("Object %1 has no signal %2").arg(toString(sender)).arg(&signal.constData()[1]));
+ return false;
+ }
+
+ // Ensure connectNotify is called
+ if (!QObject::connect(sender, signal, &dummy, SLOT(start())))
+ Q_ASSERT(0);
+
+ event.post();
+
+ if (!dummy.isActive() && !QtUiTest::waitForSignal(sender, signal)) {
+ setErrorString(QString(
+ "%1 was expected to result in %2 emitting the signal %3, "
+ "but it didn't.")
+ .arg(event.toString())
+ .arg(toString(sender))
+ .arg(&signal.constData()[1]));
+ return false;
+ }
+ return true;
+}
+
+/*!
+ \internal
+ \overload
+ Simulate a key click event.
+ Returns true if \a object receives any event of the given \a types within maximumUiTimeout()
+ milliseconds.
+ If it does not, the errorString() will be set accordingly.
+*/
+bool QtUiTest::keyClick(QObject* object, QList<QEvent::Type> const& types, int key,
+ Qt::KeyboardModifiers modifiers, QtUiTest::InputOption options)
+{
+ QList<QEventWatcherFilter*> filters;
+ foreach (QEvent::Type type, types) {
+ // These cases result in waiting for specific key events rather than just "any key press".
+ if (type == QEventWatcherKeyFilter::keyPressType()) {
+ filters << new QEventWatcherKeyFilter(Qt::Key(key), QEvent::KeyPress);
+ } else if (type == QEventWatcherKeyFilter::keyReleaseType()) {
+ filters << new QEventWatcherKeyFilter(Qt::Key(key), QEvent::KeyRelease);
+ } else {
+ filters << new QEventWatcherTypeFilter(type);
+ }
+ }
+ return inputWithEvent(object, filters, QtUiTestKeyClick(Qt::Key(key), modifiers, options));
+}
+
+/*!
+ \overload
+ Simulate a key click event.
+ Returns true if \a object emits \a signal within maximumUiTimeout()
+ milliseconds.
+ If it does not, the errorString() will be set accordingly.
+*/
+bool QtUiTest::keyClick(QObject* object, QByteArray const& signal, int key, Qt::KeyboardModifiers modifiers,
+ QtUiTest::InputOption options)
+{ return inputWithSignal(object, signal, QtUiTestKeyClick(Qt::Key(key), modifiers, options)); }
+
+/*!
+ Returns true if widget interaction should prefer mouse events over
+ key events.
+
+ On most platforms the default returns true, unless the environment variable
+ QTUITEST_NO_MOUSE is set.
+*/
+bool QtUiTest::mousePreferred()
+{
+ return QtUiTestWidgets::instance()->mousePreferred();
+}
+
+void QtUiTest::setMousePreferred(bool useMouse)
+{
+ QtUiTestWidgets::instance()->setMousePreferred(useMouse);
+}
+
+QtUiTest::LabelOrientation QtUiTest::labelOrientation()
+{
+ return QtUiTestWidgets::instance()->labelOrientation();
+}
+
+void QtUiTest::setLabelOrientation(QtUiTest::LabelOrientation orientation)
+{
+ QtUiTestWidgets::instance()->setLabelOrientation(orientation);
+}
+
+/*!
+ Returns the maximum amount of time, in milliseconds, the user interface is allowed to take
+ to generate some response to a user's action.
+
+ This value is useful to determine how long test widgets should wait for certain events to occur
+ after simulating key/mouse events. The value may be device-specific.
+*/
+int QtUiTest::maximumUiTimeout()
+{ return 2000; }
+
+/*!
+ Returns the Qt::Key corresponding to \a c.
+
+ This function is commonly used in conjunction with keyClick() to enter
+ a string of characters using the keypad.
+
+ Example:
+ \code
+ using namespace QtUiTest;
+ QString text = "hello world";
+ // ...
+ foreach (QChar c, text) {
+ keyClick( asciiToKey(c.toLatin1()), asciiToModifiers(c.toLatin1()) );
+ }
+ \endcode
+*/
+Qt::Key QtUiTest::asciiToKey(char c)
+{ return static_cast<Qt::Key>(QKeySequence(QString(QChar(c)))[0]); }
+
+/*!
+ Returns any Qt::KeyboardModifiers which would be required to input \a c.
+
+ This function is commonly used in conjunction with keyClick() to enter
+ a string of characters using the keypad.
+
+ Example:
+ \code
+ using namespace QtUiTest;
+ QString text = "hello world";
+ // ...
+ foreach (QChar c, text) {
+ keyClick( asciiToKey(c.toLatin1()), asciiToModifiers(c.toLatin1()) );
+ }
+ \endcode
+*/
+Qt::KeyboardModifiers QtUiTest::asciiToModifiers(char c)
+{
+ Qt::KeyboardModifiers ret = Qt::NoModifier;
+ if (QChar(c).isUpper()) ret |= Qt::ShiftModifier;
+ return ret;
+}
+
+/*!
+ Returns a human-readable error string describing the last error which
+ occurred while accessing a testwidget.
+
+ The error string is used to report directly to a tester any unexpected
+ errors. The string will typically be used as a test failure message.
+
+ \sa setErrorString()
+*/
+QString QtUiTest::errorString()
+{ return QtUiTestWidgets::instance()->errorString(); }
+
+/*!
+ Sets the human-readable \a error string describing the last error which
+ occurred while accessing a testwidget.
+
+ \sa errorString()
+*/
+void QtUiTest::setErrorString(QString const& error)
+{ QtUiTestWidgets::instance()->setErrorString(error); }
+
+/*!
+ Returns a widget or test widget wrapper of \a type.
+
+ QtUiTest will attempt to find widgets by calling
+ QtUiTest::WidgetFactory::find() on all loaded widget factories.
+
+ Note that it is possible to call this function from an application where
+ the only widget of \a type exists in the server. In this case, the
+ reference implementation returns a special wrapper which transparently
+ communicates with the server when calling functions. However, if custom
+ factories are used which do not do this, this function is likely to return
+ 0 in this case.
+
+ Example:
+ \code
+ using namespace QtUiTest;
+ bool MyTextEdit::enter(QVariant const& item) {
+ // Instead of explicitly simulating mouse or key clicks,
+ // enter the text via the current input method.
+ // Note that this works whether or not the input method is located in
+ // the current process.
+ InputWidget *iw = qtuitest_cast<InputWidget*>(findWidget(InputMethod));
+ return (iw && iw->enter(item));
+ }
+ \endcode
+*/
+QObject* QtUiTest::findWidget(WidgetType type)
+{
+ return QtUiTestWidgets::instance()->findWidget(type);
+}
+
+/*!
+ \internal
+ Returns a test widget wrapper for \a object which implements
+ \a interface.
+*/
+QObject* QtUiTest::testWidget(QObject* object, const char* interface)
+{
+ return QtUiTestWidgets::instance()->testWidget(object, interface);
+}
+
+/*!
+ Causes the process to wait for \a ms milliseconds. While waiting, events will be processed.
+*/
+void QtUiTest::wait(int ms)
+{
+ // If we are currently in an alternate stack, make sure we wait on the main
+ // stack instead. This avoids hanging due to nested event loops (bug 194361).
+ foreach (QAlternateStack* stack, QAlternateStack::instances()) {
+ if (!stack->isCurrentStack()) continue;
+
+ // OK, we are running in this stack.
+
+ // We are about to switch from this stack back to the main stack.
+ // Arrange an event to occur so that we switch back to this stack
+ // after the given timeout.
+
+ // Must be created on the heap and destroyed with deleteLater(),
+ // because when we switch back to this stack, QCoreApplication::notify
+ // still holds a pointer to timer.
+
+ QDelayedAutoPointer<QTimer> timer = new QTimer;
+ timer->setObjectName("qtuitest_wait_timer");
+ timer->setSingleShot(true);
+ timer->setInterval(ms);
+
+ QObject::connect(timer, SIGNAL(timeout()), stack, SLOT(switchTo()));
+
+ // Now switch back to the main stack.
+ timer->start();
+ while (timer->isActive())
+ stack->switchFrom();
+
+ // OK, we've returned from the main stack to this stack, so we've
+ // waited for the given timeout and can now return.
+ return;
+ }
+
+ // If we get here, we are running in the main stack, so just do a usual
+ // possibly-hanging wait.
+ QEventLoop loop;
+ QTimer::singleShot(ms, &loop, SLOT(quit()));
+ loop.exec();
+}
+
+#include <QDebug>
+
+/*!
+ Causes the process to wait for \a ms milliseconds or until \a signal is
+ emitted from \a object, whichever comes first.
+
+ While waiting, events will be processed.
+
+ Returns true if \a signal was emitted from \a object before timing out.
+ When false is returned, errorString() is set accordingly.
+
+ If \a connectionType specifies a direct connection, this function will return
+ immediately when the signal occurs, possibly before some objects have
+ received the signal. If \a connectionType specifies a queued connection, this
+ function will return once the event loop has run following the emit.
+*/
+bool QtUiTest::waitForSignal(QObject* object, const char* signal, int ms, Qt::ConnectionType connectionType)
+{
+ if (ms < 0) return false;
+ if (!signal || !signal[0]) return false;
+
+ QPointer<QObject> sender = object;
+
+ // Dummy variable to detect signal emission.
+ QTimer dummy;
+ dummy.setInterval(1000);
+ if (!QtUiTest::connectFirst(sender, signal, &dummy, SLOT(start())))
+ return false;
+
+ // Ensure connectNotify is called
+ if (!QObject::connect(sender, signal, &dummy, SLOT(start())))
+ Q_ASSERT(0);
+
+ // If we are currently in an alternate stack, make sure we wait on the main
+ // stack instead. This avoids hanging due to nested event loops (bug 194361).
+ foreach (QAlternateStack* stack, QAlternateStack::instances()) {
+ if (!stack->isCurrentStack()) continue;
+
+ // OK, we are running in this stack.
+
+ // We are about to switch from this stack back to the main stack.
+ // Arrange an event to occur so that we switch back to this stack
+ // after the given timeout.
+
+ // Must be created on the heap and destroyed with deleteLater(),
+ // because when we switch back to this stack, QCoreApplication::notify
+ // still holds a pointer to timer.
+
+ QDelayedAutoPointer<QTimer> timer = new QTimer;
+ timer->setObjectName("qtuitest_waitForSignal_timer");
+ timer->setInterval(ms);
+ timer->setSingleShot(true);
+ QObject::connect(timer, SIGNAL(timeout()), stack, SLOT(switchTo()));
+ timer->start();
+
+ while (timer->isActive() && !dummy.isActive()) {
+ // Arrange it so that we switch back to this stack if the
+ // desired signal is emitted.
+ if (!QtUiTest::connectFirst(sender, signal, stack, SLOT(switchTo()))) {
+ return false;
+ }
+ // Now switch back to the main stack.
+ stack->switchFrom();
+ if (sender && !QtUiTest::disconnectFirst(sender, signal, stack, SLOT(switchTo())))
+ Q_ASSERT(0);
+ }
+
+ // OK, we've returned from the main stack to this stack, so we've
+ // timed out or got the signal. Check dummy to figure out which one.
+ if (!dummy.isActive()) {
+ setErrorString(QString("Object %1 was expected to emit %2 within %3 milliseconds, "
+ "but it didn't.")
+ .arg(toString(sender))
+ .arg(&signal[1])
+ .arg(ms)
+ );
+ return false;
+ }
+
+ // If we asked for a queued connection, fake it.
+ if (connectionType == Qt::QueuedConnection) {
+ QtUiTest::wait(0);
+ }
+ return true;
+ }
+
+ // We are running on the main stack. Use a (dangerous) nested event loop
+ // to wait.
+ QEventLoop loop;
+ if (!QObject::connect(sender, signal, &loop, SLOT(quit())))
+ return false;
+ QTimer::singleShot(ms, &loop, SLOT(quit()));
+
+ loop.exec();
+
+ return dummy.isActive();
+}
+
+/*!
+ Causes the process to wait for \a ms milliseconds or until an event of
+ any of the given \a types is received by \a object, whichever comes first.
+
+ While waiting, events will be processed.
+
+ Returns true if the event was received by \a object before timing out.
+ When false is returned, errorString() is set accordingly.
+
+ If \a connectionType specifies a direct connection, this function will return
+ immediately before the event is processed by \a object.
+ If \a connectionType specifies a queued connection, this function will return
+ once the event loop has run following the processing of the event.
+*/
+bool QtUiTest::waitForEvent(QObject* object, QList<QEvent::Type> const& types, int ms, Qt::ConnectionType connectionType)
+{
+ QPointer<QObject> sender = object;
+ QDelayedAutoPointer<QEventWatcher> w = new QEventWatcher;
+ w->setObjectName("qtuitest_waitForEvent_watcher");
+ w->addObject(sender);
+ foreach (QEvent::Type type, types)
+ w->addFilter(new QEventWatcherTypeFilter(type));
+
+ if (!QtUiTest::waitForSignal(w, SIGNAL(event(QObject*,int)), ms, connectionType)) {
+ setErrorString(QString("Object %1 was expected to receive an event of type(s) %2 within "
+ "%3 milliseconds, but it didn't.")
+ .arg(toString(sender))
+ .arg(toString(types))
+ .arg(ms)
+ );
+ return false;
+ }
+ return true;
+}
+
+/*!
+ \overload
+ Waits for an event of the given \a type.
+*/
+bool QtUiTest::waitForEvent(QObject* object, QEvent::Type type, int ms, Qt::ConnectionType connectionType)
+{ return waitForEvent(object, QList<QEvent::Type>() << type, ms, connectionType); }
+
+/*!
+ Creates a connection from the \a signal in the \a sender object to
+ the \a method in the \a receiver object. Returns true if the connection succeeds;
+ otherwise returns false.
+
+ This function behaves similarly to QObject::connect() with the following
+ important differences.
+ \list
+ \o The connection is guaranteed to be activated before
+ any connections made with QObject::connect().
+ \o The connection type is always Qt::DirectConnection.
+ \o The connection cannot be disconnected using QObject::disconnect()
+ (QtUiTest::disconnectFirst() must be used instead).
+ \o The connection does not affect the return value of QObject::receivers().
+ \o While \a method is being executed, the return value of
+ QObject::sender() is undefined.
+ \o QObject::connectNotify() is not called on the sending object.
+ \endlist
+
+ This function is primarily used in conjunction with QtUiTestRecorder to
+ ensure events are recorded in the correct order.
+
+ Note that this function cannot be used in a program which uses QSignalSpy.
+
+ \sa QObject::connect(), QtUiTest::disconnectFirst()
+*/
+bool QtUiTest::connectFirst(const QObject* sender, const char* signal,
+ const QObject* receiver, const char* method)
+{
+ // On failure, we use QObject::connect to get the same error message as
+ // we normally would.
+ if (sender == 0 || receiver == 0 || signal == 0 || method == 0) {
+ return QObject::connect(sender,signal,receiver,method);
+ }
+ if (qstrlen(signal) < 1 || qstrlen(method) < 1) {
+ return QObject::connect(sender,signal,receiver,method);
+ }
+
+ const QMetaObject* const senderMo = sender->metaObject();
+
+ QByteArray normalSignal = QByteArray::fromRawData(signal+1, qstrlen(signal)-1);
+ int signal_index = senderMo->indexOfSignal(normalSignal);
+
+ if (signal_index < 0) {
+ // See if we can find the signal after normalizing.
+ normalSignal = QMetaObject::normalizedSignature(normalSignal);
+ signal_index = senderMo->indexOfSignal(normalSignal);
+ }
+ if (signal_index < 0) {
+ // Nope, bail out.
+ return QObject::connect(sender,signal,receiver,method);
+ }
+
+ const QMetaObject* const receiverMo = receiver->metaObject();
+
+ QByteArray normalMethod = QByteArray::fromRawData(method+1, qstrlen(method)-1);
+ int method_index = receiverMo->indexOfMethod(normalMethod);
+
+ if (method_index < 0) {
+ // See if we can find the method after normalizing.
+ normalMethod = QMetaObject::normalizedSignature(normalMethod);
+ method_index = senderMo->indexOfMethod(normalMethod);
+ }
+ if (method_index < 0) {
+ // Nope, bail out.
+ return QObject::connect(sender,signal,receiver,method);
+ }
+
+ // Ensure signal and slot are compatible.
+ if (!QMetaObject::checkConnectArgs(normalSignal.constData(), normalMethod.constData())) {
+ return QObject::connect(sender,signal,receiver,method);
+ }
+
+ // If we get here, then everything is valid.
+ QtUiTestConnectionManager::instance()->connect(sender, signal_index, receiver, method_index);
+ return true;
+}
+
+/*!
+ Disconnects \a signal in object \a sender from \a method in object \a receiver. Returns true if the connection is successfully broken; otherwise returns false.
+
+ The connection must have been established with QtUiTest::connectFirst().
+
+ Passing null arguments has the same wildcard effects as documented in QObject::disconnect().
+
+ If the same connection has been established multiple times, disconnectFirst() will disconnect
+ all instances of the connection. There is no way to disconnect a single instance of a
+ connection. This behavior matches QObject::disconnect().
+
+ \sa QObject::disconnect(), QtUiTest::connectFirst()
+*/
+bool QtUiTest::disconnectFirst(const QObject* sender, const char* signal,
+ const QObject* receiver, const char* method)
+{
+ // On failure, we use QObject::disconnect to get the same error message as
+ // we normally would.
+ if (sender == 0) {
+ return QObject::disconnect(sender,signal,receiver,method);
+ }
+
+ const QMetaObject* const senderMo = sender->metaObject();
+
+ QByteArray normalSignal = (signal)
+ ? QByteArray::fromRawData(signal+1, qstrlen(signal)-1)
+ : QByteArray();
+ int signal_index = (signal) ? senderMo->indexOfSignal(normalSignal) : -1;
+ if (signal && (signal_index < 0)) {
+ // See if we can find the signal after normalizing.
+ normalSignal = QMetaObject::normalizedSignature(signal);
+ signal_index = senderMo->indexOfSignal(normalSignal);
+ }
+ if (signal && (signal_index < 0)) {
+ // Nope, bail out.
+ return QObject::disconnect(sender,signal,receiver,method);
+ }
+
+ if (method && !receiver) {
+ return QObject::disconnect(sender,signal,receiver,method);
+ }
+
+ const QMetaObject* const receiverMo = (receiver) ? receiver->metaObject() : 0;
+
+ QByteArray normalMethod = (method)
+ ? QByteArray::fromRawData(method+1, qstrlen(method)-1)
+ : QByteArray();
+ int method_index = (method) ? receiverMo->indexOfMethod(normalMethod) : -1;
+
+ if (method && (method_index < 0)) {
+ // See if we can find the method after normalizing.
+ normalMethod = QMetaObject::normalizedSignature(method);
+ method_index = senderMo->indexOfMethod(normalMethod);
+ }
+ if (method && (method_index < 0)) {
+ // Nope, bail out.
+ return QObject::disconnect(sender,signal,receiver,method);
+ }
+
+ return QtUiTestConnectionManager::instance()->disconnect(sender,signal_index,receiver,method_index);
+}
+
diff --git a/libqtuitest/qtuitestnamespace.h b/libqtuitest/qtuitestnamespace.h
new file mode 100644
index 0000000..41d88c6
--- /dev/null
+++ b/libqtuitest/qtuitestnamespace.h
@@ -0,0 +1,165 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTUITESTNAMESPACE_H
+#define QTUITESTNAMESPACE_H
+
+#include <qtuitestglobal.h>
+
+#include <QEvent>
+#include <QObject>
+#include <Qt>
+
+class QPoint;
+
+namespace QtUiTest
+{
+ enum InputOption {
+ NoOptions = 0x0,
+ DemoMode = 0x1,
+ KeyRepeat = 0x2
+ };
+
+ enum WidgetType {
+ InputMethod,
+ TabBar
+ };
+
+ enum Key {
+#ifdef Q_WS_QWS
+ Key_Activate = Qt::Key_Select,
+#else
+ Key_Activate = Qt::Key_Enter,
+#endif
+
+#ifdef Q_WS_QWS
+ Key_Select = Qt::Key_Select,
+#else
+ Key_Select = Qt::Key_Space,
+#endif
+
+#if defined(Q_WS_QWS) || defined (Q_OS_SYMBIAN)
+ Key_ActivateButton = Qt::Key_Select
+#else
+ Key_ActivateButton = Qt::Key_Space
+#endif
+ };
+
+ enum LabelOrientation {
+ LabelLeft = 0x01,
+ LabelRight = 0x02,
+ LabelAbove = 0x03,
+ LabelBelow = 0x04
+ };
+
+ QTUITEST_EXPORT void setInputOption(InputOption,bool = true);
+ QTUITEST_EXPORT bool testInputOption(InputOption);
+
+ QTUITEST_EXPORT QString errorString();
+ QTUITEST_EXPORT void setErrorString(QString const&);
+
+ QTUITEST_EXPORT void mousePress (QPoint const&,Qt::MouseButtons = Qt::LeftButton,
+ InputOption = NoOptions);
+ QTUITEST_EXPORT void mouseRelease(QPoint const&,Qt::MouseButtons = Qt::LeftButton,
+ InputOption = NoOptions);
+ QTUITEST_EXPORT void mouseClick (QPoint const&,Qt::MouseButtons = Qt::LeftButton,
+ InputOption = NoOptions);
+ QTUITEST_EXPORT bool mouseClick (QObject*,QPoint const&,Qt::MouseButtons = Qt::LeftButton,
+ InputOption = NoOptions);
+ QTUITEST_EXPORT bool mouseClick (QObject*,QByteArray const&,QPoint const&,
+ Qt::MouseButtons = Qt::LeftButton, InputOption = NoOptions);
+
+ QTUITEST_EXPORT void keyPress (int,Qt::KeyboardModifiers = 0,
+ InputOption = NoOptions);
+ QTUITEST_EXPORT void keyRelease(int,Qt::KeyboardModifiers = 0,
+ InputOption = NoOptions);
+ QTUITEST_EXPORT void keyClick (int,Qt::KeyboardModifiers = 0,
+ InputOption = NoOptions);
+ QTUITEST_EXPORT bool keyClick (QObject*,int,Qt::KeyboardModifiers = 0,
+ InputOption = NoOptions);
+ QTUITEST_EXPORT bool keyClick (QObject*,QByteArray const&,int,Qt::KeyboardModifiers = 0,
+ InputOption = NoOptions);
+
+ QTUITEST_EXPORT bool mousePreferred();
+ QTUITEST_EXPORT void setMousePreferred(bool);
+
+ QTUITEST_EXPORT LabelOrientation labelOrientation();
+ QTUITEST_EXPORT void setLabelOrientation(LabelOrientation);
+
+ QTUITEST_EXPORT int maximumUiTimeout();
+
+ QTUITEST_EXPORT Qt::Key asciiToKey(char);
+ QTUITEST_EXPORT Qt::KeyboardModifiers asciiToModifiers(char);
+
+ QTUITEST_EXPORT QObject* findWidget(WidgetType);
+
+ QTUITEST_EXPORT QObject* testWidget(QObject*,const char*);
+
+ QTUITEST_EXPORT bool connectFirst (const QObject*, const char*, const QObject*, const char*);
+ QTUITEST_EXPORT bool disconnectFirst(const QObject*, const char*, const QObject*, const char*);
+
+ template<class T> inline T qtuitest_cast_helper(QObject* object, T)
+ {
+ T ret;
+ if ((ret = qobject_cast<T>(object))) {}
+ else {
+ ret = qobject_cast<T>(QtUiTest::testWidget(object,
+ static_cast<T>(0)->_q_interfaceName()));
+ }
+ return ret;
+ }
+
+ QTUITEST_EXPORT void wait(int);
+ QTUITEST_EXPORT bool waitForSignal(QObject*, const char*, int = QtUiTest::maximumUiTimeout(), Qt::ConnectionType = Qt::QueuedConnection);
+ QTUITEST_EXPORT bool waitForEvent(QObject*, QEvent::Type, int = QtUiTest::maximumUiTimeout(), Qt::ConnectionType = Qt::QueuedConnection);
+ QTUITEST_EXPORT bool waitForEvent(QObject*, QList<QEvent::Type> const&, int = QtUiTest::maximumUiTimeout(), Qt::ConnectionType = Qt::QueuedConnection);
+};
+
+template<class T> inline
+T qtuitest_cast(const QObject* object)
+{
+ return QtUiTest::qtuitest_cast_helper<T>(const_cast<QObject*>(object),0);
+}
+
+#include <qtuitestwidgetinterface.h>
+
+#endif
+
diff --git a/libqtuitest/qtuitestrecorder.cpp b/libqtuitest/qtuitestrecorder.cpp
new file mode 100644
index 0000000..0a847b1
--- /dev/null
+++ b/libqtuitest/qtuitestrecorder.cpp
@@ -0,0 +1,367 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qtuitestrecorder.h"
+#include "qtuitestnamespace.h"
+
+#include <QSet>
+#include <QApplication>
+#include <QWidget>
+#include <QMetaType>
+#include <QPointer>
+
+Q_DECLARE_METATYPE(QPointer<QObject>)
+
+/*!
+ \preliminary
+ \class QtUiTestRecorder
+ \inpublicgroup QtUiTestModule
+ \brief The QtUiTestRecorder class provides an interface for observing
+ application-wide high level user actions.
+
+ QtUiTestRecorder aggregates the signals declared in the
+ \l{QtUiTest}{QtUiTest widget interfaces} to provide a single object
+ capable of watching for user input.
+
+ Note that using this class is expensive because it involves watching
+ for signals on a large number of objects. When you create a
+ QtUiTestRecorder and connect to its signals, this will result in every
+ existing widget being wrapped in a \l{QtUiTest}{test widget}.
+ To avoid this, do not connect to the signals of a QtUiTestRecorder
+ unless you will definitely use the result.
+*/
+
+class WidgetWatcher;
+
+class QtUiTestRecorderPrivate : public QObject
+{
+ Q_OBJECT
+public:
+ static WidgetWatcher* watcher;
+ static void createOrDestroyWatcher();
+
+public slots:
+ void on_gotFocus();
+ void on_activated();
+ void on_stateChanged(int);
+ void on_entered(QVariant const&);
+ void on_selected(QString const&);
+};
+
+WidgetWatcher* QtUiTestRecorderPrivate::watcher = 0;
+
+Q_GLOBAL_STATIC(QtUiTestRecorderPrivate, qtuitestRecorderPrivate);
+Q_GLOBAL_STATIC(QSet<QtUiTestRecorder*>, qtuitestRecorderInstances);
+
+/*! \internal */
+void QtUiTestRecorder::emitKeyEvent(int key, int mod, bool press, bool repeat)
+{
+ foreach(QtUiTestRecorder* r, *qtuitestRecorderInstances()) {
+ emit r->keyEvent(key, mod, press, repeat);
+ }
+}
+
+/*! \internal */
+void QtUiTestRecorder::emitMouseEvent(int x, int y, int state)
+{
+ foreach(QtUiTestRecorder* r, *qtuitestRecorderInstances()) {
+ emit r->mouseEvent(x, y, state);
+ }
+}
+
+void QtUiTestRecorderPrivate::on_gotFocus()
+{
+ foreach(QtUiTestRecorder* r, *qtuitestRecorderInstances()) {
+ emit r->gotFocus(sender());
+ }
+}
+
+void QtUiTestRecorderPrivate::on_activated()
+{
+ foreach(QtUiTestRecorder* r, *qtuitestRecorderInstances()) {
+ emit r->activated(sender());
+ }
+}
+
+void QtUiTestRecorderPrivate::on_stateChanged(int state)
+{
+ foreach(QtUiTestRecorder* r, *qtuitestRecorderInstances()) {
+ emit r->stateChanged(sender(), state);
+ }
+}
+
+void QtUiTestRecorderPrivate::on_entered(QVariant const& item)
+{
+ foreach(QtUiTestRecorder* r, *qtuitestRecorderInstances()) {
+ emit r->entered(sender(), item);
+ }
+}
+
+void QtUiTestRecorderPrivate::on_selected(QString const& item)
+{
+ foreach(QtUiTestRecorder* r, *qtuitestRecorderInstances()) {
+ emit r->selected(sender(), item);
+ }
+}
+
+/*
+ This helper class attempts to ensure that all created objects immediately
+ have wrappers constructed around them. This is necessary for event
+ recording to work properly, as it relies on test widgets emitting signals.
+
+ Since it is so expensive, an instance of this class should not be left
+ around whenever we don't have any QtUiTestRecorder instances.
+*/
+class WidgetWatcher : public QObject
+{
+ Q_OBJECT
+public:
+ WidgetWatcher();
+ void castAllChildren(QObject*);
+
+public slots:
+ bool eventFilter(QObject*,QEvent*);
+ void castAllChildren(QPointer<QObject>);
+};
+
+WidgetWatcher::WidgetWatcher()
+{
+ castAllChildren(qApp);
+ foreach(QWidget* w, qApp->topLevelWidgets()) {
+ castAllChildren(w);
+ }
+}
+
+bool WidgetWatcher::eventFilter(QObject* o, QEvent* e)
+{
+ if (e->type() == QEvent::ChildAdded) {
+ static struct Registrar {
+ Registrar() {
+ qRegisterMetaType< QPointer<QObject> >();
+ }
+ } r;
+ QPointer<QObject> ptr(o);
+ QMetaObject::invokeMethod(this, "castAllChildren",
+ Qt::QueuedConnection,
+ Q_ARG(QPointer<QObject>, ptr));
+ }
+ return false;
+}
+
+void WidgetWatcher::castAllChildren(QPointer<QObject> o)
+{ castAllChildren(static_cast<QObject*>(o)); }
+
+void WidgetWatcher::castAllChildren(QObject* o)
+{
+ if (!o) return;
+ qtuitest_cast<QtUiTest::Widget*>(o);
+ o->installEventFilter(this);
+ foreach (QObject* child, o->children())
+ castAllChildren(child);
+}
+
+void QtUiTestRecorderPrivate::createOrDestroyWatcher()
+{
+ QSet<QtUiTestRecorder*> const *recorders = qtuitestRecorderInstances();
+
+ bool need_watcher = false;
+ foreach (QtUiTestRecorder* rec, *recorders) {
+ if (rec->receivers(SIGNAL(gotFocus(QObject*)))
+ || rec->receivers(SIGNAL(activated(QObject*)))
+ || rec->receivers(SIGNAL(stateChanged(QObject*,int)))
+ || rec->receivers(SIGNAL(entered(QObject*,QVariant)))
+ || rec->receivers(SIGNAL(selected(QObject*,QString))))
+ need_watcher = true;
+
+ if (need_watcher) break;
+ }
+
+ if (watcher && !need_watcher) {
+ delete watcher;
+ watcher = 0;
+ } else if (!watcher && need_watcher) {
+ watcher = new WidgetWatcher;
+ }
+}
+
+
+/*!
+ Constructs a QtUiTestRecorder with the given \a parent.
+*/
+QtUiTestRecorder::QtUiTestRecorder(QObject* parent)
+ : QObject(parent)
+{
+ *qtuitestRecorderInstances() << this;
+}
+
+/*!
+ Destroys the QtUiTestRecorder.
+*/
+QtUiTestRecorder::~QtUiTestRecorder()
+{
+ qtuitestRecorderInstances()->remove(this);
+ QtUiTestRecorderPrivate::createOrDestroyWatcher();
+}
+
+/*!
+ \internal
+ May cause a WidgetWatcher to be created.
+*/
+void QtUiTestRecorder::connectNotify(char const*)
+{
+ QtUiTestRecorderPrivate::createOrDestroyWatcher();
+}
+
+/*!
+ \internal
+ May cause a WidgetWatcher to be destroyed.
+*/
+void QtUiTestRecorder::disconnectNotify(char const*)
+{
+ QtUiTestRecorderPrivate::createOrDestroyWatcher();
+}
+
+/*!
+ \fn void QtUiTestRecorder::gotFocus(QObject* widget)
+
+ Emitted when \a widget obtains focus by any means.
+
+ \sa QtUiTest::Widget::gotFocus()
+*/
+
+/*!
+ \fn void QtUiTestRecorder::activated(QObject* widget)
+
+ Emitted when \a widget is activated by any means.
+
+ In this context, "activated" means, for example, clicking a button.
+
+ \sa QtUiTest::ActivateWidget::activated()
+*/
+
+/*!
+ \fn void QtUiTestRecorder::stateChanged(QObject* widget, int state)
+
+ Emitted when the check state changes to \a state in \a widget.
+
+ \sa QtUiTest::CheckWidget::stateChanged()
+*/
+
+/*!
+ \fn void QtUiTestRecorder::entered(QObject* widget, QVariant const& item)
+
+ Emitted when \a item is entered into \a widget.
+
+ \sa QtUiTest::InputWidget::entered()
+*/
+
+/*!
+ \fn void QtUiTestRecorder::selected(QObject* widget, QString const& item)
+
+ Emitted when \a item is selected from \a widget.
+
+ \sa QtUiTest::SelectWidget::selected()
+*/
+
+/*!
+ \fn void QtUiTestRecorder::keyEvent(int key, int modifiers, bool isPress, bool isAutoRepeat)
+
+ Emitted when \a key (with \a modifiers) is pressed or released.
+
+ \a key is compatible with Qt::Key and \a modifiers is compatible with
+ Qt::KeyboardModifiers.
+
+ If the event is a press \a isPress is true, otherwise it is a release.
+ \a isAutoRepeat is true if the event is generated due to autorepeat.
+
+ This signal is only emitted within the server process, because individual
+ applications cannot monitor system-wide key events.
+*/
+
+/*!
+ \fn void QtUiTestRecorder::mouseEvent(int x, int y, int state)
+
+ Emitted when the mouse changes state.
+
+ \a x and \a y are the global co-ordinates of the event.
+ \a state is the current state of the mouse buttons, compatible with Qt::MouseButtons.
+
+ This signal is only emitted within the server process, because individual
+ applications cannot monitor system-wide mouse events.
+*/
+
+/*!
+ \internal
+ Connects all testwidget signals on \a object to all test recorder
+ instances.
+*/
+void QtUiTestRecorder::connectToAll(QObject* o)
+{
+ if (!o) return;
+
+ QMetaObject const* mo = o->metaObject();
+ QSet<QByteArray> _signals;
+
+#define _DO(Iface, Signal) \
+ if (qobject_cast<QtUiTest::Iface*>(o) && (-1 != mo->indexOfSignal(Signal))) { \
+ _signals << Signal; \
+ }
+
+ _DO(Widget, "gotFocus()");
+ _DO(ActivateWidget, "activated()");
+ _DO(CheckWidget, "stateChanged(int)");
+ _DO(InputWidget, "entered(QVariant)");
+ _DO(SelectWidget, "selected(QString)");
+
+#undef _DO
+
+ foreach (QByteArray sig, _signals) {
+ QByteArray recorder_slot = SLOT(on_) + sig;
+ sig.prepend(QSIGNAL_CODE);
+
+ /* Avoid multiple connections */
+ disconnect(o, sig, qtuitestRecorderPrivate(), recorder_slot);
+ connect( o, sig, qtuitestRecorderPrivate(), recorder_slot);
+ }
+}
+
+#include "qtuitestrecorder.moc"
+
diff --git a/libqtuitest/qtuitestrecorder.h b/libqtuitest/qtuitestrecorder.h
new file mode 100644
index 0000000..6d984bd
--- /dev/null
+++ b/libqtuitest/qtuitestrecorder.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTUITESTRECORDER_H
+#define QTUITESTRECORDER_H
+
+#include <QObject>
+#include <qtuitestglobal.h>
+
+class QtUiTestRecorderPrivate;
+class QtUiTestWidgets;
+
+class QTUITEST_EXPORT QtUiTestRecorder : public QObject
+{
+ Q_OBJECT
+
+public:
+ QtUiTestRecorder(QObject* =0);
+ ~QtUiTestRecorder();
+
+ static void emitKeyEvent(int,int,bool,bool);
+ static void emitMouseEvent(int,int,int);
+
+protected:
+ virtual void connectNotify(char const*);
+ virtual void disconnectNotify(char const*);
+
+signals:
+ void gotFocus(QObject*);
+ void activated(QObject*);
+ void stateChanged(QObject*,int);
+ void entered(QObject*,QVariant const&);
+ void selected(QObject*,QString const&);
+
+ void keyEvent(int,int,bool,bool);
+ void mouseEvent(int,int,int);
+
+private:
+ static void connectToAll(QObject*);
+ friend class QtUiTestWidgets;
+ friend class QtUiTestRecorderPrivate;
+};
+
+#endif
+
diff --git a/libqtuitest/qtuitestwidgetinterface.cpp b/libqtuitest/qtuitestwidgetinterface.cpp
new file mode 100644
index 0000000..7a42a00
--- /dev/null
+++ b/libqtuitest/qtuitestwidgetinterface.cpp
@@ -0,0 +1,1102 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qtuitestwidgetinterface.h"
+#include "qtuitestnamespace.h"
+
+#include <QRect>
+#include <QRegion>
+#include <QApplication>
+#include <QWidget>
+#include <QVariant>
+
+/*!
+ \preliminary
+ \class QtUiTest::WidgetFactory
+ \inpublicgroup QtUiTestModule
+ \brief The WidgetFactory class provides a factory interface
+ for QtUiTest widget wrapper classes.
+
+ QtUiTest::WidgetFactory is an abstract base class which enables the
+ creation of QtUiTest wrapper objects around Qt widgets.
+
+ Customizing QtUiTest behaviour for particular widgets is achieved by
+ implementing one or more test widget classes which inherit from
+ one or more QtUiTest widget interfaces,
+ subclassing QtUiTest::WidgetFactory, reimplementing the pure virtual
+ keys() and create() functions to create instances of the custom test
+ widget classes, and exporting the factory class using the
+ Q_EXPORT_PLUGIN2() macro.
+*/
+
+/*!
+ \fn QtUiTest::WidgetFactory::create(QObject* object)
+
+ Attempts to create a test widget to wrap \a object. Returns the created
+ test widget. Returns 0 if this factory does not support wrapping
+ \a object.
+
+ The returned object is suitable for use with
+ \l{QtUiTest}{qtuitest_cast}.
+
+ This function will only be called for objects which inherit one of the
+ classes returned by keys().
+*/
+
+/*!
+ Returns a widget or test widget of \a type, or 0 if none can be found.
+
+ Reimplement this function to provide custom behaviour for
+ QtUiTest::findWidget(). For example, if a custom soft menu widget is
+ being used rather than the shipped ContextLabel class, this function
+ must be reimplemented to return a pointer to the custom widget.
+
+ The base implementation always returns 0.
+*/
+QObject* QtUiTest::WidgetFactory::find(QtUiTest::WidgetType type)
+{ Q_UNUSED(type); return 0; }
+
+/*!
+ \fn QtUiTest::WidgetFactory::keys() const
+
+ Returns the list of C++ class names this factory can generate test widgets
+ for.
+
+ Note that returning a class from this function does not guarantee that the
+ factory will always be able to generate a test widget for that class.
+*/
+
+/*!
+ \preliminary
+ \class QtUiTest::Widget
+ \inpublicgroup QtUiTestModule
+ \brief The Widget class provides an abstract base class
+ for all test widgets.
+
+ QtUiTest::Widget contains functionality which maps
+ closely to QWidget. It encapsulates important information
+ and functionality related to two-dimensional GUI elements.
+
+ All test widgets should implement the QtUiTest::Widget interface,
+ using multiple inheritance to implement other QtUiTest interfaces
+ where suitable.
+*/
+
+/*!
+ \fn const QRect& QtUiTest::Widget::geometry() const
+
+ Returns the geometry of this widget in parent coordinates.
+
+ \sa QWidget::geometry()
+*/
+
+/*!
+ Returns the bounding rect of this widget in widget coordinates.
+
+ The base implementation returns geometry(), transformed to widget
+ coordinates.
+
+ \sa QWidget::rect()
+*/
+QRect QtUiTest::Widget::rect() const
+{
+ QRect ret(geometry());
+ ret.moveTopLeft(QPoint(0,0));
+ return ret;
+}
+
+/*!
+ Returns the left of the widget, in global coordinates.
+
+ \sa mapToGlobal()
+*/
+int QtUiTest::Widget::x() const
+{
+ return mapToGlobal(QPoint()).x();
+}
+
+/*!
+ Returns the top of the widget, in global coordinates.
+
+ \sa mapToGlobal()
+*/
+int QtUiTest::Widget::y() const
+{
+ return mapToGlobal(QPoint()).y();
+}
+
+/*!
+ Returns the width of the widget.
+
+ \sa geometry()
+*/
+int QtUiTest::Widget::width() const
+{
+ return geometry().width();
+}
+
+/*!
+ Returns the height of the widget.
+
+ \sa geometry()
+*/
+int QtUiTest::Widget::height() const
+{
+ return geometry().height();
+}
+
+/*!
+ \fn bool QtUiTest::Widget::isVisible() const
+
+ Returns true if this widget is currently visible.
+
+ In this context, "visible" has the same meaning as in QWidget::isVisible().
+ Therefore, this function returning \c{true} is not a guarantee that this
+ widget is currently on screen and unobscured. To test this,
+ visibleRegion() can be used.
+
+ \sa QWidget::isVisible(), visibleRegion()
+*/
+
+/*!
+ \fn QRegion QtUiTest::Widget::visibleRegion() const
+
+ Returns the currently on-screen, unobscured region of this widget,
+ in widget coordinates.
+
+ \sa QWidget::visibleRegion()
+*/
+
+/*!
+ \fn bool QtUiTest::Widget::ensureVisibleRegion(const QRegion& region)
+
+ Simulate whatever user input is necessary to ensure that \a region
+ (in local coordinates) is on-screen and unobscured.
+
+ Returns true if \a region was successfully made visible.
+
+ \sa visibleRegion()
+*/
+
+/*!
+ Simulate whatever user input is necessary to ensure that \a point
+ (in local coordinates) is on-screen and unobscured.
+
+ This convenience function calls ensureVisibleRegion() with a region
+ containing only \a point.
+
+ Returns true if \a point was successfully made visible.
+
+ \sa visibleRegion(), ensureVisibleRegion()
+*/
+bool QtUiTest::Widget::ensureVisiblePoint(const QPoint& point)
+{
+ return ensureVisibleRegion( QRegion(point.x(), point.y(), 1, 1) );
+}
+
+/*!
+ \fn QObject* QtUiTest::Widget::parent() const
+
+ Returns the parent of this widget, or 0 if this widget has no parent.
+
+ The returned object may be an actual QWidget, or may be a wrapping
+ test widget. Therefore, the only safe way to use the returned value
+ of this function is to cast it to the desired QtUiTest interface
+ using \l{QtUiTest}{qtuitest_cast}.
+
+ \sa QObject::parent(), QWidget::parentWidget(), children()
+*/
+
+/*!
+ Returns the window title (caption).
+
+ The returned string will typically be empty for all widgets other than
+ top-level widgets.
+
+ The default implementation returns an empty string.
+
+ \sa QWidget::windowTitle()
+*/
+QString QtUiTest::Widget::windowTitle() const
+{ return QString(); }
+
+/*!
+ \fn const QObjectList& QtUiTest::Widget::children() const
+
+ Returns all children of this widget.
+
+ The returned objects may be actual QWidget instances, or may be wrapping
+ test widgets. Therefore, the only safe way to use the returned objects
+ are to cast them to the desired QtUiTest interface using
+ \l{QtUiTest}{qtuitest_cast}.
+
+ Reimplementing this function allows widgets which are conceptually
+ widgets but are not QObject subclasses to be wrapped. This can be
+ achieved by returning a list of test widgets which do not necessarily
+ have underlying QWidget instances.
+
+ \sa QObject::children(), parent()
+*/
+
+/*!
+ Returns all descendants of this widget.
+
+ \sa children(), parent()
+*/
+void QtUiTest::Widget::descendants(QObjectList &list) const
+{
+ foreach (QObject *child, children()) {
+ if (!list.contains(child)) {
+ list << child;
+ QtUiTest::Widget* qw = qtuitest_cast<QtUiTest::Widget*>(child);
+ if (qw)
+ qw->descendants(list);
+ }
+ }
+}
+
+/*!
+ Returns the currently on-screen, unobscured region of all
+ child widgets of this widget, in widget coordinates. This does not
+ include the visible region of this widget.
+
+ The base implementation calculates the visible region by calling
+ visibleRegion() and childrenVisibleRegion() on all children().
+
+ \sa QWidget::visibleRegion(), children(), visibleRegion()
+*/
+QRegion QtUiTest::Widget::childrenVisibleRegion() const
+{
+ QRegion ret;
+ foreach (QObject *o, children()) {
+ Widget *w = qtuitest_cast<Widget*>(o);
+ if (w) ret |= ((w->childrenVisibleRegion() | w->visibleRegion())
+ .translated( -w->geometry().topLeft() ) );
+ }
+ return ret;
+}
+
+/*!
+ \fn QPoint QtUiTest::Widget::mapToGlobal(const QPoint& pos) const
+
+ Maps \a pos from widget coordinates to global screen coordinates and
+ returns the result.
+
+ \sa QWidget::mapToGlobal()
+*/
+
+/*!
+ \fn QPoint QtUiTest::Widget::mapFromGlobal(const QPoint& pos) const
+
+ Maps \a pos from global screen coordinates to widget coordinates and
+ returns the result.
+
+ \sa QWidget::mapFromGlobal()
+*/
+
+/*!
+ Returns the center point of the widget. The base implementation
+ returns geometry().center().
+
+ \sa QtUiTest::Widget::geometry()
+*/
+QPoint QtUiTest::Widget::center() const
+{
+ QPoint ret;
+ ret = mapToGlobal( geometry().center() );
+ return ret;
+}
+
+/*!
+ Simulate the user input necessary to move keyboard focus to this
+ widget.
+
+ The base implementation uses the result of hasFocus() to determine if the
+ widget currently has focus. If in keypad mode, a sequence of Up or Down
+ key presses will be used to move focus until this widget has focus.
+ If in mouse mode, the center of this widget will be clicked once.
+
+ Due to the way this function works in keypad mode, it is very important
+ that focusOutEvent() is correctly implemented for all widgets to dismiss
+ any "grab" effects on keyboard focus.
+
+ When reimplementing this function, it is necessary to call focusOutEvent()
+ on any widget before taking any action which could cause that widget to
+ lose focus.
+
+ Returns true if focus was successfully given to this widget, false
+ otherwise.
+
+ \sa QWidget::setFocus(), focusOutEvent()
+*/
+bool QtUiTest::Widget::setFocus()
+{
+ if (hasFocus()) return true;
+
+ // xxx Try using findWidget(Focus) here instead.
+ struct Focus {
+ static QWidget* focusWidget() {
+ QWidget *w = QApplication::focusWidget();
+ if (!w) w = QApplication::activeWindow();
+ if (!w) w = QApplication::activePopupWidget();
+ if (!w) w = QApplication::activeModalWidget();
+ return w;
+ }
+ };
+
+ using namespace QtUiTest;
+
+ if (!mousePreferred()) {
+ bool backwards = false;
+
+ QWidget *w = Focus::focusWidget();
+ QWidget *initialFocus = w;
+ Widget *tw = qtuitest_cast<Widget*>(w);
+ if (!tw) {
+ setErrorString("Can't find currently focused widget!");
+ return false;
+ }
+
+ if (y() < tw->y() || (y() == tw->y() && x() < tw->x())) {
+ backwards = true;
+ }
+
+ const int maxtries = 100;
+ int i = 0;
+ QWidget *pw = 0;
+
+ while (!hasFocus() && i < maxtries) {
+ tw->focusOutEvent();
+
+#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)
+ if (backwards) {
+ keyClick(Qt::Key_Up);
+ } else {
+ keyClick(Qt::Key_Down);
+ }
+#else
+ if (backwards) {
+ keyClick(Qt::Key_Tab, Qt::ShiftModifier);
+ } else {
+ keyClick(Qt::Key_Tab);
+ }
+#endif
+ pw = w;
+ if (w != pw && !QtUiTest::waitForSignal(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)))) {
+ setErrorString("Could not change widget focus using the keyboard");
+ return false;
+ }
+
+ //FIXME: Additional wait for Greenphone
+ QtUiTest::wait(200);
+ ++i;
+ w = Focus::focusWidget();
+ if (w == initialFocus && w != pw) {
+ // Back to square one...
+ break;
+ }
+ tw = qtuitest_cast<Widget*>(w);
+ if (!tw) {
+ setErrorString("Can't find currently focused widget!");
+ return false;
+ }
+ }
+
+ if (!hasFocus()) {
+ setErrorString(QString("Failed to give focus to widget after %1 keyclicks")
+ .arg(maxtries));
+ }
+ } else {
+ Widget* tw = qtuitest_cast<Widget*>(Focus::focusWidget());
+ if (tw) tw->focusOutEvent();
+
+ QPoint center = rect().center();
+ ensureVisiblePoint(center);
+
+ center = mapToGlobal(center);
+
+ // In the past, bugs have existed which make one click
+ // be consumed somewhere.
+ // Keep working in that case, but give a warning.
+ int i = 0;
+ do {
+ mouseClick( center );
+ QtUiTest::waitForSignal(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)));
+ if (hasFocus()) break;
+ } while(++i < 2);
+
+ if (hasFocus() && 1 == i)
+ qWarning("QtUitest: possible bug, took more than one click to "
+ "give focus to a widget.");
+ }
+
+ return hasFocus();
+}
+
+/*!
+ \fn bool QtUiTest::Widget::setEditFocus(bool enable)
+ Simulate the user input necessary to \a enable or disable edit focus for
+ this widget. Enabling edit focus will implicitly call setFocus() when
+ necessary.
+
+ The concept of edit focus only exists in Qt Embedded. This function must
+ be implemented when using Qt Embedded. On other platforms,
+ this function will behave the same as setFocus() when enable is true, and
+ will have no effect when enable is false.
+
+ Returns true if edit focus was successfully enabled or disabled for this
+ widget, false otherwise.
+
+ \sa QWidget::setEditFocus(), hasEditFocus()
+*/
+#ifndef Q_WS_QWS
+bool QtUiTest::Widget::setEditFocus(bool enable)
+{
+ if (!enable) return true;
+
+ return hasFocus() || setFocus();
+}
+#endif
+
+/*!
+ \fn bool QtUiTest::Widget::hasEditFocus() const
+ Returns true if this widget currently has edit focus.
+
+ The concept of edit focus only exists in Qt Embedded. This function must
+ be implemented on Qt Embedded. On other platforms, the base implementation
+ will return the same as hasFocus().
+
+ \sa QWidget::hasEditFocus(), setEditFocus()
+*/
+#ifndef Q_WS_QWS
+bool QtUiTest::Widget::hasEditFocus() const
+{ return hasFocus(); }
+#endif
+
+/*!
+ This function is called when this widget is about to lose keyboard focus.
+ The base implementation does nothing.
+
+ This function should be reimplemented to put this widget in a state where
+ subsequent up/down key clicks will result in non-destructive navigation
+ between widgets.
+
+ For example, if this function is called on a combo box which
+ currently has a list popped up, it should dismiss the list
+ so that subsequent key clicks will navigate between widgets rather
+ than navigating within the list.
+
+ \code
+ void MyComboBox::focusOutEvent() {
+ // Assuming q is a QComboBox...
+ // If the list is currently popped up...
+ if (q->view()->isVisible()) {
+ // Press the Select key to commit the currently highlighted
+ // item and ensure we are ready to navigate by keys.
+ QtUiTest::keyClick(Qt::Key_Select);
+ }
+ }
+ \endcode
+
+ \sa QWidget::focusOutEvent(), setFocus(), hasFocus()
+*/
+void QtUiTest::Widget::focusOutEvent()
+{}
+
+/*!
+ \fn bool QtUiTest::Widget::hasFocus() const
+ Returns true if this widget currently has keyboard focus.
+
+ \sa QWidget::hasFocus()
+*/
+
+/*!
+ Returns the focus proxy of this widget, or 0 if this widget has no focus proxy.
+ A widget may "have focus", but have a child widget that actually handles the
+ focus.
+
+ The returned object may be an actual QWidget, or may be a wrapping
+ test widget. Therefore, the only safe way to use the returned value
+ of this function is to cast it to the desired QtUiTest interface
+ using \l{QtUiTest}{qtuitest_cast}.
+
+ \sa QWidget::focusProxy()
+*/
+QObject* QtUiTest::Widget::focusProxy() const
+{
+ return 0;
+}
+
+/*!
+ Returns the focus policy of this widget.
+
+ The default implementation returns Qt::NoFocus, indicating that the widget
+ does not accept focus.
+
+ \sa QWidget::focusPolicy()
+*/
+Qt::FocusPolicy QtUiTest::Widget::focusPolicy () const
+{
+ return Qt::NoFocus;
+}
+
+/*!
+ Returns the flags set on this widget.
+
+ The default implementation returns 0, which is equivalent to a plain
+ Qt::Widget with no special flags set.
+*/
+Qt::WindowFlags QtUiTest::Widget::windowFlags() const
+{ return 0; }
+
+/*!
+ Returns true if this widget is of the given \a type.
+
+ The base implementation always returns false.
+*/
+bool QtUiTest::Widget::inherits(QtUiTest::WidgetType type) const
+{ Q_UNUSED(type); return false; }
+
+/*!
+ Sets \a pixmap to image of the widget. Returns true on success.
+
+ The base implementation always returns false.
+*/
+bool QtUiTest::Widget::grabPixmap(QPixmap &pixmap) const
+{ Q_UNUSED(pixmap); return false; }
+
+/*!
+ Returns true if this widget should be ignored by QtUiTest. If
+ a widget is ignored, any child widgets will still be processed.
+
+ The base implementation always returns false.
+
+ \sa {Query Paths}, {Querying Objects}
+*/
+bool QtUiTest::Widget::ignoreScan() const
+{ return false; }
+
+/*!
+ Returns true if this widget should not considered a possible
+ buddy for a label when resolving query paths.
+
+ Note that if the widget is returned as a buddy by
+ QtUiTest::Label::buddy() then this value will be ignored.
+
+ The base implementation always returns false.
+
+ \sa QtUiTest::Label::buddy(), {Query Paths}, {Querying Objects}
+*/
+bool QtUiTest::Widget::ignoreBuddy() const
+{ return false; }
+
+/*!
+ \fn void QtUiTest::Widget::gotFocus()
+
+ This signal is emitted when this widget gains focus by any means.
+
+ \sa QApplication::focusChanged()
+*/
+
+QVariant QtUiTest::Widget::getProperty(const QString&) const
+{
+ return QVariant();
+}
+
+bool QtUiTest::Widget::setProperty(const QString&, const QVariant&)
+{
+ return false;
+}
+
+/*!
+ \preliminary
+ \class QtUiTest::ActivateWidget
+ \inpublicgroup QtUiTestModule
+ \brief The ActivateWidget class provides an abstract base class
+ for all test widgets which can conceptually be "activated" by a user.
+
+ "Activation" occurs when user input causes an action, possibly
+ non-reversible, on a widget which exists solely for the purpose of
+ causing that action.
+
+ Examples of widgets suitable for this interface include QAbstractButton.
+*/
+
+/*!
+ \fn bool QtUiTest::ActivateWidget::activate()
+ Simulate the user input necessary to activate this widget.
+
+ Returns true if this widget was successfully activated.
+
+ For example, a button would reimplement this function to simulate
+ a click on itself, or to navigate to itself and hit the "Select" key.
+*/
+
+/*!
+ \fn void QtUiTest::ActivateWidget::activated()
+
+ This signal is emitted when this widget is activated.
+*/
+
+/*!
+ \preliminary
+ \class QtUiTest::LabelWidget
+ \inpublicgroup QtUiTestModule
+ \brief The LabelWidget class provides an abstract base class
+ for all test widgets which are conceptually labels.
+
+ Some widgets may act as labels for themselves while also providing
+ other functionality. For example, a button widget labels itself
+ and is also an ActivateWidget.
+
+ Examples of widgets suitable for this interface include QLabel.
+*/
+
+/*!
+ \fn QString QtUiTest::LabelWidget::labelText() const
+
+ Returns the text displayed on this label.
+
+ Most label widgets will also implement \l{QtUiTest::TextWidget}.
+ Most commonly, labelText() returns the same value as \l{QtUiTest::TextWidget::text()}.
+*/
+
+/*!
+ Returns the label's buddy widget, or 0 if this widget has no buddy.
+ The buddy-label relationship is used by QtUiTest as part of query path
+ resolution.
+
+ The returned object may be an actual QWidget, or may be a wrapping
+ test widget. Therefore, the only safe way to use the returned value
+ of this function is to cast it to the desired QtUiTest interface
+ using \l{QtUiTest}{qtuitest_cast}.
+
+ \sa QLabel::buddy(), {Query Paths}, {Querying Objects}
+*/
+QObject* QtUiTest::LabelWidget::buddy() const
+{
+ return 0;
+}
+
+/*!
+ \preliminary
+ \class QtUiTest::CheckWidget
+ \inpublicgroup QtUiTestModule
+ \brief The CheckWidget class provides an abstract base class
+ for all test widgets which support 'checked' and 'unchecked' states.
+
+ QtUiTest::CheckWidget exposes the current check state of widgets
+ which can be checked or unchecked.
+
+ Examples of widgets suitable for this interface include QCheckBox
+ and QAbstractButton.
+*/
+
+/*!
+ Returns true if this widget has three possible states, i.e. the widget
+ can be in state Qt::PartiallyChecked.
+
+ The base implementation returns false.
+
+ \sa QCheckBox::isTristate()
+*/
+bool QtUiTest::CheckWidget::isTristate() const
+{ return false; }
+
+/*!
+ \fn Qt::CheckState QtUiTest::CheckWidget::checkState() const
+
+ Returns the current check state of this widget.
+
+ \sa QCheckBox::checkState(), setCheckState()
+*/
+
+/*!
+ Simulates the user input necessary to set the current check state
+ to \a state, returning true on success.
+
+ The default implementation does nothing and returns false.
+
+ \sa QCheckBox::setCheckState(), checkState()
+*/
+bool QtUiTest::CheckWidget::setCheckState(Qt::CheckState state)
+{ Q_UNUSED(state); return false; }
+
+/*!
+ \fn void QtUiTest::CheckWidget::stateChanged(int state)
+
+ This signal is emitted when the check state of this widget changes
+ to \a state. \a state is compatible with Qt::CheckState.
+*/
+
+/*!
+ \preliminary
+ \class QtUiTest::TextWidget
+ \inpublicgroup QtUiTestModule
+ \brief The TextWidget class provides an abstract base class
+ for all test widgets which display text to the user.
+
+ The QtUiTest::TextWidget interface should be implemented on any widget
+ which shows any text at all. This is the primary interface QtUiTest
+ uses to determine text->widget mappings, and it is used to implement
+ \l{QSystemTest::}{getText()}, a heavily used verification mechanism.
+
+ This interface is closely related to QtUiTest::InputWidget, which
+ provides an interface for entering text into a widget. Any widgets
+ which contain user-editable text will typically implement both
+ QtUiTest::InputWidget and QtUiTest::TextWidget.
+
+ Examples of widgets suitable for this interface include QLabel,
+ QAbstractButton, QLineEdit, QTextEdit and many more.
+
+ \sa QtUiTest::InputWidget
+*/
+
+/*!
+ Returns the text in this widget which is currently selected / highlighted.
+ If the widget does not support the concept of selected text, this function
+ should return the same as text().
+
+ The base implementation calls text().
+
+ \sa QLineEdit::selectedText()
+*/
+QString QtUiTest::TextWidget::selectedText() const
+{ return text(); }
+
+/*!
+ Returns the value in this widget which is currently selected / highlighted.
+ If the widget does not support the concept of a selected value, this function
+ should return the same as value().
+
+ The base implementation calls selectedText().
+*/
+QVariant QtUiTest::TextWidget::selectedValue() const
+{ return selectedText(); }
+
+/*!
+ \fn QString QtUiTest::TextWidget::text() const
+
+ Returns all of the text this widget is currently presenting to the user.
+*/
+
+/*!
+ Returns the value this widget is currently presenting to the user.
+
+ The returned value will be of whatever type is most appropriate for this widget.
+ For example, a QLineEdit would return a literal copy of its text (giving the same
+ result as the text() function), while a QTimeEdit may return a QTime.
+*/
+QVariant QtUiTest::TextWidget::value() const
+{ return text(); }
+
+/*!
+ \preliminary
+ \class QtUiTest::ListWidget
+ \inpublicgroup QtUiTestModule
+ \brief The ListWidget class provides an abstract base class
+ for all test widgets which display a list of items to the user.
+
+ QtUiTest::ListWidget allows a widget which is conceptually a list to
+ be enumerated. This is closely related to QtUiTest::SelectWidget,
+ which may be implemented to allow a user to select an item from a list.
+
+ Examples of widgets suitable for this interface include QAbstractItemView,
+ QComboBox and QMenu.
+
+ \sa QtUiTest::SelectWidget
+*/
+
+/*!
+ \fn QStringList QtUiTest::ListWidget::list() const
+
+ Returns a list containing a text representation of each item in this list
+ widget.
+*/
+
+/*!
+ \fn QRect QtUiTest::ListWidget::visualRect(const QString& item) const
+
+ Returns the bounding rect of \a item, in widget coordinates.
+ If \a item isn't currently shown in this widget, returns a null rect.
+
+ \sa QAbstractItemView::visualRect()
+*/
+
+/*!
+ Simulates the user input necessary to navigate this widget until \a item
+ is currently visible and return true on success.
+
+ For example, in a QAbstractItemView with vertical scrollbars, if \a item
+ exists further down the list than currently shown, this function might
+ simulate 'Down' key clicks until it becomes visible.
+
+ The base implementation does nothing and returns true.
+*/
+bool QtUiTest::ListWidget::ensureVisible(const QString& item)
+{ Q_UNUSED(item); return true; }
+
+/*!
+ \preliminary
+ \class QtUiTest::InputWidget
+ \inpublicgroup QtUiTestModule
+ \brief The InputWidget class provides an abstract base class
+ for all test widgets which allow the user to input text.
+
+ QtUiTest::InputWidget encapsulates a widget in which a user may enter
+ and remove text. This is closely related to QtUiTest::TextWidget, which
+ provides an interface for retrieving text from a widget. Any widgets
+ which contain user-editable text will typically implement both
+ QtUiTest::InputWidget and QtUiTest::TextWidget.
+
+ Examples of widgets suitable for this interface include QLineEdit and
+ QTextEdit.
+
+ \sa QtUiTest::TextWidget
+*/
+
+/*!
+ \fn bool QtUiTest::InputWidget::canEnter(const QVariant& item) const
+
+ Returns true if \a item can possibly be entered into this widget.
+
+ For example, for a QLineEdit, QLineEdit::validator() would be used to
+ ensure that \l{QVariant::toString()}{item.toString()} constitutes
+ valid input for this line edit.
+*/
+
+/*!
+ \fn bool QtUiTest::InputWidget::enter(const QVariant& item, bool noCommit)
+
+ Simulates the user input necessary to enter \a item into this widget.
+ Returns true on success.
+
+ \a item can potentially be any type representable in a QVariant.
+ Most widgets will only be interested in text, in which case
+ \l{QVariant::toString()}{item.toString()} can be called to retrieve
+ a string. Examples of widgets which may handle types other than text
+ are QDateEdit and QTimeEdit, which may handle dates and times.
+
+ If \a noCommit is true, no attempt is made to commit the input (for example,
+ by clicking the Select key). Normally this value will be false, which will
+ result in the input being committed. This value is not applicable to all
+ widget types.
+
+ If canEnter() returns true and this function returns false, an error
+ has occurred and this widget is left in an undefined state.
+*/
+
+/*!
+ Returns the input proxy of this widget, or 0 if this widget has no input proxy.
+
+ The input proxy is an object that receives input on behalf of the widget (for
+ example, an input method). It must be cast to the desired QtUiTest interface
+ using \l{QtUiTest}{qtuitest_cast}.
+*/
+QObject* QtUiTest::InputWidget::inputProxy() const
+{
+ return 0;
+}
+
+/*!
+ \fn void QtUiTest::InputWidget::entered(const QVariant& item)
+ This signal is emitted when \a item is entered into the widget
+ by the user.
+*/
+
+/*!
+ \preliminary
+ \class QtUiTest::SelectWidget
+ \inpublicgroup QtUiTestModule
+ \brief The SelectWidget class provides an abstract base class
+ for all test widgets which allow the user to select from a range of items.
+
+ QtUiTest::SelectWidget encapsulates a widget which provides the user
+ with a choice from a (possibly unlimited) range. This is closely related
+ to QtUiTest::ListWidget, which may be implemented to allow a user to
+ enumerate all items from a list.
+
+ Examples of widgets suitable for this interface include QAbstractItemView,
+ QComboBox and QMenu.
+
+ \sa QtUiTest::ListWidget
+*/
+
+/*!
+ Returns true if this widget supports the selection of multiple items at
+ the same time.
+
+ The base implementation returns false.
+*/
+bool QtUiTest::SelectWidget::isMultiSelection() const
+{ return false; }
+
+/*!
+ \fn bool QtUiTest::SelectWidget::canSelect(const QString& item) const
+
+ Returns true if \a item can possibly be selected from this widget.
+*/
+
+/*!
+ Returns true if all of the given \a items can be selected from this widget
+ at the same time.
+
+ The base implementation returns true if isMultiSelection() returns true
+ and canSelect() returns true for every item in \a items.
+*/
+bool QtUiTest::SelectWidget::canSelectMulti(const QStringList& items) const
+{
+ if (!isMultiSelection()) return false;
+ foreach (QString item, items)
+ if (!canSelect(item)) return false;
+ return true;
+}
+
+/*!
+ \fn bool QtUiTest::SelectWidget::select(const QString& item)
+
+ Simulates the user input necessary to select \a item from this widget.
+
+ Returns true if \a item was successfully selected.
+
+ If canSelect() returns true and this function returns false, an error
+ has occurred and this widget's state is undefined.
+*/
+
+/*!
+ Simulates the user input necessary to select all \a items from this widget
+ at the same time.
+
+ Returns true if \a items were all successfully selected.
+
+ If canSelectMulti() returns true and this function returns false, an error
+ has occurred and this widget's state is undefined.
+
+ The base implementation calls canSelectMulti() to check if \a items can
+ be selected, then calls select() on each item in \a items.
+*/
+bool QtUiTest::SelectWidget::selectMulti(const QStringList& items)
+{
+ if (!canSelectMulti(items)) return false;
+ foreach (QString item, items)
+ if (!select(item)) return false;
+ return true;
+}
+
+/*!
+ \fn void QtUiTest::SelectWidget::selected(const QString& item)
+ This signal is emitted when \a item is selected from this widget.
+*/
+
+
+/*!
+ \preliminary
+ \class QtUiTest::CheckItemWidget
+ \inpublicgroup QtUiTestModule
+ \brief The CheckItemWidget class provides an abstract base class for all
+ test widgets which include items that support 'checked' and 'unchecked' states.
+
+ Examples of widgets suitable for this interface include QMenu.
+*/
+
+/*!
+ Returns true if \a item can be checked (has a selectable on/off state).
+*/
+bool QtUiTest::CheckItemWidget::isCheckable(const QString& item)
+{ Q_UNUSED(item); return false; }
+
+/*!
+ \fn bool QtUiTest::CheckItemWidget::isChecked(const QString& item)
+ Returns the check state of the \a item specified.
+*/
+
+/*!
+ \fn bool QtUiTest::CheckItemWidget::setChecked(const QString& item, bool state)
+ Set the check state of the \a item. Returns false if the check state cannot be set.
+*/
+
+
+/*!
+ \preliminary
+ \class QtUiTest::IndexedWidget
+ \inpublicgroup QtUiTestModule
+ \brief The IndexedWidget class provides an abstract base class
+ for all test widgets which allow the user to select items based on index.
+
+ Examples of widgets suitable for this interface include QAbstractItemView.
+
+ \sa QtUiTest::ListWidget, QtUiTest::SelectWidget
+*/
+
+/*!
+ Selects the item with the specified \a index from an item view. The index should
+ be specified in QtScript as an array, in the form [parentRow, parentColumn, ..., row, column].
+
+ This function can be used in situations where \l{QSystemTest::}{select()} would be inappropriate,
+ typically in larger, more complex item views or those containing items with duplicate names.
+
+ \code
+ // Select row 3, column 5 from tableView
+ selectIndex([3, 5], tableView);
+
+ // Select row 2, column 4 beneath parent item at row 1, column 0 from treeView
+ selectIndex([1, 0, 2, 4], treeView);
+ \endcode
+
+ \sa select(), selectedIndex()
+*/
+bool QtUiTest::IndexedWidget::selectIndex(const QVariantList& index)
+{
+ Q_UNUSED(index);
+ return false;
+}
+
+
+/*!
+ Returns the index of the item currently selected in an item view. This is returned
+ as a QVariantList, as required by selectIndex().
+
+ \sa selectIndex()
+*/
+QVariantList QtUiTest::IndexedWidget::selectedIndex() const
+{
+ return QVariantList();
+}
diff --git a/libqtuitest/qtuitestwidgetinterface.h b/libqtuitest/qtuitestwidgetinterface.h
new file mode 100644
index 0000000..2bbecff
--- /dev/null
+++ b/libqtuitest/qtuitestwidgetinterface.h
@@ -0,0 +1,263 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTUITESTWIDGETINTERFACE_H
+#define QTUITESTWIDGETINTERFACE_H
+
+#include <QStringList>
+#include <QVariantList>
+#include <QtGlobal>
+#include <qtuitestnamespace.h>
+#include <qtuitestglobal.h>
+
+class QRect;
+class QRegion;
+class QPoint;
+class QPixmap;
+
+namespace QtUiTest
+{
+#ifndef Q_QDOC
+ template<class T> T qtuitest_cast_helper(QObject*,T);
+#endif
+
+#define QTUITEST_INTERFACE(Klass) \
+ public: \
+ virtual ~Klass() {} \
+ static const char* _q_interfaceName() { return #Klass; } \
+ private: \
+ template<class T> friend T qtuitest_cast_helper(QObject*,T);
+
+ class QTUITEST_EXPORT WidgetFactory
+ {
+ QTUITEST_INTERFACE(WidgetFactory)
+ public:
+ virtual QObject* create(QObject*) = 0;
+ virtual QObject* find(QtUiTest::WidgetType);
+ virtual QStringList keys() const = 0;
+ };
+
+ class QTUITEST_EXPORT Widget
+ {
+ QTUITEST_INTERFACE(Widget)
+ public:
+ virtual const QRect& geometry() const = 0;
+ virtual QRect rect() const;
+ virtual int x() const;
+ virtual int y() const;
+ virtual int width() const;
+ virtual int height() const;
+ virtual bool isVisible() const = 0;
+ virtual QRegion visibleRegion() const = 0;
+ virtual QObject* parent() const = 0;
+ virtual QString windowTitle() const;
+ virtual const QObjectList &children() const = 0;
+ virtual void descendants(QObjectList &list) const;
+ virtual QRegion childrenVisibleRegion() const;
+ virtual QPoint mapToGlobal(const QPoint&) const = 0;
+ virtual QPoint mapFromGlobal(const QPoint&) const = 0;
+ virtual QPoint center() const;
+ virtual bool ensureVisibleRegion(const QRegion&) = 0;
+ bool ensureVisiblePoint(const QPoint&);
+ virtual bool setFocus();
+ virtual void focusOutEvent();
+ virtual bool hasFocus() const = 0;
+ virtual QObject* focusProxy() const;
+ virtual Qt::FocusPolicy focusPolicy () const;
+ virtual Qt::WindowFlags windowFlags() const;
+#ifdef Q_WS_QWS
+ virtual bool hasEditFocus() const = 0;
+ virtual bool setEditFocus(bool) = 0;
+#else
+ virtual bool hasEditFocus() const;
+ virtual bool setEditFocus(bool);
+#endif
+ virtual bool inherits(QtUiTest::WidgetType) const;
+ virtual bool grabPixmap(QPixmap &pixmap) const;
+ virtual bool ignoreScan() const;
+ virtual bool ignoreBuddy() const;
+ virtual QVariant getProperty(const QString&) const;
+ virtual bool setProperty(const QString&, const QVariant&);
+
+#ifdef Q_QDOC
+ signals:
+ void gotFocus();
+#endif
+ };
+
+ class QTUITEST_EXPORT ActivateWidget
+ {
+ QTUITEST_INTERFACE(ActivateWidget)
+ public:
+ virtual bool activate() = 0;
+
+#ifdef Q_QDOC
+ signals:
+ void activated();
+#endif
+ };
+
+ class QTUITEST_EXPORT LabelWidget
+ {
+ QTUITEST_INTERFACE(LabelWidget)
+ public:
+ virtual QString labelText() const = 0;
+ virtual QObject* buddy() const;
+ };
+
+ class QTUITEST_EXPORT CheckWidget
+ {
+ QTUITEST_INTERFACE(CheckWidget)
+ public:
+ virtual bool isTristate() const;
+ virtual Qt::CheckState checkState() const = 0;
+ virtual bool setCheckState(Qt::CheckState);
+
+#ifdef Q_QDOC
+ signals:
+ void stateChanged(int);
+#endif
+ };
+
+ class QTUITEST_EXPORT TextWidget
+ {
+ QTUITEST_INTERFACE(TextWidget)
+ public:
+ virtual QString selectedText() const;
+ virtual QVariant selectedValue() const;
+ virtual QString text() const = 0;
+ virtual QVariant value() const;
+ };
+
+ class QTUITEST_EXPORT ListWidget
+ {
+ QTUITEST_INTERFACE(ListWidget)
+ public:
+ virtual QStringList list() const = 0;
+ virtual QRect visualRect(const QString&) const = 0;
+ virtual bool ensureVisible(const QString&);
+ };
+
+ class QTUITEST_EXPORT InputWidget
+ {
+ QTUITEST_INTERFACE(InputWidget)
+ public:
+ virtual bool canEnter(const QVariant&) const = 0;
+ virtual bool enter(const QVariant&,bool) = 0;
+ virtual QObject *inputProxy() const;
+
+#ifdef Q_QDOC
+ signals:
+ void entered(const QVariant&);
+#endif
+ };
+
+ class QTUITEST_EXPORT SelectWidget
+ {
+ QTUITEST_INTERFACE(SelectWidget)
+ public:
+ virtual bool isMultiSelection() const;
+
+ virtual bool canSelect(const QString&) const = 0;
+ virtual bool canSelectMulti(const QStringList&) const;
+ virtual bool select(const QString&) = 0;
+ virtual bool selectMulti(const QStringList&);
+
+#ifdef Q_QDOC
+ signals:
+ void selected(const QString&);
+#endif
+ };
+
+ class QTUITEST_EXPORT CheckItemWidget
+ {
+ QTUITEST_INTERFACE(CheckItemWidget)
+ public:
+ virtual bool isCheckable(const QString&);
+ virtual bool isChecked(const QString&) const = 0;
+ virtual bool setChecked(const QString&, bool) = 0;
+ };
+
+ class QTUITEST_EXPORT IndexedWidget
+ {
+ QTUITEST_INTERFACE(IndexedWidget)
+ public:
+ virtual bool selectIndex(const QVariantList&);
+ virtual QVariantList selectedIndex() const;
+ };
+
+};
+
+Q_DECLARE_INTERFACE(
+ QtUiTest::WidgetFactory,
+ "com.nokia.qt.QtUiTest.WidgetFactory/1.0")
+Q_DECLARE_INTERFACE(
+ QtUiTest::Widget,
+ "com.nokia.qt.QtUiTest.Widget/1.0")
+Q_DECLARE_INTERFACE(
+ QtUiTest::ActivateWidget,
+ "com.nokia.qt.QtUiTest.ActivateWidget/1.0")
+Q_DECLARE_INTERFACE(
+ QtUiTest::LabelWidget,
+ "com.nokia.qt.QtUiTest.LabelWidget/1.0")
+Q_DECLARE_INTERFACE(
+ QtUiTest::CheckWidget,
+ "com.nokia.qt.QtUiTest.CheckWidget/1.0")
+Q_DECLARE_INTERFACE(
+ QtUiTest::TextWidget,
+ "com.nokia.qt.QtUiTest.TextWidget/1.0")
+Q_DECLARE_INTERFACE(
+ QtUiTest::ListWidget,
+ "com.nokia.qt.QtUiTest.ListWidget/1.0")
+Q_DECLARE_INTERFACE(
+ QtUiTest::InputWidget,
+ "com.nokia.qt.QtUiTest.InputWidget/1.0")
+Q_DECLARE_INTERFACE(
+ QtUiTest::SelectWidget,
+ "com.nokia.qt.QtUiTest.SelectWidget/1.0")
+Q_DECLARE_INTERFACE(
+ QtUiTest::CheckItemWidget,
+ "com.nokia.qt.QtUiTest.CheckItemWidget/1.0")
+Q_DECLARE_INTERFACE(
+ QtUiTest::IndexedWidget,
+ "com.nokia.qt.QtUiTest.IndexedWidget/1.0")
+#endif
+
diff --git a/libqtuitest/qtuitestwidgets.cpp b/libqtuitest/qtuitestwidgets.cpp
new file mode 100644
index 0000000..45d4b3a
--- /dev/null
+++ b/libqtuitest/qtuitestwidgets.cpp
@@ -0,0 +1,658 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "demowidgets_p.h"
+#include "qinputgenerator_p.h"
+#include "qtuitestrecorder.h"
+#include "qtuitestwidgetinterface.h"
+#include "qtuitestwidgets_p.h"
+
+#include <QDebug>
+#define qLog(A) if(1); else qDebug() << #A
+
+/*
+ If the QTUITEST_INPUT_DELAY environment variable is set, all calls to keyClick etc will
+ immediately return but the resulting event won't be generated until QTUITEST_INPUT_DELAY
+ milliseconds have passed.
+ This can be used to simulate a slow system to catch race conditions.
+ For example, setting QTUITEST_INPUT_DELAY to 500 roughly simulates running with a remote X
+ server over a link with a round trip time of 250ms.
+
+ Disable this define to disable the race condition testing code.
+*/
+#define QTUITEST_RACE_TEST
+
+#include <QApplication>
+#include <QDir>
+#include <QPluginLoader>
+#include <QPointer>
+#include <QStringList>
+#include <QTimer>
+
+/*!
+ \internal
+ \class QtUiTestWidgets
+ \brief The QtUiTestWidgets class provides an interface for creating and managing QtUiTest widgets.
+
+ QtUiTestWidgets manages the lifetime of all test widgets and allows
+ test widgets to simulate user interaction with the application.
+*/
+
+#ifdef QTUITEST_RACE_TEST
+enum QtUiTestInputType { QtUiTestPress, QtUiTestRelease, QtUiTestClick };
+struct QtUiTestKeyEvent
+{
+ QtUiTestInputType type;
+ Qt::Key key;
+ Qt::KeyboardModifiers mod;
+ QtUiTest::InputOption opt;
+};
+struct QtUiTestMouseEvent
+{
+ QtUiTestInputType type;
+ QPoint pos;
+ Qt::MouseButtons state;
+ QtUiTest::InputOption opt;
+};
+static int qtUiTestGetInputDelay()
+{
+ bool ok;
+ QByteArray value(qgetenv("QTUITEST_INPUT_DELAY"));
+ int ret = value.toInt(&ok);
+ if (!ok || ret < 0) ret = -1;
+ return ret;
+}
+static int qtUiTestInputDelay()
+{ static int ret = qtUiTestGetInputDelay(); return ret; }
+#endif
+
+
+class QtUiTestWidgetsPrivate
+{
+public:
+ QtUiTestWidgetsPrivate(QtUiTestWidgets* parent);
+
+ static QList<QByteArray> allImplementedInterfaces(QObject *o);
+
+ void _q_objectDestroyed();
+
+ QWidget *inputMethodsWidget() const;
+ QString currentInputMethod() const;
+
+ QtUiTestWidgets* q;
+
+ QHash< QByteArray, QSet<QtUiTest::WidgetFactory*> > factories;
+ QHash< QObject*, QHash<QByteArray, QPointer<QObject> > > testWidgets;
+ QSet< QtUiTest::WidgetFactory* > factorySet;
+
+ int inputOptions;
+ bool mousePreferred;
+ QtUiTest::LabelOrientation labelOrientation;
+
+ QString errorString;
+
+ QInputGenerator input;
+
+#ifdef QTUITEST_RACE_TEST
+ QList<QtUiTestKeyEvent> pendingKeyEvents;
+ QList<QtUiTestMouseEvent> pendingMouseEvents;
+ void _q_postNextKeyEvent();
+ void _q_postNextMouseEvent();
+#else
+ inline void _q_postNextKeyEvent() {}
+ inline void _q_postNextMouseEvent() {}
+#endif
+};
+
+class QTWOptStack
+{
+public:
+ QTWOptStack(QtUiTestWidgetsPrivate* obj,
+ QtUiTest::InputOption opt)
+ : d(obj), option(opt)
+ {
+ if (opt && (!(d->inputOptions & opt))) {
+ d->inputOptions |= opt;
+ } else {
+ d = 0;
+ }
+ }
+
+ ~QTWOptStack()
+ {
+ if (d) {
+ d->inputOptions &= ~option;
+ }
+ }
+
+ QtUiTestWidgetsPrivate *d;
+ QtUiTest::InputOption option;
+};
+
+QtUiTestWidgetsPrivate::QtUiTestWidgetsPrivate(QtUiTestWidgets* parent)
+ : q(parent),
+ inputOptions(QtUiTest::NoOptions)
+{
+ mousePreferred = true;
+ mousePreferred = qgetenv("QTUITEST_NO_MOUSE").isEmpty();
+
+ labelOrientation = QtUiTest::LabelLeft;
+ if (qApp && qApp->layoutDirection() == Qt::RightToLeft)
+ labelOrientation = QtUiTest::LabelRight;
+}
+
+QtUiTestWidgets::QtUiTestWidgets()
+ : QObject(),
+ d(new QtUiTestWidgetsPrivate(this))
+{
+ refreshPlugins();
+}
+
+QtUiTestWidgets::~QtUiTestWidgets()
+{
+ delete d;
+ d = 0;
+}
+
+/*!
+ Returns a static instance of QtUiTestWidgets.
+*/
+QtUiTestWidgets* QtUiTestWidgets::instance()
+{
+ static QtUiTestWidgets instance;
+ return &instance;
+}
+
+/*!
+ When an object is destroyed, deletes all test widgets pointing
+ to that object.
+*/
+void QtUiTestWidgetsPrivate::_q_objectDestroyed()
+{
+ QHash< QByteArray, QPointer<QObject> > toDestroy
+ = testWidgets.take(q->sender());
+
+ foreach (QPointer<QObject> tw, toDestroy.values()) {
+ if (tw) delete tw;
+ }
+}
+
+/*!
+ \internal
+ Destroy all test widgets and unregister all factories.
+ After calling this, refreshPlugins() must be called to be able to
+ construct testwidgets from factories.
+
+ For testing purposes only.
+*/
+void QtUiTestWidgets::clear()
+{
+ d->factories.clear();
+ d->factorySet.clear();
+
+ foreach (QObject *o, d->testWidgets.keys()) {
+ foreach (QPointer<QObject> tw, d->testWidgets[o].values()) {
+ if (tw && tw != o) delete tw;
+ }
+ }
+ d->testWidgets.clear();
+}
+
+/*!
+ Registers \a factory as a factory class for constructing test widgets.
+
+ It is not necessary to explicitly call this from QtUiTest widget plugins.
+ This function should only be called if a QtUiTest::WidgetFactory has been
+ created without using the standard plugin interface.
+*/
+void
+QtUiTestWidgets::registerFactory(QtUiTest::WidgetFactory* factory)
+{
+ if (!factory) return;
+
+ d->factorySet << factory;
+ foreach(QString k, factory->keys()) {
+ d->factories[k.toLatin1()].insert(factory);
+ }
+}
+
+/*!
+ Returns a human-readable error string describing the last error which
+ occurred while accessing a testwidget.
+
+ The error string is used to report directly to a tester any unexpected
+ errors. The string will typically be used as a test failure message.
+
+ \sa setErrorString()
+*/
+QString QtUiTestWidgets::errorString() const
+{ return d->errorString; }
+
+/*!
+ Sets the human-readable \a error string describing the last error which
+ occurred while accessing a testwidget.
+
+ \sa errorString()
+*/
+void QtUiTestWidgets::setErrorString(QString const& error)
+{
+ if (error == d->errorString) return;
+ d->errorString = error;
+}
+
+/*!
+ Returns a list of all QtUiTest widget interfaces implemented by \a o .
+*/
+QList<QByteArray> QtUiTestWidgetsPrivate::allImplementedInterfaces(QObject *o)
+{
+ // FIXME this function should not have to be explicitly implemented.
+ // Find some way to automatically handle all interfaces.
+ QList<QByteArray> ret;
+ if (qobject_cast<QtUiTest::Widget*>(o)) ret << "Widget";
+ if (qobject_cast<QtUiTest::ActivateWidget*>(o)) ret << "ActivateWidget";
+ if (qobject_cast<QtUiTest::LabelWidget*>(o)) ret << "LabelWidget";
+ if (qobject_cast<QtUiTest::CheckWidget*>(o)) ret << "CheckWidget";
+ if (qobject_cast<QtUiTest::CheckItemWidget*>(o)) ret << "CheckItemWidget";
+ if (qobject_cast<QtUiTest::TextWidget*>(o)) ret << "TextWidget";
+ if (qobject_cast<QtUiTest::ListWidget*>(o)) ret << "ListWidget";
+ if (qobject_cast<QtUiTest::InputWidget*>(o)) ret << "InputWidget";
+ if (qobject_cast<QtUiTest::SelectWidget*>(o)) ret << "SelectWidget";
+ if (qobject_cast<QtUiTest::IndexedWidget*>(o)) ret << "IndexedWidget";
+ return ret;
+}
+
+/*!
+ Returns a test widget wrapper for \a object implementing the given
+ \a interface. If a test widget implementing \a interface is already
+ wrapping \a object, that test widget will be returned. Otherwise,
+ a new test widget may be constructed using registered factories.
+
+ Returns 0 if the given \a interface is not implemented on \a object
+ or on any test widget which wraps \a object.
+
+ The returned object should not be deleted by the caller. QtUiTestWidgets
+ retains ownership of the returned test widget and deletes it when \a object
+ is destroyed.
+
+ \sa registerFactory()
+*/
+QObject* QtUiTestWidgets::testWidget(QObject* object, QByteArray const &interface)
+{
+ if (!object) return 0;
+
+ QMetaObject const *mo = object->metaObject();
+ QObject *ret = d->testWidgets.value( object ).value( interface );
+
+ bool watchingDestroyed = false;
+
+ if (!ret) {
+ QSet<QtUiTest::WidgetFactory*> usedFactories;
+ while (mo) {
+ foreach (QtUiTest::WidgetFactory *factory,
+ d->factories.value(mo->className()) - usedFactories) {
+
+ QObject *testWidget = factory->create(object);
+ usedFactories.insert(factory);
+ if (testWidget) {
+ bool isValuable = false;
+ foreach (QByteArray const& thisIface,
+ d->allImplementedInterfaces(testWidget)) {
+ QHash<QByteArray, QPointer<QObject> > &subhash
+ = d->testWidgets[object];
+ if (!subhash[thisIface]) {
+ isValuable = true;
+ subhash.insert( thisIface, testWidget );
+ watchingDestroyed = watchingDestroyed
+ || connect(object, SIGNAL(destroyed()),
+ this, SLOT(_q_objectDestroyed()));
+ }
+ }
+ if (!isValuable) {
+ delete testWidget;
+ } // if (!isValuable)
+ else {
+ QtUiTestRecorder::connectToAll(testWidget);
+ } // if (isValuable)
+ } // if (testWidget)
+ } // foreach factory
+ mo = mo->superClass();
+ }
+ ret = d->testWidgets.value( object ).value( interface );
+ }
+ return ret;
+}
+
+/*!
+ Returns a widget of \a type using factories.
+*/
+QObject* QtUiTestWidgets::findWidget(QtUiTest::WidgetType type)
+{
+ foreach (QtUiTest::WidgetFactory *factory, d->factorySet) {
+ if (QObject *ret = factory->find(type))
+ return ret;
+ }
+
+ return 0;
+}
+
+/*!
+ \internal
+ Load factories from all existing qtuitest_widgets plugins.
+*/
+void QtUiTestWidgets::refreshPlugins()
+{
+ /* First, handle static plugins. */
+ foreach (QObject *o, QPluginLoader::staticInstances()) {
+ registerFactory(qobject_cast<QtUiTest::WidgetFactory*>(o));
+ }
+
+ QSet<QString> pluginsToLoad;
+
+ QList<QDir> pluginDirs;
+ foreach (QByteArray const& split, qgetenv("QTUITEST_WIDGETS_PATH").split(':')) {
+ if (split.isEmpty()) continue;
+ QDir dir(split);
+ if (dir.exists()) pluginDirs << dir;
+ }
+
+ QString const pluginType("qtuitest_widgets");
+ QSet<QString> libPaths = QCoreApplication::libraryPaths().toSet();
+
+ foreach (QString const& libPath, libPaths) {
+ QDir dir(libPath + "/" + pluginType);
+ if (!dir.exists()) {
+ continue;
+ }
+ pluginDirs << dir;
+ }
+
+ foreach (QDir const& dir, pluginDirs) {
+ foreach (QString const& file, dir.entryList(QDir::Files|QDir::NoDotAndDotDot)) {
+ QString filename = dir.canonicalPath() + "/" + file;
+ if (!QLibrary::isLibrary(filename)) continue;
+ pluginsToLoad << filename;
+ }
+ }
+
+#ifdef Q_OS_SYMBIAN
+// This is a temporary hack for S60
+ pluginsToLoad << "qtwidgets.dll";
+#endif
+
+ QPluginLoader pluginLoader;
+ QSet<QString> lastPluginsToLoad;
+ QStringList errors;
+
+ // dumb dependency handling: keep trying to load plugins until we
+ // definitely can't progress.
+ while (lastPluginsToLoad != pluginsToLoad) {
+ lastPluginsToLoad = pluginsToLoad;
+ errors.clear();
+ foreach (QString const& plugin, pluginsToLoad) {
+ pluginLoader.setFileName(plugin);
+ // enable RTLD_GLOBAL, so plugins can access each other's symbols.
+ pluginLoader.setLoadHints(QLibrary::ExportExternalSymbolsHint);
+ pluginLoader.load();
+
+ QObject *instance = pluginLoader.instance();
+ QString error;
+ if (!instance)
+ error = "cannot resolve 'qt_plugin_instance': " + pluginLoader.errorString();
+
+ QtUiTest::WidgetFactory* fact = qobject_cast<QtUiTest::WidgetFactory*>(instance);
+ if (!fact) {
+ if (error.isEmpty()) error = pluginLoader.errorString();
+ QString formattedError;
+ QDebug(&formattedError)
+ << "QtUitest: failed to load qtuitest widgets plugin"
+ << "\n plugin" << plugin
+ << "\n instance" << instance
+ << "\n error" << error;
+ errors << formattedError;
+ } else {
+ pluginsToLoad -= plugin;
+ registerFactory(fact);
+ }
+ }
+ }
+
+ foreach (QString const& error, errors)
+ qWarning() << qPrintable(error);
+}
+
+/*!
+ Simulate a mouse press event at the global co-ordinates given by \a pos,
+ for the buttons in \a state. \a opt is applied to the simulated event.
+*/
+void QtUiTestWidgets::mousePress(QPoint const &pos, Qt::MouseButtons state,
+ QtUiTest::InputOption opt)
+{
+#ifdef QTUITEST_RACE_TEST
+ int delay;
+ if ((delay = qtUiTestInputDelay()) != -1) {
+ QtUiTestMouseEvent event = {QtUiTestPress, pos, state, opt};
+ d->pendingMouseEvents << event;
+ QTimer::singleShot(delay, this, SLOT(_q_postNextMouseEvent()));
+ return;
+ }
+#endif
+ QTWOptStack st(d, opt);
+ d->input.mousePress(pos, state);
+}
+
+/*!
+ Simulate a mouse release event at the global co-ordinates given by \a pos,
+ for the buttons in \a state. \a opt is applied to the simulated event.
+*/
+void QtUiTestWidgets::mouseRelease(QPoint const &pos, Qt::MouseButtons state,
+ QtUiTest::InputOption opt)
+{
+#ifdef QTUITEST_RACE_TEST
+ int delay;
+ if ((delay = qtUiTestInputDelay()) != -1) {
+ QtUiTestMouseEvent event = {QtUiTestRelease, pos, state, opt};
+ d->pendingMouseEvents << event;
+ QTimer::singleShot(delay, this, SLOT(_q_postNextMouseEvent()));
+ return;
+ }
+#endif
+ QTWOptStack st(d, opt);
+ d->input.mouseRelease(pos, state);
+}
+
+/*!
+ Simulate a mouse click event at the global co-ordinates given by \a pos,
+ for the buttons in \a state. \a opt is applied to the simulated event.
+*/
+void QtUiTestWidgets::mouseClick(QPoint const &pos, Qt::MouseButtons state,
+ QtUiTest::InputOption opt)
+{
+#ifdef QTUITEST_RACE_TEST
+ int delay;
+ if ((delay = qtUiTestInputDelay()) != -1) {
+ QtUiTestMouseEvent event = {QtUiTestClick, pos, state, opt};
+ d->pendingMouseEvents << event;
+ QTimer::singleShot(delay, this, SLOT(_q_postNextMouseEvent()));
+ return;
+ }
+#endif
+ QTWOptStack st(d, opt);
+ d->input.mouseClick(pos, state);
+}
+
+/*!
+ Simulate a key press event, using the given \a key and \a mod.
+ \a opt is applied to the simulated event.
+*/
+void QtUiTestWidgets::keyPress(Qt::Key key, Qt::KeyboardModifiers mod,
+ QtUiTest::InputOption opt)
+{
+#ifdef QTUITEST_RACE_TEST
+ int delay;
+ if ((delay = qtUiTestInputDelay()) != -1) {
+ QtUiTestKeyEvent event = {QtUiTestPress, key, mod, opt};
+ d->pendingKeyEvents << event;
+ QTimer::singleShot(delay, this, SLOT(_q_postNextKeyEvent()));
+ return;
+ }
+#endif
+ QTWOptStack st(d, opt);
+ d->input.keyPress(key, mod, opt & QtUiTest::KeyRepeat);
+}
+
+/*!
+ Simulate a key release event, using the given \a key and \a mod.
+ \a opt is applied to the simulated event.
+*/
+void QtUiTestWidgets::keyRelease(Qt::Key key, Qt::KeyboardModifiers mod,
+ QtUiTest::InputOption opt)
+{
+#ifdef QTUITEST_RACE_TEST
+ int delay;
+ if ((delay = qtUiTestInputDelay()) != -1) {
+ QtUiTestKeyEvent event = {QtUiTestRelease, key, mod, opt};
+ d->pendingKeyEvents << event;
+ QTimer::singleShot(delay, this, SLOT(_q_postNextKeyEvent()));
+ return;
+ }
+#endif
+ QTWOptStack st(d, opt);
+ d->input.keyRelease(key, mod);
+}
+
+/*!
+ Simulate a key click event, using the given \a key and \a mod.
+ \a opt is applied to the simulated event.
+*/
+void QtUiTestWidgets::keyClick(Qt::Key key, Qt::KeyboardModifiers mod,
+ QtUiTest::InputOption opt)
+{
+#ifdef QTUITEST_RACE_TEST
+ int delay;
+ if ((delay = qtUiTestInputDelay()) != -1) {
+ QtUiTestKeyEvent event = {QtUiTestClick, key, mod, opt};
+ d->pendingKeyEvents << event;
+ QTimer::singleShot(delay, this, SLOT(_q_postNextKeyEvent()));
+ return;
+ }
+#endif
+ QTWOptStack st(d, opt);
+ d->input.keyClick(key, mod);
+}
+
+#ifdef QTUITEST_RACE_TEST
+void QtUiTestWidgetsPrivate::_q_postNextMouseEvent()
+{
+ QtUiTestMouseEvent const event = pendingMouseEvents.takeAt(0);
+ QTWOptStack st(this, event.opt);
+ if (event.type == QtUiTestPress)
+ input.mousePress(event.pos, event.state);
+ else if (event.type == QtUiTestRelease)
+ input.mouseRelease(event.pos, event.state);
+ else if (event.type == QtUiTestClick)
+ input.mouseClick(event.pos, event.state);
+}
+
+void QtUiTestWidgetsPrivate::_q_postNextKeyEvent()
+{
+ QtUiTestKeyEvent const event = pendingKeyEvents.takeAt(0);
+ QTWOptStack st(this, event.opt);
+ if (event.type == QtUiTestPress)
+ input.keyPress(event.key, event.mod);
+ else if (event.type == QtUiTestRelease)
+ input.keyRelease(event.key, event.mod);
+ else if (event.type == QtUiTestClick)
+ input.keyClick(event.key, event.mod);
+}
+#endif
+
+/*!
+ Set or clear the specified \a option for subsequent simulated input
+ events. The option is set if \a on is true, otherwise it is cleared.
+*/
+void QtUiTestWidgets::setInputOption(QtUiTest::InputOption option, bool on)
+{
+ if (on)
+ d->inputOptions |= option;
+ else
+ d->inputOptions &= (~option);
+ qLog(QtUitest) << "set input options to" << d->inputOptions;
+}
+
+/*!
+ Returns true if \a option is currently set.
+*/
+bool QtUiTestWidgets::testInputOption(QtUiTest::InputOption option) const
+{
+ return (option == d->inputOptions)
+ || (option & d->inputOptions);
+}
+
+/*!
+ Returns true if the system will use mouse events in preference to key
+ events for widget and item selection.
+*/
+bool QtUiTestWidgets::mousePreferred() const
+{
+ return d->mousePreferred;
+}
+
+/*!
+ Set system to prefer mouse/touchscreen or keyboard for widget and item
+ selection. If \a useMouse is true then the mouse will be used, if false
+ then the keyboard will be used.
+*/
+void QtUiTestWidgets::setMousePreferred(bool useMouse)
+{
+ d->mousePreferred = useMouse;
+}
+
+QtUiTest::LabelOrientation QtUiTestWidgets::labelOrientation() const
+{
+ return d->labelOrientation;
+}
+
+void QtUiTestWidgets::setLabelOrientation(QtUiTest::LabelOrientation orientation)
+{
+ d->labelOrientation = orientation;
+}
+#include "moc_qtuitestwidgets_p.cpp"
+
diff --git a/libqtuitest/qtuitestwidgets_p.h b/libqtuitest/qtuitestwidgets_p.h
new file mode 100644
index 0000000..784b760
--- /dev/null
+++ b/libqtuitest/qtuitestwidgets_p.h
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTUITESTWIDGETS_P_H
+#define QTUITESTWIDGETS_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtUiTest API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QObject>
+#include <QMetaType>
+#include <QHash>
+#include <Qt>
+#include <qtuitestnamespace.h>
+
+class QtUiTestWidgetsPrivate;
+class QPoint;
+
+class QTUITEST_EXPORT QtUiTestWidgets : public QObject
+{
+ Q_OBJECT
+
+public:
+ static QtUiTestWidgets* instance();
+
+ virtual ~QtUiTestWidgets();
+
+ void setInputOption(QtUiTest::InputOption,bool = true);
+ bool testInputOption(QtUiTest::InputOption) const;
+
+ bool mousePreferred() const;
+ void setMousePreferred(bool);
+
+ QtUiTest::LabelOrientation labelOrientation() const;
+ void setLabelOrientation(QtUiTest::LabelOrientation);
+
+ QString errorString() const;
+ void setErrorString(QString const&);
+
+ void registerFactory(QtUiTest::WidgetFactory*);
+
+ void mousePress (QPoint const&,Qt::MouseButtons = Qt::LeftButton,
+ QtUiTest::InputOption = QtUiTest::NoOptions);
+ void mouseRelease(QPoint const&,Qt::MouseButtons = Qt::LeftButton,
+ QtUiTest::InputOption = QtUiTest::NoOptions);
+ void mouseClick (QPoint const&,Qt::MouseButtons = Qt::LeftButton,
+ QtUiTest::InputOption = QtUiTest::NoOptions);
+
+ void keyPress (Qt::Key,Qt::KeyboardModifiers = 0,QtUiTest::InputOption = QtUiTest::NoOptions);
+ void keyRelease(Qt::Key,Qt::KeyboardModifiers = 0,QtUiTest::InputOption = QtUiTest::NoOptions);
+ void keyClick (Qt::Key,Qt::KeyboardModifiers = 0,QtUiTest::InputOption = QtUiTest::NoOptions);
+
+private:
+ Q_DISABLE_COPY(QtUiTestWidgets)
+
+ friend class QtUiTestWidgetsPrivate;
+
+ QtUiTestWidgetsPrivate* d;
+
+ QtUiTestWidgets();
+ QObject* findWidget(QtUiTest::WidgetType);
+ QObject* testWidget(QObject*,QByteArray const&);
+
+ void refreshPlugins();
+ void clear();
+
+ Q_PRIVATE_SLOT(d, void _q_objectDestroyed())
+ Q_PRIVATE_SLOT(d, void _q_postNextKeyEvent())
+ Q_PRIVATE_SLOT(d, void _q_postNextMouseEvent())
+
+ friend QObject* QtUiTest::testWidget(QObject*,const char*);
+ friend QObject* QtUiTest::findWidget(QtUiTest::WidgetType);
+};
+
+#endif
+
diff --git a/libqtuitest/recordevent_p.h b/libqtuitest/recordevent_p.h
new file mode 100644
index 0000000..f8ad42a
--- /dev/null
+++ b/libqtuitest/recordevent_p.h
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef RECORDEVENT_P_H
+#define RECORDEVENT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the QtUiTest API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QString>
+#include <QVariant>
+
+struct RecordEvent {
+ enum Type {
+ GotFocus,
+ Entered,
+ Selected,
+ Activated,
+ CheckStateChanged,
+ TitleChanged,
+ MessageBoxShown
+ };
+ Type type;
+ QString widget;
+ QString focusWidget;
+ QVariant data;
+};
+
+#define Q_DECLARE_METATYPE_STREAM(TYPE) \
+ QT_BEGIN_NAMESPACE \
+ template <> \
+ struct QMetaTypeId< TYPE > \
+ { \
+ enum { Defined = 1 }; \
+ static int qt_metatype_id() \
+ { \
+ static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
+ if (!metatype_id) { \
+ metatype_id = qRegisterMetaType< TYPE >(#TYPE, \
+ reinterpret_cast< TYPE *>(quintptr(-1))); \
+ qRegisterMetaTypeStreamOperators< TYPE >(#TYPE); \
+ } \
+ return metatype_id; \
+ } \
+ }; \
+ QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE_STREAM(RecordEvent);
+Q_DECLARE_METATYPE_STREAM(QList<RecordEvent>);
+
+inline bool operator==(RecordEvent const& a, RecordEvent const& b)
+{ return a.type == b.type && a.widget == b.widget && a.focusWidget == b.focusWidget && a.data == b.data; }
+
+inline bool operator!=(RecordEvent const& a, RecordEvent const& b)
+{ return !(a == b); }
+
+inline QDataStream &operator<<(QDataStream &out, const RecordEvent &re)
+{ return (out << static_cast<int>(re.type) << re.widget << re.focusWidget << re.data); }
+
+inline QDataStream &operator>>(QDataStream &in, RecordEvent &re)
+{
+ int reType;
+ QDataStream &ret = (in >> reType >> re.widget >> re.focusWidget >> re.data);
+ re.type = static_cast<RecordEvent::Type>(reType);
+ return ret;
+}
+
+inline QDataStream &operator<<(QDataStream &out, const QList<RecordEvent> &l)
+{
+ out << l.count();
+ foreach (RecordEvent re, l) {
+ out << re;
+ }
+ return out;
+}
+inline QDataStream &operator>>(QDataStream &in, QList<RecordEvent> &l)
+{
+ int count = 0;
+ in >> count;
+ RecordEvent re;
+ for (int i = 0; i < count; ++i) {
+ in >> re;
+ l << re;
+ }
+ return in;
+}
+
+#endif
+
diff --git a/libqtuitest/testwidget.cpp b/libqtuitest/testwidget.cpp
new file mode 100644
index 0000000..15f5043
--- /dev/null
+++ b/libqtuitest/testwidget.cpp
@@ -0,0 +1,298 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testwidget.h"
+
+#include <QAbstractScrollArea>
+#include <QApplication>
+#include <QScrollBar>
+#include <QVariant>
+#include <QWidget>
+#include <QGraphicsProxyWidget>
+#include <QInputContext>
+
+namespace QtUiTest {
+
+TestWidget::TestWidget(QObject* _q)
+ : q(qobject_cast<QWidget*>(_q))
+{ q->installEventFilter(this); }
+
+bool TestWidget::eventFilter(QObject*,QEvent* e)
+{
+ if (e->type() == QEvent::FocusIn) {
+ emit gotFocus();
+ }
+ return false;
+}
+
+const QRect& TestWidget::geometry() const
+{ return q->geometry(); }
+
+QRect TestWidget::rect() const
+{ return q->rect(); }
+
+bool TestWidget::isVisible() const
+{ return q->isVisible(); }
+
+QRegion TestWidget::visibleRegion() const
+{ return q->visibleRegion(); }
+
+bool TestWidget::ensureVisibleRegion(const QRegion& region)
+{
+ if (region.intersected(visibleRegion()) == region) return true;
+
+ if (!QtUiTest::mousePreferred()) {
+ /*
+ FIXME this is technically not correct, since we're assuming
+ that giving the widget keyboard focus makes the entire widget
+ visible. A low priority fix until we come across a case where
+ this matters.
+ */
+ return setFocus();
+ }
+
+ /* Try to find a scroll area which contains this widget, then scroll. */
+
+ QAbstractScrollArea *sa = 0;
+ QWidget *parent = q->parentWidget();
+ while (parent && !sa) {
+ sa = qobject_cast<QAbstractScrollArea*>(parent);
+ parent = parent->parentWidget();
+ }
+
+ if (!sa) return false;
+
+ /* Figure out the points to click for scrolling in each direction */
+ QScrollBar *vbar = sa->verticalScrollBar();
+ QScrollBar *hbar = sa->horizontalScrollBar();
+ QPoint up = vbar->mapToGlobal(QPoint(vbar->width()/2,5));
+ QPoint down = vbar->mapToGlobal(QPoint(vbar->width()/2,vbar->height()-5));
+ QPoint left = hbar->mapToGlobal(QPoint(5, hbar->height()/2));
+ QPoint right = hbar->mapToGlobal(QPoint(hbar->width()-5,hbar->height()/2));
+
+ QRect brect_origin = region.boundingRect();
+ QRect brect = brect_origin;
+ brect.moveTopLeft(q->mapTo(sa, brect.topLeft()));
+
+ static const int MAX_CLICKS = 200;
+ int clicks = 0;
+
+ /* Handle up... */
+ while (brect.top() < 0) {
+ if (!vbar->isVisible()) return false;
+ QtUiTest::mouseClick(up);
+ QtUiTest::waitForSignal(vbar, SIGNAL(valueChanged(int)));
+ brect = brect_origin;
+ brect.moveTopLeft(q->mapTo(sa, brect.topLeft()));
+ if (++clicks > MAX_CLICKS) return false;
+ }
+ /* Handle down... */
+ while (brect.bottom() > sa->height()) {
+ if (!vbar->isVisible()) return false;
+ QtUiTest::mouseClick(down);
+ QtUiTest::waitForSignal(vbar, SIGNAL(valueChanged(int)));
+ brect = brect_origin;
+ brect.moveTopLeft(q->mapTo(sa, brect.topLeft()));
+ if (++clicks > MAX_CLICKS) return false;
+ }
+ /* Handle left... */
+ while (brect.left() < 0) {
+ if (!hbar->isVisible()) return false;
+ QtUiTest::mouseClick(left);
+ QtUiTest::waitForSignal(hbar, SIGNAL(valueChanged(int)));
+ brect = brect_origin;
+ brect.moveTopLeft(q->mapTo(sa, brect.topLeft()));
+ if (++clicks > MAX_CLICKS) return false;
+ }
+ /* Handle right... */
+ while (brect.right() > sa->width()) {
+ if (!hbar->isVisible()) return false;
+ QtUiTest::mouseClick(right);
+ QtUiTest::waitForSignal(hbar, SIGNAL(valueChanged(int)));
+ brect = brect_origin;
+ brect.moveTopLeft(q->mapTo(sa, brect.topLeft()));
+ if (++clicks > MAX_CLICKS) return false;
+ }
+ return true;
+}
+
+const QObjectList &TestWidget::children() const
+{ return q->children(); }
+
+QObject* TestWidget::parent() const
+{ return q->graphicsProxyWidget() ? q->graphicsProxyWidget() : q->parent(); }
+
+QString TestWidget::windowTitle() const
+{ return q->windowTitle(); }
+
+QPoint TestWidget::mapToGlobal(QPoint const &local) const
+{
+ QGraphicsProxyWidget *pw;
+ if ( (pw = q->graphicsProxyWidget()) ) {
+ QtUiTest::Widget *w = qtuitest_cast<QtUiTest::Widget*>(pw);
+ if (w) {
+ return w->mapToGlobal(local);
+ }
+ }
+ return q->mapToGlobal(local);
+}
+
+QPoint TestWidget::mapFromGlobal(QPoint const &global) const
+{
+ return q->mapFromGlobal(global);
+}
+
+bool TestWidget::hasFocus() const
+{
+ return q->hasFocus();
+}
+
+Qt::WindowFlags TestWidget::windowFlags() const
+{
+ return q->windowFlags();
+}
+
+bool TestWidget::canEnter(QVariant const&) const
+{
+ return false;
+}
+
+bool TestWidget::enter(QVariant const& item, bool noCommit)
+{
+ Q_UNUSED(noCommit);
+ if (!hasFocus() && !setFocus()) return false;
+
+ using namespace QtUiTest;
+
+ /* If there's text currently in the field then erase it first */
+ if (QtUiTest::mousePreferred()) {
+ return false;
+ }
+
+ foreach (QChar const& c, item.toString()) {
+ keyClick( asciiToKey(c.toLatin1()), asciiToModifiers(c.toLatin1()) );
+ }
+ return true;
+}
+
+void TestWidget::focusOutEvent()
+{
+}
+
+#ifdef Q_WS_QWS
+bool TestWidget::hasEditFocus() const
+{ return q->hasEditFocus(); }
+#endif
+
+bool TestWidget::setEditFocus(bool enable)
+{
+ if (hasEditFocus() == enable) return true;
+
+ if (!hasFocus()) {
+ if (!setFocus()) return false;
+ }
+
+ // It is possible that giving us regular focus also gave us edit focus.
+ if (hasEditFocus() == enable) return true;
+
+#ifdef Q_WS_QWS
+ if (!QtUiTest::keyClick(q, QtUiTest::Key_Activate)) return false;
+ if (hasEditFocus() != enable && !QtUiTest::waitForEvent(q, enable ? QEvent::EnterEditFocus : QEvent::LeaveEditFocus)) {
+ return false;
+ }
+ return (hasEditFocus() == enable);
+#else
+ return true;
+#endif
+}
+
+QObject* TestWidget::focusProxy() const
+{
+ return q->focusProxy();
+}
+
+Qt::FocusPolicy TestWidget::focusPolicy () const
+{
+ return q->focusPolicy();
+}
+
+bool TestWidget::canWrap(QObject *o)
+{ return qobject_cast<QWidget*>(o); }
+
+QString TestWidget::printable(QString const& str)
+{
+ QString ret(str);
+
+ ret.replace(QChar::Nbsp, " ");
+ ret.remove(QChar(0x200E));
+ ret.remove(QChar(0x200F));
+ ret.remove(QChar(0x00AD));
+
+ return ret;
+}
+
+bool TestWidget::grabPixmap(QPixmap &pixmap) const
+{
+ pixmap = QPixmap::grabWidget( q );
+ return true;
+}
+
+QString TestWidget::labelText(const QString& text)
+{
+ return text.trimmed().replace(QRegExp("&(.)"), "\\1");
+}
+
+QVariant TestWidget::getProperty(const QString& name) const
+{
+ return q->property(name.toAscii());
+}
+
+bool TestWidget::setProperty(const QString& name, const QVariant& value)
+{
+ return q->setProperty(name.toAscii(), value);
+}
+
+QObject* TestWidget::inputProxy() const
+{
+ return q->inputContext();
+}
+
+} \ No newline at end of file
diff --git a/libqtuitest/testwidget.h b/libqtuitest/testwidget.h
new file mode 100644
index 0000000..6fb0dc5
--- /dev/null
+++ b/libqtuitest/testwidget.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTWIDGET_H
+#define TESTWIDGET_H
+
+#include <QObject>
+#include <qtuitestwidgetinterface.h>
+
+class QWidget;
+
+namespace QtUiTest {
+
+class QTUITEST_EXPORT TestWidget : public QObject, public QtUiTest::Widget,
+ public QtUiTest::InputWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(QtUiTest::Widget QtUiTest::InputWidget)
+
+public:
+ TestWidget(QObject*);
+
+ virtual const QRect& geometry() const;
+ virtual QRect rect() const;
+ virtual bool isVisible() const;
+ virtual QRegion visibleRegion() const;
+ virtual const QObjectList &children() const;
+ virtual QObject* parent() const;
+ virtual QString windowTitle() const;
+ virtual QPoint mapToGlobal(QPoint const&) const;
+ virtual QPoint mapFromGlobal(QPoint const&) const;
+ virtual bool hasFocus() const;
+ virtual Qt::WindowFlags windowFlags() const;
+ virtual bool ensureVisibleRegion(QRegion const&);
+ virtual bool canEnter(QVariant const&) const;
+ virtual bool enter(QVariant const&,bool);
+ virtual void focusOutEvent();
+
+#ifdef Q_WS_QWS
+ virtual bool hasEditFocus() const;
+#endif
+ virtual bool setEditFocus(bool);
+ virtual QObject* focusProxy() const;
+ virtual Qt::FocusPolicy focusPolicy () const;
+ virtual bool grabPixmap(QPixmap &pixmap) const;
+
+ static bool canWrap(QObject*);
+ static QString printable(QString const&);
+ static QString labelText(QString const&);
+ virtual QVariant getProperty(const QString&) const;
+ virtual bool setProperty(const QString&, const QVariant&);
+ virtual QObject *inputProxy() const;
+
+signals:
+ void gotFocus();
+
+protected:
+ bool eventFilter(QObject*,QEvent*);
+
+private:
+ QWidget *q;
+};
+
+}
+
+#endif
+
diff --git a/plugins/plugins.pro b/plugins/plugins.pro
new file mode 100644
index 0000000..84960fd
--- /dev/null
+++ b/plugins/plugins.pro
@@ -0,0 +1,4 @@
+TEMPLATE=subdirs
+SUBDIRS=\
+ qtuitest_widgets \
+ styles
diff --git a/plugins/qtuitest_widgets/hbwidgets/hbwidgets.pro b/plugins/qtuitest_widgets/hbwidgets/hbwidgets.pro
new file mode 100644
index 0000000..b032c7d
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/hbwidgets.pro
@@ -0,0 +1,59 @@
+SOURCES += \
+ testhbmainwindow.cpp \
+ testhblabel.cpp \
+ testhblineedit.cpp \
+ testhbcombobox.cpp \
+ testhbwidget.cpp \
+ testhbabstractitemview.cpp \
+ testhbabstractviewitem.cpp \
+ testhbabstractbutton.cpp \
+ testhbpushbutton.cpp \
+ testhbinputmethod.cpp \
+ testhbfactory.cpp
+
+HEADERS += \
+ testhbmainwindow.h \
+ testhblabel.h \
+ testhblineedit.h \
+ testhbcombobox.h \
+ testhbwidget.h \
+ testhbabstractitemview.h \
+ testhbabstractviewitem.h \
+ testhbabstractbutton.h \
+ testhbpushbutton.h \
+ testhbinputmethod.h \
+ testhbfactory.h
+
+TEMPLATE=lib
+CONFIG+=plugin hb hb_install
+VPATH+=$$PWD
+INCLUDEPATH+=$$PWD
+INCLUDEPATH+=$$SRCROOT/libqtuitest
+TARGET=hbwidgets
+TARGET=$$qtLibraryTarget($$TARGET)
+
+unix:!symbian {
+ MOC_DIR=$$OUT_PWD/.moc
+ OBJECTS_DIR=$$OUT_PWD/.obj
+ target.path=$$[QT_INSTALL_PLUGINS]/qtuitest_widgets
+ INSTALLS+=target
+ LIBS+=-L$$BUILDROOT/lib -lqtuitest
+}
+
+symbian {
+ TARGET.EPOCALLOWDLLDATA=1
+ MOC_DIR=$$OUT_PWD/moc
+ OBJECTS_DIR=$$OUT_PWD/obj
+ LIBS+=-L$$OUT_PWD/ -lqtuitest
+}
+
+win32 {
+ CONFIG(debug,debug|release): LIBS+=-L$$BUILDROOT/lib -lqtuitestd
+ CONFIG(release,debug|release):LIBS+=-L$$BUILDROOT/lib -lqtuitest
+ target.path=$$[QT_INSTALL_PLUGINS]/qtuitest_widgets
+ INSTALLS+=target
+}
+
+mac {
+ LIBS+=-L$$BUILDROOT/lib -lqtuitest
+}
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhbabstractbutton.cpp b/plugins/qtuitest_widgets/hbwidgets/testhbabstractbutton.cpp
new file mode 100644
index 0000000..b097501
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhbabstractbutton.cpp
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testhbabstractbutton.h"
+
+#include <HbAbstractButton>
+#include <HbMainWindow>
+
+namespace QtUiTest {
+
+TestHbAbstractButton::TestHbAbstractButton(QObject *_q)
+ : TestHbWidget(_q), q(qobject_cast<HbAbstractButton*>(_q))
+{
+}
+
+Qt::CheckState TestHbAbstractButton::checkState() const
+{ return q->isChecked() ? Qt::Checked : Qt::Unchecked; }
+
+bool TestHbAbstractButton::setCheckState(Qt::CheckState state)
+{
+ if (state == checkState()) return true;
+ if (!q->isCheckable()) {
+ QtUiTest::setErrorString("This abstract button is not checkable.");
+ return false;
+ }
+ bool ret = activate();
+
+ if (ret && (state != checkState()) && !QtUiTest::waitForSignal(q, SIGNAL(toggled(bool)))) {
+ QtUiTest::setErrorString("Successfully activated button, but check state did not change "
+ "to expected value.");
+ return false;
+ }
+ return ret;
+}
+
+bool TestHbAbstractButton::activate()
+{
+ HbMainWindow *mw = q->mainWindow();
+ QtUiTest::mouseClick(mw->mapToGlobal(mw->mapFromScene(q->mapToScene(q->boundingRect().center()))));
+ QtUiTest::wait(500);
+ return true;
+}
+
+bool TestHbAbstractButton::canWrap(QObject *o)
+{ return qobject_cast<HbAbstractButton*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhbabstractbutton.h b/plugins/qtuitest_widgets/hbwidgets/testhbabstractbutton.h
new file mode 100644
index 0000000..e880906
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhbabstractbutton.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTHBABSTRACTBUTTON_H
+#define TESTHBABSTRACTBUTTON_H
+
+#include "testhbwidget.h"
+
+class HbAbstractButton;
+
+namespace QtUiTest {
+
+class TestHbAbstractButton : public TestHbWidget,
+ public QtUiTest::CheckWidget,
+ public QtUiTest::ActivateWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::CheckWidget
+ QtUiTest::ActivateWidget)
+
+public:
+ TestHbAbstractButton(QObject*);
+
+ virtual Qt::CheckState checkState() const;
+ virtual bool setCheckState(Qt::CheckState);
+ virtual bool activate();
+
+ static bool canWrap(QObject*);
+
+private:
+ HbAbstractButton *q;
+
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhbabstractitemview.cpp b/plugins/qtuitest_widgets/hbwidgets/testhbabstractitemview.cpp
new file mode 100644
index 0000000..543b12e
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhbabstractitemview.cpp
@@ -0,0 +1,282 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testhbabstractitemview.h"
+//#include "testwidgetslog.h"
+
+//#include <QListView>
+//#include <QTimer>
+//#include <QScrollBar>
+//#include <QComboBox>
+#include <HbAbstractViewItem>
+
+#include <QDebug>
+#include <qtuitestnamespace.h>
+
+namespace QtUiTest {
+
+TestHbAbstractItemView::TestHbAbstractItemView(QObject *_q)
+ : TestHbWidget(_q), q(qobject_cast<HbAbstractItemView*>(_q))
+{
+}
+
+QString TestHbAbstractItemView::selectedText() const
+{
+ return q->currentIndex().data().toString();
+}
+
+QString TestHbAbstractItemView::text() const
+{
+ return list().join("\n");
+}
+
+QStringList TestHbAbstractItemView::list() const
+{
+ class HbModelListGetter : public HbModelViewIterator<HbAbstractItemView>
+ {
+ public:
+ HbModelListGetter(HbAbstractItemView *view)
+ : HbModelViewIterator<HbAbstractItemView>(view) {};
+
+ QStringList getList() {
+ list.clear();
+ iterate(view()->rootIndex());
+ return list;
+ }
+ protected:
+ virtual void visit(QModelIndex const &index)
+ { list << itemForIndex(index); }
+
+ QStringList list;
+ };
+
+ return HbModelListGetter(q).getList();
+}
+
+QModelIndex TestHbAbstractItemView::indexForItem(QString const &item) const
+{
+ QModelIndex ret;
+
+ class HbModelIndexGetter : public HbModelViewIterator<HbAbstractItemView>
+ {
+ public:
+ HbModelIndexGetter(HbAbstractItemView *view, QString const &item)
+ : HbModelViewIterator<HbAbstractItemView>(view), matches(0), m_item(item) {};
+ QModelIndex index;
+ int matches;
+
+ protected:
+ void visit(QModelIndex const &idx) {
+
+ if (itemForIndex(idx) == m_item) {
+ ++matches;
+ index = idx;
+ }
+ }
+ private:
+ QString m_item;
+ };
+
+ HbModelIndexGetter indexGetter(q, item);
+ indexGetter.iterate(q->rootIndex());
+
+ // No matching item
+ if (!indexGetter.matches) {
+// TestWidgetsLog() << "no matching item for" << item;
+ }
+
+ // More than one matching item
+ else if (indexGetter.matches > 1) {
+ qWarning("QtUitest: more than one item matches '%s' in item view", qPrintable(item));
+// TestWidgetsLog() << indexGetter.matches << "matches for" << item;
+ }
+
+ else
+ ret = indexGetter.index;
+
+ return ret;
+}
+
+QModelIndex TestHbAbstractItemView::indexFromList(QVariantList const &list) const
+{
+ QVariantList indexList = list;
+ QModelIndex ret;
+ if (list.size() > 1) {
+ int column = indexList.takeLast().toInt();
+ int row = indexList.takeLast().toInt();
+ ret = q->model()->index(row, column, indexFromList(indexList));
+ }
+ return ret;
+}
+
+
+QVariantList TestHbAbstractItemView::listFromIndex(QModelIndex const &index) const
+{
+ QVariantList ret;
+ if (index.parent().isValid()) {
+ ret << listFromIndex(index.parent());
+ }
+ if (index.isValid()) {
+ ret << index.row() << index.column();
+ }
+
+ return ret;
+}
+
+QRect TestHbAbstractItemView::visualRect(QString const &item) const
+{
+ QRect ret;
+
+ QModelIndex index = indexForItem(item);
+
+ if (index.isValid()) {
+ HbAbstractViewItem *vItem = q->itemByIndex(index);
+ if (vItem) {
+ ret = vItem->boundingRect().toRect();
+// ret.moveTopLeft(vItem->mapToScene(QPoint()));
+ }
+ }
+
+ return ret;
+}
+
+bool TestHbAbstractItemView::isMultiSelection() const
+{ return (q->selectionMode() > HbAbstractItemView::SingleSelection); }
+
+bool TestHbAbstractItemView::canSelect(QString const &item) const
+{
+ if (q->selectionMode() == HbAbstractItemView::NoSelection)
+ return false;
+
+ return list().contains(item);
+}
+
+bool TestHbAbstractItemView::canSelectMulti(QStringList const &items) const
+{
+ if (!isMultiSelection())
+ return false;
+
+ QSet<QString> itemSet = items.toSet();
+ return ((itemSet & list().toSet()) == itemSet);
+}
+
+bool TestHbAbstractItemView::select(QString const &item)
+{
+ if (!canSelect(item)) {
+// TestWidgetsLog() << "can't select" << item;
+ return false;
+ }
+
+ if (!QtUiTest::mousePreferred() && (!setFocus() || !hasFocus())) {
+ QtUiTest::setErrorString("Couldn't give focus to item view");
+ return false;
+ }
+
+ return select(indexForItem(item));
+}
+
+bool TestHbAbstractItemView::select(QModelIndex const &index)
+{
+ if (QtUiTest::mousePreferred()) {
+ if (!ensureVisible(index)) {
+ return false;
+ }
+ HbAbstractViewItem *item = q->itemByIndex(index);
+ QtUiTest::ActivateWidget* aw = qtuitest_cast<QtUiTest::ActivateWidget*>(item);
+
+ if (aw) {
+ return aw->activate();
+ }
+ }
+
+ return false;
+}
+
+bool TestHbAbstractItemView::selectMulti(QStringList const &items)
+{
+ return false;
+}
+
+bool TestHbAbstractItemView::selectIndex(QVariantList const &indexList)
+{
+ QModelIndex idx = indexFromList(indexList);
+ if (idx.isValid()) {
+ return select(idx);
+ }
+ else {
+ QtUiTest::setErrorString("Invalid index");
+ return false;
+ }
+}
+
+QVariantList TestHbAbstractItemView::selectedIndex() const
+{
+ return listFromIndex(q->currentIndex());
+}
+
+bool TestHbAbstractItemView::ensureVisible(QString const &item)
+{
+ return ensureVisible(indexForItem(item));
+}
+
+bool TestHbAbstractItemView::ensureVisible(QModelIndex const &index)
+{
+ //FIXME: QtUiTest should simulate the input events required to scroll the view
+ q->scrollTo(index);
+ return true;
+}
+
+bool TestHbAbstractItemView::canEnter(QVariant const& item) const
+{
+ bool ret = false;
+ return ret;
+}
+
+bool TestHbAbstractItemView::enter(QVariant const& item, bool noCommit)
+{
+ bool ret = false;
+ return ret;
+}
+
+bool TestHbAbstractItemView::canWrap(QObject* o)
+{ return qobject_cast<HbAbstractItemView*>(o); }
+
+}
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhbabstractitemview.h b/plugins/qtuitest_widgets/hbwidgets/testhbabstractitemview.h
new file mode 100644
index 0000000..ec25ff5
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhbabstractitemview.h
@@ -0,0 +1,188 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTHBABSTRACTITEMVIEW_H
+#define TESTHBABSTRACTITEMVIEW_H
+
+#include "testhbwidget.h"
+#include <HbAbstractItemView>
+
+const int QTUITEST_MAX_LIST=15000;
+
+namespace QtUiTest {
+
+class TestHbAbstractItemView : public TestHbWidget,
+ public QtUiTest::TextWidget,
+ public QtUiTest::ListWidget,
+ public QtUiTest::SelectWidget,
+ public QtUiTest::IndexedWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::TextWidget
+ QtUiTest::ListWidget
+ QtUiTest::SelectWidget
+ QtUiTest::IndexedWidget)
+
+public:
+ TestHbAbstractItemView(QObject*);
+
+ virtual QString text() const;
+ virtual QString selectedText() const;
+
+ virtual QStringList list() const;
+ virtual QRect visualRect(QString const&) const;
+ virtual bool ensureVisible(QString const&);
+
+ virtual bool canEnter(QVariant const&) const;
+ virtual bool enter(QVariant const&,bool);
+
+ virtual bool isMultiSelection() const;
+ virtual bool canSelect(QString const&) const;
+ virtual bool canSelectMulti(QStringList const&) const;
+ virtual bool select(QString const&);
+ virtual bool selectMulti(QStringList const&);
+
+ virtual bool selectIndex(QVariantList const&);
+ virtual QVariantList selectedIndex() const;
+
+ static bool canWrap(QObject*);
+
+protected:
+ virtual QModelIndex indexForItem(QString const&) const;
+ virtual QModelIndex indexFromList(QVariantList const&) const;
+ virtual QVariantList listFromIndex(QModelIndex const&) const;
+ virtual bool ensureVisible(QModelIndex const&);
+ virtual bool select(QModelIndex const&);
+
+signals:
+ void selected(const QString&);
+
+private slots:
+ void on_activated(QModelIndex const&);
+
+private:
+ HbAbstractItemView *q;
+};
+
+template <typename T>
+class HbModelViewIterator
+{
+public:
+ HbModelViewIterator(T* view)
+ : m_view(view), count(0)
+ {}
+
+ virtual ~HbModelViewIterator()
+ {}
+
+ virtual void iterate(QModelIndex rootIndex = QModelIndex(), bool recurse=true)
+ {
+ QModelIndexList seen;
+ iterate(rootIndex, &seen, recurse, true);
+ }
+
+protected:
+ T* view() const
+ { return m_view; }
+ QAbstractItemModel* model() const
+ { return m_view->model(); }
+
+ virtual void visit(QModelIndex const&) = 0;
+ virtual void overFlow()
+ {
+ QtUiTest::setErrorString("Maximum number of items exceeded");
+ }
+ virtual bool isRowHidden(int, const QModelIndex&)
+ {
+ return false;
+ }
+ virtual QString itemForIndex(QModelIndex const& idx) const
+ {
+ if (idx.data().canConvert(QVariant::String)) {
+ return idx.data().toString();
+ } else if (idx.data().canConvert(QVariant::StringList)) {
+ return idx.data().toStringList().join(",");
+ }
+ return QString();
+ }
+
+private:
+ void iterate(QModelIndex const &index, QModelIndexList *seen, bool recurse, bool isRoot=false)
+ {
+ if (++count > QTUITEST_MAX_LIST) {
+ overFlow();
+ return;
+ }
+
+ if (index.isValid()) {
+ visit(index);
+ (*seen) << index;
+ }
+
+ for (int i = 0, max_i = model()->rowCount(index); i < max_i && count <= QTUITEST_MAX_LIST; ++i) {
+ if (isRowHidden(i, index)) {
+ continue;
+ }
+ for (int j = 0, max_j = model()->columnCount(index);
+ j < max_j && count <= QTUITEST_MAX_LIST; ++j) {
+ QModelIndex child;
+ if (model()->hasIndex(i, j, index)) {
+ child = model()->index(i, j, index);
+ }
+ if (child.isValid() && !seen->contains(child) && (isRoot || recurse)) {
+#if 0
+ /* Very verbose! */
+ qDebug() << "child at (" << i << "," << j << ")" << child.data();
+#endif
+ iterate(child, seen, recurse);
+ }
+ }
+ }
+ }
+
+ T *m_view;
+ int count;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhbabstractviewitem.cpp b/plugins/qtuitest_widgets/hbwidgets/testhbabstractviewitem.cpp
new file mode 100644
index 0000000..b266594
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhbabstractviewitem.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testhbabstractviewitem.h"
+
+#include <HbAbstractViewItem>
+#include <HbMainWindow>
+
+namespace QtUiTest {
+
+TestHbAbstractViewItem::TestHbAbstractViewItem(QObject *_q)
+ : TestHbWidget(_q), q(qobject_cast<HbAbstractViewItem*>(_q))
+{
+}
+
+bool TestHbAbstractViewItem::activate()
+{
+ HbMainWindow *mw = q->mainWindow();
+ QtUiTest::mouseClick(mw->mapToGlobal(mw->mapFromScene(q->mapToScene(q->boundingRect().center()))));
+ QtUiTest::wait(500);
+ return true;
+}
+
+QString TestHbAbstractViewItem::text() const
+{
+ QString ret;
+ return ret;
+}
+
+bool TestHbAbstractViewItem::canWrap(QObject *o)
+{ return qobject_cast<HbAbstractViewItem*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhbabstractviewitem.h b/plugins/qtuitest_widgets/hbwidgets/testhbabstractviewitem.h
new file mode 100644
index 0000000..dc74664
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhbabstractviewitem.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTHBABSTRACTVIEWITEM_H
+#define TESTHBABSTRACTVIEWITEM_H
+
+#include "testhbwidget.h"
+class HbAbstractViewItem;
+
+namespace QtUiTest {
+
+class TestHbAbstractViewItem : public TestHbWidget,
+ public QtUiTest::ActivateWidget,
+ public QtUiTest::TextWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::ActivateWidget
+ QtUiTest::TextWidget)
+
+public:
+ TestHbAbstractViewItem(QObject*);
+
+ virtual bool activate();
+ virtual QString text() const;
+
+ static bool canWrap(QObject*);
+
+protected:
+ bool activate(QtUiTest::InputOption);
+
+private:
+ HbAbstractViewItem *q;
+// bool m_pressed;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhbcombobox.cpp b/plugins/qtuitest_widgets/hbwidgets/testhbcombobox.cpp
new file mode 100644
index 0000000..7096314
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhbcombobox.cpp
@@ -0,0 +1,175 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testhbcombobox.h"
+
+#include <qtuitestnamespace.h>
+
+#include <HbComboBox>
+#include <HbListView>
+#include <HbMainWindow>
+#include <HbInputMethod>
+
+#include <QDebug>
+
+namespace QtUiTest {
+
+TestHbComboBox::TestHbComboBox(QObject *_q)
+ : TestHbWidget(_q), q(qobject_cast<HbComboBox*>(_q))
+{
+}
+
+QString TestHbComboBox::text() const
+{
+ return list().join("\n");
+}
+
+QString TestHbComboBox::selectedText() const
+{
+ return q->currentText();
+}
+
+QStringList TestHbComboBox::list() const
+{
+ return q->items();
+}
+
+QRect TestHbComboBox::visualRect(QString const &item) const
+{
+ QRect ret;
+ return ret;
+}
+
+QString TestHbComboBox::labelText() const
+{
+ QString ret = selectedText();
+ return ret;
+}
+
+QObject* TestHbComboBox::buddy() const
+{
+ return q;
+}
+
+bool TestHbComboBox::canSelect(QString const &item) const
+{ return list().contains(item); }
+
+bool TestHbComboBox::select(QString const &item)
+{
+ HbListView *lv = listView();
+ if (!lv || !lv->QGraphicsItem::isVisible()) {
+ // need to activate list view
+ QGraphicsItem *button = q->primitive(HbStyle::P_ComboBoxButton_toucharea);
+ HbMainWindow *mw = q->mainWindow();
+ if (button && mw) {
+ QtUiTest::mouseClick(mw->mapToGlobal(mw->mapFromScene(button->mapToScene(button->boundingRect().center()))));
+ QtUiTest::wait(500);
+ } else {
+ // Something wrong here...
+ return false;
+ }
+ if (!lv) lv = listView();
+ // TODO: The click may not have activated the dropdown - eg, if another combobox had its
+ // dropdown active. Need to fix this.
+ }
+
+ // At this point, the HbListView should be visible, should now call select on
+ // the listview...
+ QtUiTest::SelectWidget *sView = qtuitest_cast<QtUiTest::SelectWidget*>(lv);
+ return sView->select(item);
+}
+
+bool TestHbComboBox::canEnter(QVariant const& item) const
+{
+ if (q->isEditable()) {
+ if (!item.canConvert<QString>()) return false;
+ return true;
+/*
+ int dontcare = 0;
+ QString text = item.toString();
+ const HbValidator *validator = q->validator();
+ if (validator) {
+ return (QValidator::Acceptable==validator->validate(text, dontcare));
+ } else {
+ return true;
+ }
+*/
+ } else {
+ return canSelect(item.toString());
+ }
+}
+
+bool TestHbComboBox::enter(QVariant const& item, bool noCommit)
+{
+ if (q->isEditable()) {
+ HbMainWindow *mw = q->mainWindow();
+ QtUiTest::mouseClick(mw->mapToGlobal(mw->mapFromScene(q->mapToScene(q->boundingRect().center()))));
+ QtUiTest::wait(1000);
+ q->clear();
+ HbInputMethod::activeInputMethod()->receiveText(item.toString());
+ QtUiTest::wait(1000);
+ QtUiTest::mouseClick(mw->mapToGlobal(mw->mapFromScene(q->mapToScene(QPoint(-2, 0)))));
+ return true;
+ } else {
+ return select(item.toString());
+ }
+}
+
+bool TestHbComboBox::canWrap(QObject *o)
+{ return qobject_cast<HbComboBox*>(o); }
+
+HbListView *TestHbComboBox::listView()
+{
+ HbListView *ret = 0;
+ HbMainWindow *mw = q->mainWindow();
+ if (mw) {
+ foreach(QGraphicsItem *child, mw->items()) {
+ HbListView *lv = qgraphicsitem_cast<HbListView*>(child);
+ if (lv && lv->model() == q->model()) {
+ ret = lv;
+ break;
+ }
+ }
+ }
+ return ret;
+}
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhbcombobox.h b/plugins/qtuitest_widgets/hbwidgets/testhbcombobox.h
new file mode 100644
index 0000000..a75fab0
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhbcombobox.h
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTHBCOMBOBOX_H
+#define TESTHBCOMBOBOX_H
+
+#include "testhbwidget.h"
+
+class HbComboBox;
+class HbListView;
+
+namespace QtUiTest {
+
+class TestHbComboBox : public TestHbWidget,
+ public QtUiTest::TextWidget,
+ public QtUiTest::ListWidget,
+ public QtUiTest::LabelWidget,
+ public QtUiTest::InputWidget,
+ public QtUiTest::SelectWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::TextWidget
+ QtUiTest::ListWidget
+ QtUiTest::LabelWidget
+ QtUiTest::InputWidget
+ QtUiTest::SelectWidget)
+public:
+ TestHbComboBox(QObject*);
+
+ virtual QString text() const;
+ virtual QString selectedText() const;
+
+ virtual QStringList list() const;
+ virtual QRect visualRect(QString const&) const;
+
+ virtual QString labelText() const;
+ virtual QObject* buddy() const;
+
+ virtual bool canSelect(QString const&) const;
+ virtual bool select(QString const&);
+
+ virtual bool canEnter(QVariant const&) const;
+ virtual bool enter(QVariant const&,bool);
+
+ static bool canWrap(QObject*);
+
+signals:
+ void selected(QString const&);
+
+private:
+ bool selectWithKeys(QString const&);
+ HbListView *listView();
+
+ HbComboBox *q;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhbfactory.cpp b/plugins/qtuitest_widgets/hbwidgets/testhbfactory.cpp
new file mode 100644
index 0000000..9642b91
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhbfactory.cpp
@@ -0,0 +1,123 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testhbfactory.h"
+
+#include "testhbmainwindow.h"
+#include "testhbwidget.h"
+#include "testhbabstractbutton.h"
+#include "testhbpushbutton.h"
+#include "testhbabstractitemview.h"
+#include "testhblabel.h"
+#include "testhblineedit.h"
+#include "testhbcombobox.h"
+#include "testhbinputmethod.h"
+#include "testhbabstractviewitem.h"
+
+#include <QApplication>
+#include <HbInputMethod>
+
+namespace QtUiTest {
+
+TestHbFactory::TestHbFactory()
+{
+}
+
+QObject* TestHbFactory::find(QtUiTest::WidgetType type)
+{
+ if (type == InputMethod) {
+ return HbInputMethod::activeInputMethod();
+ }
+
+ return 0;
+}
+
+
+QObject* TestHbFactory::create(QObject* o)
+{
+ QObject* ret = 0;
+
+#define TRY(Klass) \
+ if (Klass::canWrap(o)) { \
+ ret = new Klass(o); \
+ break; \
+ }
+
+ /* Order is important here; classes should be listed in order of
+ * most to least derived. */
+
+ do {
+ TRY(TestHbComboBox);
+ TRY(TestHbLineEdit);
+ TRY(TestHbPushButton);
+ TRY(TestHbLabel);
+ TRY(TestHbAbstractItemView);
+ TRY(TestHbAbstractViewItem);
+ TRY(TestHbAbstractButton);
+ TRY(TestHbWidget);
+ TRY(TestHbInputMethod);
+ TRY(TestHbMainWindow);
+ } while(0);
+
+ return ret;
+}
+
+QStringList TestHbFactory::keys() const
+{
+ /* Order doesn't matter here. */
+ return QStringList()
+ << "HbMainWindow"
+ << "HbWidget"
+ << "HbLabel"
+ << "HbComboBox"
+ << "HbLineEdit"
+ << "HbAbstractItemView"
+ << "HbAbstractViewItem"
+ << "HbAbstractButton"
+ << "HbPushButton"
+ << "HbInputMethod"
+ ;
+}
+
+}
+#include <qplugin.h>
+Q_EXPORT_PLUGIN2(hbwidgets, QtUiTest::TestHbFactory)
+
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhbfactory.h b/plugins/qtuitest_widgets/hbwidgets/testhbfactory.h
new file mode 100644
index 0000000..4e7ee48
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhbfactory.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTHBFACTORY_H
+#define TESTHBFACTORY_H
+
+#include <QObject>
+#include <qtuitestwidgetinterface.h>
+
+namespace QtUiTest {
+
+class TestHbFactory : public QObject, public QtUiTest::WidgetFactory
+{
+ Q_OBJECT
+ Q_INTERFACES(QtUiTest::WidgetFactory)
+
+public:
+ TestHbFactory();
+
+ virtual QObject* find(QtUiTest::WidgetType);
+ virtual QObject* create(QObject*);
+ virtual QStringList keys() const;
+};
+
+}
+#endif \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhbinputmethod.cpp b/plugins/qtuitest_widgets/hbwidgets/testhbinputmethod.cpp
new file mode 100644
index 0000000..3632564
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhbinputmethod.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testhbinputmethod.h"
+
+#include <qtuitestnamespace.h>
+#include <HbInputMethod>
+
+#include <QDebug>
+
+namespace QtUiTest {
+
+TestHbInputMethod::TestHbInputMethod(QObject *_q)
+ : q(qobject_cast<HbInputMethod*>(_q))
+{
+}
+
+bool TestHbInputMethod::canEnter(QVariant const& item) const
+{
+ return true;
+}
+
+bool TestHbInputMethod::enter(QVariant const& item, bool noCommit)
+{
+ q->receiveText(item.toString());
+ q->setFocusWidget(0);
+ return true;
+}
+
+bool TestHbInputMethod::canWrap(QObject *o)
+{ return qobject_cast<HbInputMethod*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhbinputmethod.h b/plugins/qtuitest_widgets/hbwidgets/testhbinputmethod.h
new file mode 100644
index 0000000..71c144a
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhbinputmethod.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTHBINPUTMETHOD_H
+#define TESTHBINPUTMETHOD_H
+
+#include "testhbwidget.h"
+
+class HbInputMethod;
+
+namespace QtUiTest {
+
+class TestHbInputMethod : public QObject,
+ QtUiTest::InputWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::InputWidget)
+
+public:
+ TestHbInputMethod(QObject*);
+
+ virtual bool canEnter(QVariant const&) const;
+ virtual bool enter(QVariant const&,bool);
+
+ static bool canWrap(QObject*);
+
+private:
+ HbInputMethod *q;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhblabel.cpp b/plugins/qtuitest_widgets/hbwidgets/testhblabel.cpp
new file mode 100644
index 0000000..5c8b4fc
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhblabel.cpp
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testhblabel.h"
+//#include "testwidgetslog.h"
+
+#include <HbLabel>
+//#include <QGroupBox>
+
+namespace QtUiTest {
+
+TestHbLabel::TestHbLabel(QObject* _q)
+ : TestHbWidget(_q), q(qobject_cast<HbLabel*>(_q))
+{}
+
+QString TestHbLabel::text() const
+{
+ return q->plainText();
+}
+
+QString TestHbLabel::labelText() const
+{
+ return text();
+}
+
+QObject* TestHbLabel::buddy() const
+{
+return 0;// return q->buddy();
+}
+
+bool TestHbLabel::canWrap(QObject *o)
+{ return qobject_cast<HbLabel*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhblabel.h b/plugins/qtuitest_widgets/hbwidgets/testhblabel.h
new file mode 100644
index 0000000..ef3f73d
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhblabel.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTHBLABEL_H
+#define TESTHBLABEL_H
+
+#include "testhbwidget.h"
+
+class HbLabel;
+
+namespace QtUiTest {
+
+class TestHbLabel : public TestHbWidget,
+ public QtUiTest::LabelWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(QtUiTest::LabelWidget)
+
+public:
+ TestHbLabel(QObject*);
+
+ virtual bool ignoreScan() const { return true; }
+
+ virtual QString text() const;
+
+ virtual QString labelText() const;
+ virtual QObject* buddy() const;
+
+ static bool canWrap(QObject*);
+
+private:
+ static QString convertToPlainText(QString const&);
+ QString groupBoxName() const;
+
+ HbLabel *q;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhblineedit.cpp b/plugins/qtuitest_widgets/hbwidgets/testhblineedit.cpp
new file mode 100644
index 0000000..42d5aea
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhblineedit.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testhblineedit.h"
+
+#include <qtuitestnamespace.h>
+
+#include <HbLineEdit>
+#include <HbMainWindow>
+#include <HbInputMethod>
+
+#include <QDebug>
+
+namespace QtUiTest {
+
+TestHbLineEdit::TestHbLineEdit(QObject *_q)
+ : TestHbWidget(_q), q(qobject_cast<HbLineEdit*>(_q))
+{
+}
+
+QString TestHbLineEdit::text() const
+{
+ return q->text();
+}
+
+QString TestHbLineEdit::selectedText() const
+{
+ return q->selectedText();
+}
+
+bool TestHbLineEdit::canEnter(QVariant const& item) const
+{
+ //TODO
+ return true;
+}
+
+bool TestHbLineEdit::enter(QVariant const& item, bool noCommit)
+{
+ HbMainWindow *mw = q->mainWindow();
+ QtUiTest::mouseClick(mw->mapToGlobal(mw->mapFromScene(q->mapToScene(q->boundingRect().center()))));
+ QtUiTest::wait(1000);
+ //FIXME
+ q->setText(QString());
+ HbInputMethod::activeInputMethod()->receiveText(item.toString());
+ QtUiTest::wait(1000);
+ QtUiTest::mouseClick(mw->mapToGlobal(mw->mapFromScene(q->mapToScene(QPoint(-2, 0)))));
+ return true;
+}
+
+bool TestHbLineEdit::canWrap(QObject *o)
+{ return qobject_cast<HbLineEdit*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhblineedit.h b/plugins/qtuitest_widgets/hbwidgets/testhblineedit.h
new file mode 100644
index 0000000..f19505a
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhblineedit.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTHBLINEEDIT_H
+#define TESTHBLINEEDIT_H
+
+#include "testhbwidget.h"
+
+class HbLineEdit;
+
+namespace QtUiTest {
+
+class TestHbLineEdit : public TestHbWidget,
+ public QtUiTest::TextWidget,
+ public QtUiTest::InputWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::TextWidget
+ QtUiTest::InputWidget)
+
+public:
+ TestHbLineEdit(QObject*);
+
+ virtual QString text() const;
+ virtual QString selectedText() const;
+
+ virtual bool canEnter(QVariant const&) const;
+ virtual bool enter(QVariant const&,bool);
+
+ static bool canWrap(QObject*);
+
+private:
+ HbLineEdit *q;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhbmainwindow.cpp b/plugins/qtuitest_widgets/hbwidgets/testhbmainwindow.cpp
new file mode 100644
index 0000000..d0de71f
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhbmainwindow.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testhbmainwindow.h"
+
+#include <HbMainWindow>
+#include <HbInputMethod>
+
+namespace QtUiTest {
+
+TestHbMainWindow::TestHbMainWindow(QObject* _q)
+ : TestWidget(_q), q(qobject_cast<HbMainWindow*>(_q))
+{}
+
+QObjectList const& TestHbMainWindow::children() const
+{
+ m_children.clear();
+ foreach(QGraphicsItem *child, q->items()) {
+ QObject *obj = qgraphicsitem_cast<QGraphicsObject*>(child);
+ if (obj) {
+ m_children << obj;
+ }
+ }
+
+ return m_children;
+}
+
+bool TestHbMainWindow::canWrap(QObject *o)
+{ return qobject_cast<HbMainWindow*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhbmainwindow.h b/plugins/qtuitest_widgets/hbwidgets/testhbmainwindow.h
new file mode 100644
index 0000000..05daa3a
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhbmainwindow.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTHBMAINWINDOW_H
+#define TESTHBMAINWINDOW_H
+
+#include <testwidget.h>
+
+class HbMainWindow;
+
+namespace QtUiTest {
+
+class TestHbMainWindow : public TestWidget
+{
+ Q_OBJECT
+
+public:
+ TestHbMainWindow(QObject*);
+ static bool canWrap(QObject*);
+
+ virtual QObjectList const& children() const;
+
+private:
+ HbMainWindow* q;
+
+ mutable QObjectList m_children;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhbpushbutton.cpp b/plugins/qtuitest_widgets/hbwidgets/testhbpushbutton.cpp
new file mode 100644
index 0000000..7b8138c
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhbpushbutton.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testhbpushbutton.h"
+
+#include <HbPushButton>
+
+namespace QtUiTest {
+
+TestHbPushButton::TestHbPushButton(QObject *_q)
+ : TestHbAbstractButton(_q), q(qobject_cast<HbPushButton*>(_q))
+{
+}
+
+QString TestHbPushButton::labelText() const
+{
+ return q->text();
+}
+
+QObject* TestHbPushButton::buddy() const
+{
+ return q;
+}
+
+bool TestHbPushButton::canWrap(QObject *o)
+{ return qobject_cast<HbPushButton*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhbpushbutton.h b/plugins/qtuitest_widgets/hbwidgets/testhbpushbutton.h
new file mode 100644
index 0000000..0f6ffce
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhbpushbutton.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTHBPUSHBUTTON_H
+#define TESTHBPUSHBUTTON_H
+
+#include "testhbabstractbutton.h"
+
+class HbPushButton;
+
+namespace QtUiTest {
+
+class TestHbPushButton : public TestHbAbstractButton,
+ public QtUiTest::LabelWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::LabelWidget)
+
+public:
+ TestHbPushButton(QObject*);
+
+ virtual QString labelText() const;
+ virtual QObject* buddy() const;
+
+ static bool canWrap(QObject*);
+
+private:
+ HbPushButton *q;
+
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhbwidget.cpp b/plugins/qtuitest_widgets/hbwidgets/testhbwidget.cpp
new file mode 100644
index 0000000..26354cf
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhbwidget.cpp
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testhbwidget.h"
+
+#include <qgraphicsview.h>
+#include <QDebug>
+
+namespace QtUiTest {
+
+TestHbWidget::TestHbWidget(QObject* _q)
+ : q(qobject_cast<HbWidget*>(_q))
+{
+}
+
+// As the item may be transformed (eg, rotated relative to view) the
+// area of the bounding rect may be considerably larger than that of the item.
+const QRect& TestHbWidget::geometry() const
+{
+ QGraphicsView *view = q->scene()->views().first();
+ m_geometry = view->mapFromScene(q->sceneBoundingRect()).boundingRect();
+
+ return m_geometry;
+}
+
+bool TestHbWidget::isVisible() const
+{
+ return q->isVisibleTo(0);
+}
+
+QRegion TestHbWidget::visibleRegion() const
+{
+ //FIXME
+
+ QRegion ret;
+
+ if (isVisible()) {
+ ret = q->boundingRegion(QTransform());
+ }
+
+ return ret;
+}
+
+const QObjectList& TestHbWidget::children() const
+{
+ return q->children();
+}
+
+QObject* TestHbWidget::parent() const
+{
+ return q->scene()->views().first();
+}
+
+QPoint TestHbWidget::mapToGlobal(const QPoint& pos) const
+{
+ QPointF posf(pos);
+ QGraphicsView *view = q->scene()->views().first();
+ return view->mapToGlobal(view->mapFromScene(q->mapToScene(posf)));
+}
+
+QPoint TestHbWidget::mapFromGlobal(const QPoint& pos) const
+{
+ QGraphicsView *view = q->scene()->views().first();
+ return q->mapFromScene(view->mapToScene(pos)).toPoint();
+}
+
+bool TestHbWidget::ensureVisibleRegion(const QRegion&)
+{ return true; }
+
+bool TestHbWidget::hasFocus() const
+{ return q->hasFocus(); }
+
+bool TestHbWidget::grabPixmap(QPixmap &pixmap) const
+{
+ QGraphicsView *view = q->scene()->views().first();
+ pixmap = QPixmap::grabWidget( view, geometry() );
+ return true;
+}
+
+bool TestHbWidget::canWrap(QObject *o)
+{
+ return qobject_cast<HbWidget*>(o); }
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/hbwidgets/testhbwidget.h b/plugins/qtuitest_widgets/hbwidgets/testhbwidget.h
new file mode 100644
index 0000000..f1c225f
--- /dev/null
+++ b/plugins/qtuitest_widgets/hbwidgets/testhbwidget.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTHBWIDGET_H
+#define TESTHBWIDGET_H
+
+#include <HbWidget>
+#include <QRect>
+#include <qtuitestwidgetinterface.h>
+
+namespace QtUiTest {
+
+class TestHbWidget : public QObject,
+ public QtUiTest::Widget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::Widget)
+
+public:
+ TestHbWidget(QObject*);
+
+ virtual const QRect& geometry() const;
+ virtual bool isVisible() const;
+ virtual QRegion visibleRegion() const;
+ virtual const QObjectList &children() const;
+ virtual QObject* parent() const;
+ virtual QPoint mapToGlobal(const QPoint&) const;
+ virtual QPoint mapFromGlobal(const QPoint&) const;
+ virtual bool ensureVisibleRegion(const QRegion&);
+ virtual bool hasFocus() const;
+ virtual bool grabPixmap(QPixmap &pixmap) const;
+
+ static bool canWrap(QObject*);
+
+private:
+ HbWidget* q;
+
+protected:
+ mutable QObjectList m_children;
+ mutable QRect m_geometry;
+};
+
+}
+#endif \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qgraphicsviewwidgets/qgraphicsviewwidgets.pro b/plugins/qtuitest_widgets/qgraphicsviewwidgets/qgraphicsviewwidgets.pro
new file mode 100644
index 0000000..2905828
--- /dev/null
+++ b/plugins/qtuitest_widgets/qgraphicsviewwidgets/qgraphicsviewwidgets.pro
@@ -0,0 +1,50 @@
+SOURCES += \
+ testgraphicsitem.cpp \
+ testgraphicsproxywidget.cpp \
+ testgraphicstextitem.cpp \
+ testgraphicswidget.cpp \
+ testgraphicsview.cpp \
+ testgraphicsviewfactory.cpp
+
+HEADERS += \
+ testgraphicsitem.h \
+ testgraphicsproxywidget.h \
+ testgraphicstextitem.h \
+ testgraphicswidget.h \
+ testgraphicsview.h \
+ testgraphicsviewfactory.h
+
+TEMPLATE=lib
+CONFIG+=plugin
+VPATH+=$$PWD
+INCLUDEPATH+=$$PWD
+INCLUDEPATH+=$$SRCROOT/libqtuitest
+TARGET=qgraphicsviewwidgets
+TARGET=$$qtLibraryTarget($$TARGET)
+
+unix:!symbian {
+ MOC_DIR=$$OUT_PWD/.moc
+ OBJECTS_DIR=$$OUT_PWD/.obj
+ target.path=$$[QT_INSTALL_PLUGINS]/qtuitest_widgets
+ INSTALLS+=target
+ LIBS+=-L$$BUILDROOT/lib -lqtuitest
+}
+
+symbian {
+ TARGET.EPOCALLOWDLLDATA=1
+ MOC_DIR=$$OUT_PWD/moc
+ OBJECTS_DIR=$$OUT_PWD/obj
+ LIBS+=-L$$OUT_PWD/ -lqtuitest
+}
+
+win32 {
+ CONFIG(debug,debug|release): LIBS+=-L$$BUILDROOT/libqtuitest -lqtuitestd
+ CONFIG(release,debug|release):LIBS+=-L$$BUILDROOT/libqtuitest -lqtuitest
+ target.path=$$[QT_INSTALL_PLUGINS]/qtuitest_widgets
+ INSTALLS+=target
+}
+
+mac {
+ LIBS+=-L$$BUILDROOT/lib -lqtuitest
+}
+
diff --git a/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsitem.cpp b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsitem.cpp
new file mode 100644
index 0000000..f518c05
--- /dev/null
+++ b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsitem.cpp
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testgraphicsitem.h"
+#include "testgraphicsviewfactory.h"
+#include <qgraphicsview.h>
+#include <QDebug>
+
+namespace QtUiTest {
+
+TestGraphicsItem::TestGraphicsItem(QGraphicsItem* _q)
+ : q(_q)
+{}
+
+// As the item may be transformed (eg, rotated relative to view) the
+// area of the bounding rect may be considerably larger than that of the item.
+const QRect& TestGraphicsItem::geometry() const
+{
+ QGraphicsView *view = q->scene()->views().first();
+ m_geometry = view->mapFromScene(q->sceneBoundingRect()).boundingRect();
+
+ return m_geometry;
+}
+
+bool TestGraphicsItem::isVisible() const
+{
+ return q->isVisibleTo(0);
+}
+
+QRegion TestGraphicsItem::visibleRegion() const
+{
+ //FIXME
+
+ QRegion ret;
+
+ if (isVisible()) {
+ ret = q->boundingRegion(QTransform());
+ }
+
+ return ret;
+}
+
+const QObjectList& TestGraphicsItem::children() const
+{
+ m_children.clear();
+ foreach(QGraphicsItem *child, q->childItems()) {
+ QObject *obj = TestGraphicsViewFactory::supportedGraphicsItem(child);
+ if (obj)
+ m_children << obj;
+ }
+ return m_children;
+}
+
+QObject* TestGraphicsItem::parent() const
+{
+// return QObject::parent();
+ return q->scene()->views().first();
+}
+
+QPoint TestGraphicsItem::mapToGlobal(const QPoint& pos) const
+{
+ QPointF posf(pos);
+ QGraphicsView *view = q->scene()->views().first();
+ return view->mapToGlobal(view->mapFromScene(q->mapToScene(posf)));
+}
+
+QPoint TestGraphicsItem::mapFromGlobal(const QPoint& pos) const
+{
+ QGraphicsView *view = q->scene()->views().first();
+ return q->mapFromScene(view->mapToScene(pos)).toPoint();
+}
+
+bool TestGraphicsItem::ensureVisibleRegion(const QRegion&)
+{ return true; }
+
+bool TestGraphicsItem::hasFocus() const
+{ return q->hasFocus(); }
+
+#ifdef Q_WS_QWS
+bool TestGraphicsItem::hasEditFocus() const
+{ return hasFocus(); }
+
+bool TestGraphicsItem::setEditFocus(bool)
+{ return false; }
+#endif
+
+bool TestGraphicsItem::grabPixmap(QPixmap &pixmap) const
+{
+ QGraphicsView *view = q->scene()->views().first();
+ pixmap = QPixmap::grabWidget( view, geometry() );
+ return true;
+}
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsitem.h b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsitem.h
new file mode 100644
index 0000000..309d907
--- /dev/null
+++ b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsitem.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTGRAPHICSITEM_H
+#define TESTGRAPHICSITEM_H
+
+#include <QGraphicsItem>
+#include <QRect>
+#include <qtuitestwidgetinterface.h>
+
+namespace QtUiTest {
+
+class TestGraphicsItem : public QObject,
+ public QtUiTest::Widget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::Widget)
+
+public:
+ TestGraphicsItem(QGraphicsItem*);
+
+ virtual const QRect& geometry() const;
+ virtual bool isVisible() const;
+ virtual QRegion visibleRegion() const;
+ virtual const QObjectList &children() const;
+ virtual QObject* parent() const;
+ virtual QPoint mapToGlobal(const QPoint&) const;
+ virtual QPoint mapFromGlobal(const QPoint&) const;
+ virtual bool ensureVisibleRegion(const QRegion&);
+ virtual bool hasFocus() const;
+#ifdef Q_WS_QWS
+ virtual bool hasEditFocus() const;
+ virtual bool setEditFocus(bool);
+#endif
+ virtual bool grabPixmap(QPixmap &pixmap) const;
+
+private:
+ QGraphicsItem* q;
+
+protected:
+ mutable QObjectList m_children;
+ mutable QRect m_geometry;
+};
+
+}
+#endif \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsproxywidget.cpp b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsproxywidget.cpp
new file mode 100644
index 0000000..d442269
--- /dev/null
+++ b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsproxywidget.cpp
@@ -0,0 +1,256 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGraphicsProxyWidget>
+#include "testgraphicsproxywidget.h"
+#include <QWidget>
+
+namespace QtUiTest {
+
+TestGraphicsProxyWidget::TestGraphicsProxyWidget(QObject* _q)
+ : TestGraphicsItem(static_cast<QGraphicsProxyWidget*>(_q))
+ , q(static_cast<QGraphicsProxyWidget*>(_q))
+{}
+
+const QObjectList& TestGraphicsProxyWidget::children() const
+{
+ m_children.clear();
+ m_children << qobject_cast<QObject*>(q->widget());
+ return m_children;
+}
+
+bool TestGraphicsProxyWidget::canWrap(QObject *o)
+{ return qobject_cast<QGraphicsProxyWidget*>(o); }
+/*
+static const uint qt_meta_data_TestGraphicsProxyWidget[] = {
+
+ // content:
+ 1, // revision
+ 0, // classname
+ 0, 0, // classinfo
+ 0, 0, // methods
+ 0, 0, // properties
+ 0, 0, // enums/sets
+
+ 0 // eod
+};
+
+static const char qt_meta_stringdata_TestGraphicsProxyWidget[] = {
+ "TestFxItem\0"
+};
+
+const QMetaObject TestGraphicsProxyWidget::staticMetaObject = {
+ { &TestGraphicsItem::staticMetaObject, qt_meta_stringdata_TestGraphicsProxyWidget,
+ qt_meta_data_TestGraphicsProxyWidget, 0 }
+};
+
+const QMetaObject *TestGraphicsProxyWidget::metaObject() const
+{
+ return &staticMetaObject;
+}
+
+void *TestGraphicsProxyWidget::qt_metacast(const char *_clname)
+{
+ if (!_clname) return 0;
+
+ void* ret = 0;
+
+ do {
+#define DO(Type,String) \
+ if (!strcmp(_clname,#String) && qtuitest_cast<Type*>(q->widget())) { \
+ ret = static_cast<Type*>(this); \
+ break; \
+ }
+ // No need for Widget - TestGfxCanvasItem already handles it.
+ //DO(QtUiTest::Widget, QtUiTest::Widget);
+ //DO(QtUiTest::Widget, com.nokia.qt.QtUiTest.Widget/1.0);
+ DO(QtUiTest::CheckWidget, QtUiTest::CheckWidget);
+ DO(QtUiTest::CheckWidget, com.nokia.qt.QtUiTest.CheckWidget/1.0);
+ DO(QtUiTest::ActivateWidget, QtUiTest::ActivateWidget);
+ DO(QtUiTest::ActivateWidget, com.nokia.qt.QtUiTest.ActivateWidget/1.0);
+ DO(QtUiTest::LabelWidget, QtUiTest::LabelWidget);
+ DO(QtUiTest::LabelWidget, com.nokia.qt.QtUiTest.LabelWidget/1.0);
+ DO(QtUiTest::TextWidget, QtUiTest::TextWidget);
+ DO(QtUiTest::TextWidget, com.nokia.qt.QtUiTest.TextWidget/1.0);
+ DO(QtUiTest::ListWidget, QtUiTest::ListWidget);
+ DO(QtUiTest::ListWidget, com.nokia.qt.QtUiTest.ListWidget/1.0);
+ DO(QtUiTest::InputWidget, QtUiTest::InputWidget);
+ DO(QtUiTest::InputWidget, com.nokia.qt.QtUiTest.InputWidget/1.0);
+ DO(QtUiTest::SelectWidget, QtUiTest::SelectWidget);
+ DO(QtUiTest::SelectWidget, com.nokia.qt.QtUiTest.SelectWidget/1.0);
+#undef DO
+ } while(0);
+
+ if (!ret) ret = TestGraphicsItem::qt_metacast(_clname);
+
+ return ret;
+}
+
+bool TestGraphicsProxyWidget::activate()
+{
+ QtUiTest::ActivateWidget *w = qtuitest_cast<QtUiTest::ActivateWidget*>(q->widget());
+ if (w) return w->activate();
+ return false;
+}
+
+QString TestGraphicsProxyWidget::labelText() const
+{
+ QtUiTest::LabelWidget *w = qtuitest_cast<QtUiTest::LabelWidget*>(q->widget());
+ if (w) return w->labelText();
+ return QString();
+}
+
+QObject* TestGraphicsProxyWidget::buddy() const
+{
+ QObject *ret = 0;
+ QtUiTest::LabelWidget *w = qtuitest_cast<QtUiTest::LabelWidget*>(q->widget());
+ if (w) ret = w->buddy();
+ if (ret == q->widget()) ret = q;
+ return ret;
+}
+
+bool TestGraphicsProxyWidget::isTristate() const
+{
+ QtUiTest::CheckWidget *w = qtuitest_cast<QtUiTest::CheckWidget*>(q->widget());
+ if (w) return w->isTristate();
+ return false;
+}
+
+Qt::CheckState TestGraphicsProxyWidget::checkState() const
+{
+ QtUiTest::CheckWidget *w = qtuitest_cast<QtUiTest::CheckWidget*>(q->widget());
+ if (w) return w->checkState();
+ return Qt::CheckState(0);
+}
+
+bool TestGraphicsProxyWidget::setCheckState(Qt::CheckState state)
+{
+ QtUiTest::CheckWidget *w = qtuitest_cast<QtUiTest::CheckWidget*>(q->widget());
+ if (w) return w->setCheckState(state);
+ return false;
+}
+
+QString TestGraphicsProxyWidget::selectedText() const
+{
+ QtUiTest::TextWidget *w = qtuitest_cast<QtUiTest::TextWidget*>(q->widget());
+ if (w) return w->selectedText();
+ return QString();
+}
+
+QString TestGraphicsProxyWidget::text() const
+{
+ QtUiTest::TextWidget *w = qtuitest_cast<QtUiTest::TextWidget*>(q->widget());
+ if (w) return w->text();
+ return QString();
+}
+
+QStringList TestGraphicsProxyWidget::list() const
+{
+ QtUiTest::ListWidget *w = qtuitest_cast<QtUiTest::ListWidget*>(q->widget());
+ if (w) return w->list();
+ return QStringList();
+}
+
+QRect TestGraphicsProxyWidget::visualRect(const QString& item) const
+{
+ QtUiTest::ListWidget *w = qtuitest_cast<QtUiTest::ListWidget*>(q->widget());
+ if (w) return w->visualRect(item);
+ return QRect();
+}
+
+bool TestGraphicsProxyWidget::ensureVisible(const QString& item)
+{
+ QtUiTest::ListWidget *w = qtuitest_cast<QtUiTest::ListWidget*>(q->widget());
+ if (w) return w->ensureVisible(item);
+ return false;
+}
+
+bool TestGraphicsProxyWidget::canEnter(const QVariant& value) const
+{
+ QtUiTest::InputWidget *w = qtuitest_cast<QtUiTest::InputWidget*>(q->widget());
+ if (w) return w->canEnter(value);
+ return false;
+}
+
+bool TestGraphicsProxyWidget::enter(const QVariant& value, bool noCommit)
+{
+ QtUiTest::InputWidget *w = qtuitest_cast<QtUiTest::InputWidget*>(q->widget());
+ if (w) return w->enter(value, noCommit);
+ return false;
+}
+
+bool TestGraphicsProxyWidget::isMultiSelection() const
+{
+ QtUiTest::SelectWidget *w = qtuitest_cast<QtUiTest::SelectWidget*>(q->widget());
+ if (w) return w->isMultiSelection();
+ return false;
+}
+
+bool TestGraphicsProxyWidget::canSelect(const QString& item) const
+{
+ QtUiTest::SelectWidget *w = qtuitest_cast<QtUiTest::SelectWidget*>(q->widget());
+ if (w) return w->canSelect(item);
+ return false;
+}
+
+bool TestGraphicsProxyWidget::canSelectMulti(const QStringList& items) const
+{
+ QtUiTest::SelectWidget *w = qtuitest_cast<QtUiTest::SelectWidget*>(q->widget());
+ if (w) return w->canSelectMulti(items);
+ return false;
+}
+
+bool TestGraphicsProxyWidget::select(const QString& item)
+{
+ QtUiTest::SelectWidget *w = qtuitest_cast<QtUiTest::SelectWidget*>(q->widget());
+ if (w) return w->select(item);
+ return false;
+}
+
+bool TestGraphicsProxyWidget::selectMulti(const QStringList& items)
+{
+ QtUiTest::SelectWidget *w = qtuitest_cast<QtUiTest::SelectWidget*>(q->widget());
+ if (w) return w->selectMulti(items);
+ return false;
+}
+*/
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsproxywidget.h b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsproxywidget.h
new file mode 100644
index 0000000..9c11d9b
--- /dev/null
+++ b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsproxywidget.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTGRAPHICSPROXYWIDGET_H
+#define TESTGRAPHICSPROXYWIDGET_H
+
+#include "testgraphicsitem.h"
+#include <QGraphicsProxyWidget>
+
+namespace QtUiTest {
+
+class TestGraphicsProxyWidget : public TestGraphicsItem
+/*,
+ public QtUiTest::ActivateWidget,
+ public QtUiTest::LabelWidget,
+ public QtUiTest::CheckWidget,
+ public QtUiTest::TextWidget,
+ public QtUiTest::ListWidget,
+ public QtUiTest::InputWidget,
+ public QtUiTest::SelectWidget
+*/
+{
+ Q_OBJECT//_CHECK
+
+public:
+/* static const QMetaObject staticMetaObject;
+ virtual const QMetaObject *metaObject() const;
+ virtual void *qt_metacast(const char *);
+*/
+ TestGraphicsProxyWidget(QObject*);
+
+ virtual const QObjectList &children() const;
+
+ static bool canWrap(QObject*);
+/*
+ virtual bool activate();
+
+ virtual QString labelText() const;
+ virtual QObject* buddy() const;
+
+ virtual bool isTristate() const;
+ virtual Qt::CheckState checkState() const;
+ virtual bool setCheckState(Qt::CheckState);
+
+ virtual QString selectedText() const;
+ virtual QString text() const;
+
+ virtual QStringList list() const;
+ virtual QRect visualRect(const QString&) const;
+ virtual bool ensureVisible(const QString&);
+
+ virtual bool canEnter(const QVariant&) const;
+ virtual bool enter(const QVariant&,bool);
+
+ virtual bool isMultiSelection() const;
+
+ virtual bool canSelect(const QString&) const;
+ virtual bool canSelectMulti(const QStringList&) const;
+ virtual bool select(const QString&);
+ virtual bool selectMulti(const QStringList&);
+*/
+private:
+ QGraphicsProxyWidget* q;
+};
+
+}
+#endif \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicstextitem.cpp b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicstextitem.cpp
new file mode 100644
index 0000000..7070968
--- /dev/null
+++ b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicstextitem.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGraphicsTextItem>
+#include "testgraphicstextitem.h"
+
+namespace QtUiTest {
+
+TestGraphicsTextItem::TestGraphicsTextItem(QObject* _q)
+ : TestGraphicsItem(static_cast<QGraphicsTextItem*>(_q))
+ , q(static_cast<QGraphicsTextItem*>(_q))
+{}
+
+QString TestGraphicsTextItem::text() const
+{ return q->toPlainText(); }
+
+QString TestGraphicsTextItem::labelText() const
+{ return text(); }
+
+QObject* TestGraphicsTextItem::buddy() const
+{
+ return q;
+}
+
+bool TestGraphicsTextItem::canWrap(QObject *o)
+{ return qobject_cast<QGraphicsTextItem*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicstextitem.h b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicstextitem.h
new file mode 100644
index 0000000..48b1639
--- /dev/null
+++ b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicstextitem.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTGRAPHICSTEXTITEM_H
+#define TESTGRAPHICSTEXTITEM_H
+
+#include "testgraphicsitem.h"
+
+class QGraphicsTextItem;
+
+namespace QtUiTest {
+
+class TestGraphicsTextItem : public TestGraphicsItem,
+ public QtUiTest::TextWidget,
+ public QtUiTest::LabelWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(QtUiTest::TextWidget)
+ Q_INTERFACES(QtUiTest::LabelWidget)
+
+public:
+ TestGraphicsTextItem(QObject*);
+
+ virtual QString text() const;
+
+ virtual QString labelText() const;
+ virtual QObject* buddy() const;
+
+ static bool canWrap(QObject*);
+
+private:
+ QGraphicsTextItem* q;
+};
+
+}
+#endif \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsview.cpp b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsview.cpp
new file mode 100644
index 0000000..2bc1da1
--- /dev/null
+++ b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsview.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testgraphicsview.h"
+#include "testgraphicsviewfactory.h"
+
+#include <qgraphicsitem.h>
+#include <qgraphicsview.h>
+
+namespace QtUiTest {
+
+TestGraphicsView::TestGraphicsView(QObject* _q)
+ : TestWidget(_q), q(qobject_cast<QGraphicsView*>(_q))
+{}
+
+QObjectList const& TestGraphicsView::children() const
+{
+ m_children.clear();
+ foreach(QGraphicsItem *child, q->items()) {
+// if (child->parentItem()) continue;
+ QObject *obj = TestGraphicsViewFactory::supportedGraphicsItem(child);
+ if (obj)
+ m_children << obj;
+ }
+ return m_children;
+}
+
+bool TestGraphicsView::canWrap(QObject *o)
+{ return qobject_cast<QGraphicsView*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsview.h b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsview.h
new file mode 100644
index 0000000..0f98689
--- /dev/null
+++ b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsview.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTGRAPHICSVIEW_H
+#define TESTGRAPHICSVIEW_H
+
+#include <testwidget.h>
+
+class QGraphicsView;
+
+namespace QtUiTest {
+
+class TestGraphicsView : public TestWidget
+{
+ Q_OBJECT
+
+public:
+ TestGraphicsView(QObject*);
+ static bool canWrap(QObject*);
+
+ virtual QObjectList const& children() const;
+
+private:
+ QGraphicsView* q;
+
+ mutable QObjectList m_children;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsviewfactory.cpp b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsviewfactory.cpp
new file mode 100644
index 0000000..6aaeb79
--- /dev/null
+++ b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsviewfactory.cpp
@@ -0,0 +1,109 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testgraphicsviewfactory.h"
+
+#include "testgraphicsproxywidget.h"
+#include "testgraphicstextitem.h"
+#include "testgraphicsview.h"
+#include "testgraphicswidget.h"
+
+//#include "testwidgetslog.h"
+
+#include <QApplication>
+
+namespace QtUiTest {
+
+TestGraphicsViewFactory::TestGraphicsViewFactory()
+{
+}
+
+QObject* TestGraphicsViewFactory::create(QObject* o)
+{
+ QObject* ret = 0;
+
+#define TRY(Klass) \
+ if (Klass::canWrap(o)) { \
+ ret = new Klass(o); \
+ break; \
+ }
+
+ /* Order is important here; classes should be listed in order of
+ * most to least derived. */
+
+ do {
+ /* Qt Graphics View items */
+ TRY(TestGraphicsTextItem);
+ TRY(TestGraphicsProxyWidget);
+ TRY(TestGraphicsWidget);
+ TRY(TestGraphicsView);
+// TRY(TestGraphicsItem);
+ } while(0);
+
+// TestWidgetsLog() << o << ret;
+
+ return ret;
+}
+
+QStringList TestGraphicsViewFactory::keys() const
+{
+ /* Order doesn't matter here. */
+ return QStringList()
+ << "QGraphicsTextItem"
+ << "QGraphicsProxyWidget"
+ << "QGraphicsView"
+ << "QGraphicsWidget"
+ ;
+}
+
+QObject* TestGraphicsViewFactory::supportedGraphicsItem(QGraphicsItem* item)
+{
+ QObject *ret = 0;
+ if ( (ret = qgraphicsitem_cast<QGraphicsTextItem*>(item)) ) {return ret;}
+ if ( (ret = qobject_cast<QObject*>(qgraphicsitem_cast<QGraphicsProxyWidget*>(item))) ) {return ret;}
+ if ( (ret = qgraphicsitem_cast<QGraphicsWidget*>(item)) ) {return ret;}
+ return ret;
+}
+
+}
+#include <qplugin.h>
+Q_EXPORT_PLUGIN2(qtgraphicsviewwidgets, QtUiTest::TestGraphicsViewFactory)
+
diff --git a/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsviewfactory.h b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsviewfactory.h
new file mode 100644
index 0000000..f91c3e1
--- /dev/null
+++ b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicsviewfactory.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTGRAPHICSVIEWFACTORY_H
+#define TESTGRAPHICSVIEWFACTORY_H
+
+#include <QObject>
+#include <QGraphicsItem>
+#include <qtuitestwidgetinterface.h>
+
+namespace QtUiTest {
+
+class TestGraphicsViewFactory : public QObject, public QtUiTest::WidgetFactory
+{
+ Q_OBJECT
+ Q_INTERFACES(QtUiTest::WidgetFactory)
+
+public:
+ TestGraphicsViewFactory();
+
+ virtual QObject* create(QObject*);
+ virtual QStringList keys() const;
+
+ static QObject* supportedGraphicsItem(QGraphicsItem*);
+};
+
+}
+#endif \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicswidget.cpp b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicswidget.cpp
new file mode 100644
index 0000000..342f013
--- /dev/null
+++ b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicswidget.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGraphicsWidget>
+#include "testgraphicswidget.h"
+
+namespace QtUiTest {
+
+TestGraphicsWidget::TestGraphicsWidget(QObject* _q)
+ : TestGraphicsItem(static_cast<QGraphicsWidget*>(_q))
+ , q(static_cast<QGraphicsWidget*>(_q))
+{}
+
+bool TestGraphicsWidget::canWrap(QObject *o)
+{ return qobject_cast<QGraphicsWidget*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicswidget.h b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicswidget.h
new file mode 100644
index 0000000..ae63052
--- /dev/null
+++ b/plugins/qtuitest_widgets/qgraphicsviewwidgets/testgraphicswidget.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTGRAPHICSWIDGET_H
+#define TESTGRAPHICSWIDGET_H
+
+#include "testgraphicsitem.h"
+
+class QGraphicsWidget;
+
+namespace QtUiTest {
+
+class TestGraphicsWidget : public TestGraphicsItem
+{
+ Q_OBJECT
+
+public:
+ TestGraphicsWidget(QObject*);
+ static bool canWrap(QObject*);
+
+private:
+ QGraphicsWidget* q;
+};
+
+}
+#endif \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qmlwidgets/qmlwidgets.pro b/plugins/qtuitest_widgets/qmlwidgets/qmlwidgets.pro
new file mode 100644
index 0000000..1920030
--- /dev/null
+++ b/plugins/qtuitest_widgets/qmlwidgets/qmlwidgets.pro
@@ -0,0 +1,51 @@
+SOURCES += \
+ testdeclarativefactory.cpp \
+ testdeclarativeitem.cpp \
+ testdeclarativelistview.cpp \
+ testdeclarativetext.cpp \
+ testdeclarativetextinput.cpp \
+ testdeclarativeview.cpp \
+ testdeclarativemousearea.cpp
+
+HEADERS += \
+ testdeclarativefactory.h \
+ testdeclarativeitem.h \
+ testdeclarativelistview.h \
+ testdeclarativetext.h \
+ testdeclarativetextinput.h \
+ testdeclarativeview.h \
+ testdeclarativemousearea.h
+
+TEMPLATE=lib
+CONFIG+=plugin
+
+MOC_DIR=$$OUT_PWD/.moc
+OBJECTS_DIR=$$OUT_PWD/.obj
+VPATH+=$$PWD
+INCLUDEPATH+=$$PWD
+INCLUDEPATH+=$$SRCROOT/libqtuitest
+INCLUDEPATH+=$$SRCROOT/libqtwidgets
+QT+=declarative script opengl
+TARGET=qmlwidgets
+INCLUDEPATH+=$(HOME)/opengles2/SDKPackage/Builds/OGLES2/Include
+
+unix:!symbian {
+ MOC_DIR=$$OUT_PWD/.moc
+ OBJECTS_DIR=$$OUT_PWD/.obj
+ target.path=$$[QT_INSTALL_PLUGINS]/qtuitest_widgets
+ INSTALLS+=target
+ LIBS+=-L$$BUILDROOT/lib -lqtuitest
+}
+
+win32 {
+ CONFIG(debug,debug|release): LIBS+=$$BUILDROOT/libdebug/qtuitest.lib
+ CONFIG(release,debug|release):LIBS+=$$BUILDROOT/librelease/qtuitest.lib
+ target.path=$$[QT_INSTALL_PLUGINS]/qtuitest_widgets
+ INSTALLS+=target
+}
+
+contains(QT_CONFIG, webkit) {
+ QT+=webkit
+ SOURCES+=testdeclarativewebview.cpp
+ HEADERS+=testdeclarativewebview.h
+}
diff --git a/plugins/qtuitest_widgets/qmlwidgets/testdeclarativefactory.cpp b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativefactory.cpp
new file mode 100644
index 0000000..2a4495e
--- /dev/null
+++ b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativefactory.cpp
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testdeclarativefactory.h"
+#include "testdeclarativeitem.h"
+#include "testdeclarativetext.h"
+#include "testdeclarativetextinput.h"
+#include "testdeclarativemousearea.h"
+#include "testdeclarativelistview.h"
+#include "testdeclarativewebview.h"
+#include "testdeclarativeview.h"
+
+#include <QDebug>
+
+#include <QDeclarativeView>
+#include <QDeclarativeItem>
+#include <private/qdeclarativelistview_p.h>
+#include <private/qdeclarativetext_p.h>
+#include <private/qdeclarativetextinput_p.h>
+#include <private/qdeclarativemousearea_p.h>
+
+#if !defined(QT_NO_WEBKIT)
+# include <private/qdeclarativewebview_p.h>
+#endif
+
+TestQmlFactory::TestQmlFactory()
+{
+}
+
+QObject* TestQmlFactory::create(QObject* o)
+{
+ QObject* ret = 0;
+
+#define TRY(Type,TestType) while (!ret) { \
+ Type* thing = qobject_cast<Type*>(o); \
+ if (thing) ret = new TestType(thing); \
+ break; \
+}
+
+ TRY(QDeclarativeView, TestDeclarativeView);
+#if !defined(QT_NO_WEBKIT)
+ TRY(QDeclarativeWebView, TestDeclarativeWebView);
+#endif
+ TRY(QDeclarativeListView, TestDeclarativeListView);
+ TRY(QDeclarativeTextInput, TestDeclarativeTextInput);
+ TRY(QDeclarativeText, TestDeclarativeText);
+ TRY(QDeclarativeMouseArea, TestDeclarativeMouseArea);
+ TRY(QDeclarativeItem, TestDeclarativeItem);
+
+ return ret;
+}
+
+QStringList TestQmlFactory::keys() const
+{
+ return QStringList()
+ << "QDeclarativeItem"
+ << "QDeclarativeView"
+ << "QDeclarativeListView"
+ << "QDeclarativeMouseArea"
+ << "QDeclarativeText"
+ << "QDeclarativeTextInput"
+#if !defined(QT_NO_WEBKIT)
+ << "QDeclarativeWebView"
+#endif
+ ;
+}
+
+#include <qplugin.h>
+Q_EXPORT_PLUGIN2(qmlwidgets, TestQmlFactory)
diff --git a/plugins/qtuitest_widgets/qmlwidgets/testdeclarativefactory.h b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativefactory.h
new file mode 100644
index 0000000..85a022b
--- /dev/null
+++ b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativefactory.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TEST_DECLARATIVE_FACTORY_H
+#define TEST_DECLARATIVE_FACTORY_H
+
+#include <QObject>
+
+#include <qtuitestwidgetinterface.h>
+
+class TestQmlFactory : public QObject, public QtUiTest::WidgetFactory
+{
+ Q_OBJECT
+ Q_INTERFACES(QtUiTest::WidgetFactory)
+
+public:
+ TestQmlFactory();
+
+ virtual QObject* create(QObject*);
+ virtual QStringList keys() const;
+};
+
+#endif
+
diff --git a/plugins/qtuitest_widgets/qmlwidgets/testdeclarativeitem.cpp b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativeitem.cpp
new file mode 100644
index 0000000..09b593e
--- /dev/null
+++ b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativeitem.cpp
@@ -0,0 +1,299 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testdeclarativeitem.h"
+
+#include <QDeclarativeItem>
+#include <QDeclarativeEngine>
+#include <QDeclarativeContext>
+#include <QDeclarativeListProperty>
+#include <QScriptValue>
+#include <QMetaObject>
+#include <QMetaProperty>
+#include <private/qdeclarativemetatype_p.h>
+#include <QDebug>
+
+TestDeclarativeItem::TestDeclarativeItem(QDeclarativeItem* _q)
+ : QtUiTest::TestGraphicsItem(_q),
+ q(_q),
+ m_childActivate(false)
+{
+}
+
+const QObjectList& TestDeclarativeItem::children() const
+{
+ m_children.clear();
+
+ foreach (QObject *child, q->children()) {
+ if (qobject_cast<QDeclarativeItem*>(child))
+ m_children << child;
+ }
+
+ return m_children;
+}
+
+bool TestDeclarativeItem::implements(char const* interface) const
+{
+ if (interface == QLatin1String("ActivateWidget")) {
+ m_childActivate = 0;
+ foreach (QObject *child, children()) {
+ if (qtuitest_cast<QtUiTest::ActivateWidget*>(child)) {
+ m_childActivate = child;
+ return true;
+ }
+ }
+ return false;
+ }
+ return (interface == QLatin1String("Widget"));
+}
+
+static const uint qt_meta_data_TestDeclarativeItem[] = {
+
+ // content:
+ 1, // revision
+ 0, // classname
+ 0, 0, // classinfo
+ 0, 0, // methods
+ 0, 0, // properties
+ 0, 0, // enums/sets
+
+ 0 // eodinherits
+};
+
+static const char qt_meta_stringdata_TestDeclarativeItem[] = {
+ "TestDeclarativeItem\0"
+};
+
+const QMetaObject TestDeclarativeItem::staticMetaObject = {
+ { &QObject::staticMetaObject, qt_meta_stringdata_TestDeclarativeItem,
+ qt_meta_data_TestDeclarativeItem, 0 }
+};
+
+const QMetaObject *TestDeclarativeItem::metaObject() const
+{
+ return &staticMetaObject;
+}
+
+void *TestDeclarativeItem::qt_metacast(const char *_clname)
+{
+ if (!_clname) return 0;
+
+ void* ret = 0;
+
+ do {
+#define DO(Type,String) \
+ if (!strcmp(_clname,#String) && implements(static_cast<Type*>(0)->_q_interfaceName())) { \
+ ret = static_cast<Type*>(this); \
+ break; \
+ }
+
+ DO(QtUiTest::Widget, QtUiTest::Widget);
+ DO(QtUiTest::Widget, com.nokia.qt.QtUiTest.Widget/1.0);
+ DO(QtUiTest::CheckWidget, QtUiTest::CheckWidget);
+ DO(QtUiTest::CheckWidget, com.nokia.qt.QtUiTest.CheckWidget/1.0);
+ DO(QtUiTest::ActivateWidget, QtUiTest::ActivateWidget);
+ DO(QtUiTest::ActivateWidget, com.nokia.qt.QtUiTest.ActivateWidget/1.0);
+ DO(QtUiTest::LabelWidget, QtUiTest::LabelWidget);
+ DO(QtUiTest::LabelWidget, com.nokia.qt.QtUiTest.LabelWidget/1.0);
+ DO(QtUiTest::TextWidget, QtUiTest::TextWidget);
+ DO(QtUiTest::TextWidget, com.nokia.qt.QtUiTest.TextWidget/1.0);
+ DO(QtUiTest::ListWidget, QtUiTest::ListWidget);
+ DO(QtUiTest::ListWidget, com.nokia.qt.QtUiTest.ListWidget/1.0);
+ DO(QtUiTest::InputWidget, QtUiTest::InputWidget);
+ DO(QtUiTest::InputWidget, com.nokia.qt.QtUiTest.InputWidget/1.0);
+ DO(QtUiTest::SelectWidget, QtUiTest::SelectWidget);
+ DO(QtUiTest::SelectWidget, com.nokia.qt.QtUiTest.SelectWidget/1.0);
+#undef DO
+ } while(0);
+
+ if (!ret) ret = QObject::qt_metacast(_clname);
+
+ return ret;
+}
+
+/*************************************************************************************************/
+
+static const QString TestDeclarativeItemSubclassError(
+ "Internal error: TestDeclarativeItem::%1() called. Either %2::implements() is wrong or %2 forgot to override %1."
+);
+
+#define SETERROR() \
+ QtUiTest::setErrorString(TestDeclarativeItemSubclassError.arg(__FUNCTION__).arg(metaObject()->className()))
+
+bool TestDeclarativeItem::activate()
+{
+ if (QtUiTest::ActivateWidget *aw = qtuitest_cast<QtUiTest::ActivateWidget*>(m_childActivate)) {
+ return aw->activate();
+ }
+
+ return false;
+}
+
+QString TestDeclarativeItem::labelText() const
+{ SETERROR(); return QString(); }
+bool TestDeclarativeItem::isTristate() const
+{ SETERROR(); return false; }
+Qt::CheckState TestDeclarativeItem::checkState() const
+{ SETERROR(); return Qt::CheckState(0); }
+bool TestDeclarativeItem::setCheckState(Qt::CheckState)
+{ SETERROR(); return false; }
+QString TestDeclarativeItem::selectedText() const
+{ SETERROR(); return QString(); }
+QString TestDeclarativeItem::text() const
+{ SETERROR(); return QString(); }
+QStringList TestDeclarativeItem::list() const
+{ SETERROR(); return QStringList(); }
+QRect TestDeclarativeItem::visualRect(const QString&) const
+{ SETERROR(); return QRect(); }
+bool TestDeclarativeItem::ensureVisible(const QString&)
+{ SETERROR(); return false; }
+bool TestDeclarativeItem::canEnter(const QVariant&) const
+{ SETERROR(); return false; }
+bool TestDeclarativeItem::enter(const QVariant&,bool)
+{ SETERROR(); return false; }
+bool TestDeclarativeItem::isMultiSelection() const
+{ SETERROR(); return false; }
+bool TestDeclarativeItem::canSelect(const QString&) const
+{ SETERROR(); return false; }
+bool TestDeclarativeItem::canSelectMulti(const QStringList&) const
+{ SETERROR(); return false; }
+bool TestDeclarativeItem::select(const QString&)
+{ SETERROR(); return false; }
+bool TestDeclarativeItem::selectMulti(const QStringList&)
+{ SETERROR(); return false; }
+
+
+
+///////
+
+bool TestDeclarativeItem::isVisible() const
+{
+ return q->isVisible();
+}
+
+QObject* TestDeclarativeItem::parent() const
+{ return q->parentItem() ? q->parentItem() : TestGraphicsItem::parent(); }
+
+bool TestDeclarativeItem::ensureVisibleRegion(const QRegion&)
+{ return true; }
+
+bool TestDeclarativeItem::hasFocus() const
+{ return q->hasFocus(); }
+
+QString unSlash(const QString &text)
+{
+ int lastSlash = text.lastIndexOf(QLatin1Char('/'));
+ if (lastSlash != -1)
+ return text.mid(lastSlash+1);
+ else
+ return text;
+}
+
+QVariant TestDeclarativeItem::getProperty(const QString& name) const
+{
+ QVariant ret;
+
+ if (name.toUpper() == "QMLTYPE") {
+ QString typeName;
+ QDeclarativeType *type = QDeclarativeMetaType::qmlType(q->metaObject());
+ if (type) {
+ typeName = QLatin1String(type->qmlTypeName());
+ } else {
+ typeName = QString::fromUtf8(q->metaObject()->className());
+ int marker = typeName.indexOf(QLatin1String("_QMLTYPE_"));
+ if (marker != -1)
+ typeName = typeName.left(marker);
+ else {
+ marker = typeName.indexOf(QLatin1String("_QML_"));
+ if (marker != -1)
+ typeName = typeName.left(marker);
+
+ foreach (QDeclarativeType* type, QDeclarativeMetaType::qmlTypes()) {
+ if (type->typeName() == typeName) {
+ typeName = QLatin1String(type->qmlTypeName());
+ break;
+ }
+ }
+ }
+ }
+
+ if (!typeName.isNull()) {
+ int lastSlash = typeName.lastIndexOf(QLatin1Char('/'));
+ if (lastSlash != -1)
+ typeName = typeName.mid(lastSlash+1);
+
+ return typeName;
+ }
+ } else if (name.contains('.')) {
+ // This is an attached property
+ int dot = name.indexOf('.');
+ QString attachTypeName = name.left(dot);
+ QDeclarativeType *attachType = 0;
+ foreach (QDeclarativeType* type, QDeclarativeMetaType::qmlTypes()) {
+ if (unSlash(type->qmlTypeName()) == attachTypeName) {
+ attachType = type;
+ break;
+ }
+ }
+ if (attachType) {
+ QDeclarativeAttachedPropertiesFunc func = attachType->attachedPropertiesFunction();
+ if (func) {
+ QObject *attached = func(q);
+ if (attached) {
+ ret = attached->property(name.mid(dot+1).toLatin1());
+ }
+ }
+ }
+ } else {
+ ret = q->property(name.toLatin1());
+ }
+
+ if (ret.type() == QVariant::UserType) {
+ bool ok;
+ QObject *obj = QDeclarativeMetaType::toQObject(ret, &ok);
+ if (ok) {
+ return QVariant::fromValue(obj);
+ }
+ return QVariant();
+ }
+
+ return ret;
+}
diff --git a/plugins/qtuitest_widgets/qmlwidgets/testdeclarativeitem.h b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativeitem.h
new file mode 100644
index 0000000..292918a
--- /dev/null
+++ b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativeitem.h
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TEST_DECLARATIVE_ITEM_H
+#define TEST_DECLARATIVE_ITEM_H
+
+#include "../qgraphicsviewwidgets/testgraphicsitem.h"
+
+class QDeclarativeItem;
+
+class TestDeclarativeItem :
+ public QtUiTest::TestGraphicsItem,
+ public QtUiTest::ActivateWidget,
+ public QtUiTest::LabelWidget,
+ public QtUiTest::CheckWidget,
+ public QtUiTest::TextWidget,
+ public QtUiTest::ListWidget,
+ public QtUiTest::InputWidget,
+ public QtUiTest::SelectWidget
+{
+public:
+ Q_OBJECT_CHECK
+ Q_INTERFACES(
+ QtUiTest::Widget
+ QtUiTest::ActivateWidget
+ QtUiTest::LabelWidget
+ QtUiTest::CheckWidget
+ QtUiTest::TextWidget
+ QtUiTest::ListWidget
+ QtUiTest::InputlWidget
+ QtUiTest::SelectWidget)
+
+ static const QMetaObject staticMetaObject;
+ virtual const QMetaObject *metaObject() const;
+ virtual void *qt_metacast(const char *);
+
+ TestDeclarativeItem(QDeclarativeItem*);
+
+ const QObjectList& children() const;
+ QString id() const;
+
+ virtual bool activate();
+
+ virtual QString labelText() const;
+
+ virtual bool isTristate() const;
+ virtual Qt::CheckState checkState() const;
+ virtual bool setCheckState(Qt::CheckState);
+
+ virtual QString selectedText() const;
+ virtual QString text() const;
+
+ virtual QStringList list() const;
+ virtual QRect visualRect(const QString&) const;
+ virtual bool ensureVisible(const QString&);
+
+ virtual bool canEnter(const QVariant&) const;
+ virtual bool enter(const QVariant&,bool);
+
+ virtual bool isMultiSelection() const;
+
+ virtual bool canSelect(const QString&) const;
+ virtual bool canSelectMulti(const QStringList&) const;
+ virtual bool select(const QString&);
+ virtual bool selectMulti(const QStringList&);
+
+ virtual bool isVisible() const;
+ virtual QObject* parent() const;
+ virtual bool ensureVisibleRegion(const QRegion&);
+ virtual bool hasFocus() const;
+ virtual QVariant getProperty(const QString&) const;
+
+protected:
+ virtual bool implements(const char*) const;
+
+private:
+ QDeclarativeItem* q;
+
+ mutable QObjectList m_children;
+ mutable QObject *m_childActivate;
+};
+
+#endif
+
diff --git a/plugins/qtuitest_widgets/qmlwidgets/testdeclarativelistview.cpp b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativelistview.cpp
new file mode 100644
index 0000000..33129fb
--- /dev/null
+++ b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativelistview.cpp
@@ -0,0 +1,188 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testdeclarativelistview.h"
+#include <private/qdeclarativelistview_p.h>
+#include <private/qlistmodelinterface_p.h>
+
+
+TestDeclarativeListView::TestDeclarativeListView(QDeclarativeListView *_q)
+ : TestDeclarativeItem(_q)
+ , q(_q)
+{}
+
+QString TestDeclarativeListView::selectedText() const
+{
+// waitForModelUpdate(q->model());
+ return getData(q->currentIndex());
+}
+
+
+QString TestDeclarativeListView::getData(int index) const
+{
+ QListModelInterface *model = qobject_cast<QListModelInterface*>(q->model().value<QObject*>());
+// QListModelInterface *model = qobject_cast<QListModelInterface*>(q->model());
+ if (model) {
+ QStringList sl;
+ QList<int> roles = model->roles();
+ QHash<int,QVariant> data = model->data(index, roles);
+ foreach (QVariant value, data)
+ sl << value.toString();
+ return sl.join(" ");
+ }
+ return QString();
+}
+
+QString TestDeclarativeListView::text() const
+{
+ return list().join("\n");
+}
+
+QStringList TestDeclarativeListView::list() const
+{
+ QStringList ret;
+ QListModelInterface *model = qobject_cast<QListModelInterface*>(q->model().value<QObject*>());
+// QListModelInterface *model = qobject_cast<QListModelInterface*>(q->model());
+
+ for (int i = 0; i < model->count(); i++) {
+ ret << getData(i);
+ }
+
+ return ret;
+}
+
+QRect TestDeclarativeListView::visualRect(QString const &item) const
+{
+ using namespace QtUiTest;
+
+ QRect ret;
+/*
+ // Allow testwidgets to make decisions based on the view associated with this item.
+// QVariant view = QVariant::fromValue((QObject*)q);
+// q->model()->setProperty("_q_qtuitest_itemview", view);
+ ListWidget* lw = qtuitest_cast<ListWidget*>(q->model());
+ if (!lw) {
+ QString model;
+ QDebug(&model) << q->model();
+ setErrorString("Could not find a ListWidget interface for model " + model);
+ } else {
+ ret = lw->visualRect(item);
+ }
+*/
+ return ret;
+}
+
+bool TestDeclarativeListView::isMultiSelection() const
+{
+ return false;
+}
+
+bool TestDeclarativeListView::canSelect(QString const &item) const
+{
+ return (list().contains(item));
+}
+
+bool TestDeclarativeListView::canSelectMulti(QStringList const &items) const
+{
+ return false;
+}
+
+bool TestDeclarativeListView::select(QString const &item)
+{
+ if (!canSelect(item)) {
+ return false;
+ }
+
+ // FIXME: Shouldn't set focus this way...
+ q->setFocus(true);
+/*
+
+ //FIXME: Should support both mouse and keyboard
+
+ // Consume pending key events, if any.
+ while (QtUiTest::waitForEvent(q, QEvent::KeyRelease, 200, Qt::QueuedConnection))
+ {}
+
+ QStringList allItems = list();
+
+ const int maxtries = 100;
+ int desiredIndex = allItems.indexOf(item);
+ int currentIndex = q->currentIndex();
+
+ // Move vertically
+ Qt::Key key;
+ if (desiredIndex > currentIndex)
+ key = (q->orientation() == Qt::Vertical) ? Qt::Key_Down : Qt::Key_Right;
+ else
+ key = (q->orientation() == Qt::Vertical) ? Qt::Key_Up : Qt::Key_Left;
+
+ for (int i = 0; i < maxtries && selectedText() != item; ++i) {
+ if (!QtUiTest::keyClick(q->canvas(), key)) return false;
+QtUiTest::wait(200);
+ }
+ QString selected = selectedText();
+ qDebug() << "selectedText() now" << selected;
+ if (selected != item) {
+ QtUiTest::setErrorString(QString(
+ "Up/down keys should have caused item %1 to become selected, but item %2 "
+ "is selected instead.").arg(item).arg(selected));
+ return false;
+ }
+ return true;
+*/
+
+ return false;
+
+}
+
+bool TestDeclarativeListView::selectMulti(QStringList const &items)
+{
+ return false;
+}
+
+bool TestDeclarativeListView::ensureVisible(QString const &item)
+{
+ return true;
+}
+
+bool TestDeclarativeListView::canWrap(QObject* o)
+{ return qobject_cast<QDeclarativeListView*>(o); }
+
diff --git a/plugins/qtuitest_widgets/qmlwidgets/testdeclarativelistview.h b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativelistview.h
new file mode 100644
index 0000000..6aefbbe
--- /dev/null
+++ b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativelistview.h
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TEST_DECLARATIVE_LISTVIEW_H
+#define TEST_DECLARATIVE_LISTVIEW_H
+
+#include "testdeclarativeitem.h"
+
+
+class QDeclarativeListView;
+
+class TestDeclarativeListView : public TestDeclarativeItem
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::TextWidget
+ QtUiTest::ListWidget
+ QtUiTest::SelectWidget)
+
+public:
+ TestDeclarativeListView(QDeclarativeListView*);
+
+ virtual QString text() const;
+ virtual QString selectedText() const;
+
+ virtual QStringList list() const;
+ virtual QRect visualRect(QString const&) const;
+ virtual bool ensureVisible(QString const&);
+
+ virtual bool isMultiSelection() const;
+
+ virtual bool canSelect(QString const&) const;
+ virtual bool canSelectMulti(QStringList const&) const;
+ virtual bool select(QString const&);
+ virtual bool selectMulti(QStringList const&);
+
+ static bool canWrap(QObject*);
+
+signals:
+ void selected(const QString&);
+
+protected:
+ QString getData(int) const;
+
+private:
+ QDeclarativeListView *q;
+
+};
+
+#endif
+
diff --git a/plugins/qtuitest_widgets/qmlwidgets/testdeclarativemousearea.cpp b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativemousearea.cpp
new file mode 100644
index 0000000..721f55e
--- /dev/null
+++ b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativemousearea.cpp
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testdeclarativemousearea.h"
+
+#include <private/qdeclarativemousearea_p.h>
+
+TestDeclarativeMouseArea::TestDeclarativeMouseArea(QDeclarativeMouseArea* _q)
+ : TestDeclarativeItem(_q)
+ , q(_q)
+{}
+
+bool TestDeclarativeMouseArea::activate()
+{
+ QPoint p;
+ p = visibleRegion().boundingRect().center();
+ ensureVisiblePoint(p);
+ QtUiTest::mouseClick(mapToGlobal(p), Qt::LeftButton);
+ QtUiTest::waitForSignal(q, SIGNAL(clicked(QDeclarativeMouseEvent*)));
+ return true;
+}
+
diff --git a/plugins/qtuitest_widgets/qmlwidgets/testdeclarativemousearea.h b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativemousearea.h
new file mode 100644
index 0000000..21dc282
--- /dev/null
+++ b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativemousearea.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TEST_DECLARATIVE_MOUSEAREA_H
+#define TEST_DECLARATIVE_MOUSEAREA_H
+
+#include "testdeclarativeitem.h"
+
+class QDeclarativeMouseArea;
+
+class TestDeclarativeMouseArea : public TestDeclarativeItem
+{
+ Q_OBJECT
+ Q_INTERFACES(QtUiTest::ActivateWidget)
+
+public:
+ TestDeclarativeMouseArea(QDeclarativeMouseArea*);
+
+ virtual bool activate();
+
+private:
+ QDeclarativeMouseArea* q;
+};
+
+#endif
+
diff --git a/plugins/qtuitest_widgets/qmlwidgets/testdeclarativetext.cpp b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativetext.cpp
new file mode 100644
index 0000000..6a5776d
--- /dev/null
+++ b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativetext.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testdeclarativetext.h"
+
+#include <private/qdeclarativetext_p.h>
+
+TestDeclarativeText::TestDeclarativeText(QDeclarativeText* _q)
+ : TestDeclarativeItem(_q)
+ , q(_q)
+{}
+
+QString TestDeclarativeText::text() const
+{ return q->text(); }
+
+QString TestDeclarativeText::selectedText() const
+{ return text(); }
+
+QString TestDeclarativeText::labelText() const
+{ return text(); }
+
+bool TestDeclarativeText::isLabel() const
+{ return true; }
+
+// For QML items, assume that the text is a label for the parent.
+QObject* TestDeclarativeText::buddy() const
+{
+ QObject *parent = TestDeclarativeItem::parent();
+ QtUiTest::Widget *pw = qtuitest_cast<Widget*>(parent);
+ if (pw)
+ return parent;
+ else
+ return 0;
+}
+
+bool TestDeclarativeText::implements(char const* interface) const
+{
+ if (interface == QLatin1String("LabelWidget")) return isLabel();
+ return TestDeclarativeItem::implements(interface);
+}
+
diff --git a/plugins/qtuitest_widgets/qmlwidgets/testdeclarativetext.h b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativetext.h
new file mode 100644
index 0000000..fe707d2
--- /dev/null
+++ b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativetext.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TEST_DECLARATIVE_TEXT_H
+#define TEST_DECLARATIVE_TEXT_H
+
+#include "testdeclarativeitem.h"
+
+class QDeclarativeText;
+
+class TestDeclarativeText : public TestDeclarativeItem
+{
+ Q_OBJECT
+ Q_INTERFACES(QtUiTest::TextWidget)
+
+public:
+ TestDeclarativeText(QDeclarativeText*);
+
+ virtual QString text() const;
+ virtual QString selectedText() const;
+ virtual QString labelText() const;
+ virtual QObject* buddy() const;
+
+protected:
+ virtual bool implements(char const*) const;
+
+private:
+ bool isLabel() const;
+
+ QDeclarativeText* q;
+};
+
+#endif
+
diff --git a/plugins/qtuitest_widgets/qmlwidgets/testdeclarativetextinput.cpp b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativetextinput.cpp
new file mode 100644
index 0000000..dffe2e7
--- /dev/null
+++ b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativetextinput.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testdeclarativetextinput.h"
+
+#include <private/qdeclarativetextinput_p.h>
+
+TestDeclarativeTextInput::TestDeclarativeTextInput(QDeclarativeTextInput* _q)
+ : TestDeclarativeItem(_q)
+ , q(_q)
+{}
+
+QString TestDeclarativeTextInput::text() const
+{ return q->text(); }
+
+QString TestDeclarativeTextInput::selectedText() const
+{ return text(); }
+
+bool TestDeclarativeTextInput::canEnter(QVariant const& item) const
+{
+ if (!item.canConvert<QString>()) return false;
+ if (!q->validator()) return true;
+
+ int dontcare = 0;
+ QString text = item.toString();
+ return (QValidator::Acceptable==q->validator()->validate(text, dontcare));
+}
+
+bool TestDeclarativeTextInput::enter(QVariant const& item, bool noCommit)
+{
+ if (!canEnter(item)) return false;
+ QString itemString = item.toString();
+ using namespace QtUiTest;
+
+ if (!q->hasFocus()) {
+ QPoint p = visibleRegion().boundingRect().center();
+ ensureVisiblePoint(p);
+ QtUiTest::mouseClick(mapToGlobal(p), Qt::LeftButton);
+ QtUiTest::waitForSignal(q, SIGNAL(focusChanged()));
+ if (!q->hasFocus()) {
+ QtUiTest::setErrorString("Couldn't give focus to TextInput");
+ return false;
+ }
+ }
+
+ foreach (QChar const& c, itemString) {
+ if (!keyClick(q, SIGNAL(textChanged()), asciiToKey(c.toLatin1()), asciiToModifiers(c.toLatin1()) ))
+ return false;
+ }
+ if (!noCommit) QtUiTest::keyClick(QtUiTest::Key_Activate);
+
+ return true;
+}
diff --git a/plugins/qtuitest_widgets/qmlwidgets/testdeclarativetextinput.h b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativetextinput.h
new file mode 100644
index 0000000..f2a3d82
--- /dev/null
+++ b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativetextinput.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TEST_DECLARATIVE_TEXTINPUT_H
+#define TEST_DECLARATIVE_TEXTINPUT_H
+
+#include "testdeclarativeitem.h"
+
+class QDeclarativeTextInput;
+
+class TestDeclarativeTextInput : public TestDeclarativeItem
+{
+ Q_OBJECT
+ Q_INTERFACES(QtUiTest::TextWidget)
+ Q_INTERFACES(QtUiTest::InputWidget)
+
+public:
+ TestDeclarativeTextInput(QDeclarativeTextInput*);
+
+ virtual QString text() const;
+ virtual QString selectedText() const;
+
+ virtual bool canEnter(QVariant const&) const;
+ virtual bool enter(QVariant const&,bool);
+
+protected:
+ QDeclarativeTextInput* q;
+};
+
+#endif
+
diff --git a/plugins/qtuitest_widgets/qmlwidgets/testdeclarativeview.cpp b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativeview.cpp
new file mode 100644
index 0000000..deafdd6
--- /dev/null
+++ b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativeview.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testdeclarativeview.h"
+#include <QDebug>
+#include <QDeclarativeView>
+#include <QDeclarativeItem>
+
+TestDeclarativeView::TestDeclarativeView(QDeclarativeView* _q)
+ : TestGraphicsView(_q), q(_q)
+{}
+
+QObjectList const& TestDeclarativeView::children() const
+{
+ m_children = QObjectList();
+ if (q->rootObject()) m_children << q->rootObject();
+ m_children << q->children();
+ return m_children;
+}
+
diff --git a/plugins/qtuitest_widgets/qmlwidgets/testdeclarativeview.h b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativeview.h
new file mode 100644
index 0000000..9611aea
--- /dev/null
+++ b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativeview.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TEST_DECLARATIVE_VIEW_H
+#define TEST_DECLARATIVE_VIEW_H
+
+#include "../qgraphicsviewwidgets/testgraphicsview.h"
+
+class QDeclarativeView;
+
+class TestDeclarativeView : public QtUiTest::TestGraphicsView
+{
+ Q_OBJECT
+
+public:
+ TestDeclarativeView(QDeclarativeView*);
+
+ virtual QObjectList const& children() const;
+
+private:
+ QDeclarativeView* q;
+
+ mutable QObjectList m_children;
+};
+
+#endif
+
diff --git a/plugins/qtuitest_widgets/qmlwidgets/testdeclarativewebview.cpp b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativewebview.cpp
new file mode 100644
index 0000000..9262404
--- /dev/null
+++ b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativewebview.cpp
@@ -0,0 +1,209 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testdeclarativewebview.h"
+
+#include <private/qdeclarativewebview_p.h>
+#include <private/qdeclarativeflickable_p.h>
+
+#include <QWebPage>
+#include <QWebFrame>
+#include <QWebElementCollection>
+
+TestDeclarativeWebView::TestDeclarativeWebView(QDeclarativeWebView *_q)
+ : TestDeclarativeItem(_q), q(_q)
+{
+}
+
+QString TestDeclarativeWebView::text() const
+{
+ QWebPage *page = q->page();
+ if (page && page->mainFrame()) {
+ return page->mainFrame()->toPlainText();
+ }
+ return QString();
+}
+
+QString TestDeclarativeWebView::selectedText() const
+{
+ return text();
+}
+
+QStringList TestDeclarativeWebView::list() const
+{
+ QStringList ret;
+
+ QWebPage *page = q->page();
+ if (page && page->mainFrame()) {
+ QWebElementCollection links = page->mainFrame()->findAllElements("a[href]");
+ foreach (QWebElement el, links) {
+ QString str = el.toPlainText();
+ if (!str.isEmpty()) ret << str;
+ }
+ }
+ return ret;
+}
+
+QWebElement TestDeclarativeWebView::elementForItem(QString const &item) const
+{
+ QWebElement ret;
+ QWebPage *page = q->page();
+ if (page && page->mainFrame()) {
+ QWebElementCollection links = page->mainFrame()->findAllElements("a[href]");
+ foreach (QWebElement el, links) {
+ if (el.toPlainText() == item) {
+ ret = el;
+ break;
+ }
+ }
+ }
+ return ret;
+}
+
+QRect TestDeclarativeWebView::visualRect(QString const &item) const
+{
+ return visualRect(elementForItem(item));
+}
+
+QRect TestDeclarativeWebView::visualRect(QWebElement const &el) const
+{
+ if (!el.isNull()) {
+ QRect geo = el.geometry();
+ qreal scale = q->contentsScale();
+ return QRect(geo.x() * scale, geo.y() * scale, geo.width() * scale, geo.height() * scale);
+ }
+ return QRect();
+}
+
+bool TestDeclarativeWebView::canSelect(QString const &item) const
+{ return list().contains(item); }
+
+bool TestDeclarativeWebView::select(QString const &item)
+{
+ QWebElement el(elementForItem(item));
+ if (el.isNull()) return false;
+
+ QRect rect = visualRect(el);
+ QPoint pos = rect.center();
+
+ if (q->parentItem()) {
+ QDeclarativeFlickable *flick = qobject_cast<QDeclarativeFlickable*>(q->parentItem()->parentItem());
+
+/*
+ qDebug() << "Viewport X " << flick->viewportX();
+ qDebug() << "Viewport Y " << flick->viewportY();
+ qDebug() << "Viewport Width " << flick->viewportWidth();
+ qDebug() << "Viewport Height" << flick->viewportHeight();
+ qDebug() << "Bottom " << flick->viewportY() + flick->height() + q->y();
+ qDebug() << "Item at " << pos;
+*/
+ if (flick && (flick->contentY() + q->y() > pos.y() ||
+ flick->contentY() + flick->height() + q->y() < pos.y())) {
+ // qDebug() << " *** MOVING VIEWPORT ***";
+ flick->setContentY(pos.y() - flick->height()/2);
+ }
+ }
+
+// qDebug() << "Select:" << item << "by clicking at" << pos << mapToGlobal(pos);
+
+ QtUiTest::mouseClick(mapToGlobal(pos), Qt::LeftButton);
+
+ return true;
+}
+
+bool TestDeclarativeWebView::canEnter(QVariant const& item) const
+{
+ // Accept everything for now...
+ return true;
+}
+
+bool TestDeclarativeWebView::enter(QVariant const& item, bool noCommit)
+{
+ QString itemString = item.toString();
+ foreach (QChar const& c, itemString) {
+ QtUiTest::keyClick(QtUiTest::asciiToKey(c.toLatin1()), QtUiTest::asciiToModifiers(c.toLatin1()));
+ }
+ if (!noCommit) QtUiTest::keyClick(QtUiTest::Key_Activate);
+
+ return true;
+}
+
+bool TestDeclarativeWebView::selectIndex(QVariantList const &indexList)
+{
+ QWebElement el;
+ QWebPage *page = q->page();
+ if (page && page->mainFrame()) {
+ if (indexList.size() > 1) {
+ bool ok;
+ int elIndex = indexList[1].toInt(&ok);
+ if (!ok) {
+ QtUiTest::setErrorString("Element index must be an integer");
+ return false;
+ }
+ QWebElementCollection els = page->mainFrame()->findAllElements(indexList[0].toString());
+ if (els.count() < (elIndex-1)) {
+ QtUiTest::setErrorString("Element index out of range");
+ return false;
+ }
+ el = els[elIndex];
+ } else if (indexList.size() == 1) {
+ el = page->mainFrame()->findFirstElement(indexList[0].toString());
+ } else return false;
+ }
+
+ if (el.isNull()) return false;
+
+ QRect rect = visualRect(el);
+ QPoint pos = rect.center();
+
+ if (q->parentItem()) {
+ QDeclarativeFlickable *flick = qobject_cast<QDeclarativeFlickable*>(q->parentItem()->parentItem());
+
+ if (flick && (flick->contentY() + q->y() > pos.y() ||
+ flick->contentY() + flick->height() + q->y() < pos.y())) {
+ flick->setContentY(pos.y() - flick->height()/2);
+ }
+ }
+
+ QtUiTest::mouseClick(mapToGlobal(pos), Qt::LeftButton);
+
+ return true;
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qmlwidgets/testdeclarativewebview.h b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativewebview.h
new file mode 100644
index 0000000..cb81b3b
--- /dev/null
+++ b/plugins/qtuitest_widgets/qmlwidgets/testdeclarativewebview.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TEST_DECLARATIVE_WEBVIEW_H
+#define TEST_DECLARATIVE_WEBVIEW_H
+
+#include "testdeclarativeitem.h"
+
+class QDeclarativeWebView;
+class QWebElement;
+
+class TestDeclarativeWebView : public TestDeclarativeItem,
+ public QtUiTest::IndexedWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::TextWidget
+ QtUiTest::ListWidget
+ QtUiTest::SelectWidget
+ QtUiTest::InputWidget
+ QtUiTest::IndexedWidget)
+
+public:
+ TestDeclarativeWebView(QDeclarativeWebView*);
+
+ virtual QString text() const;
+ virtual QString selectedText() const;
+
+ virtual QStringList list() const;
+ virtual QRect visualRect(QString const&) const;
+
+ virtual bool canSelect(QString const&) const;
+ virtual bool select(QString const&);
+
+ virtual bool canEnter(QVariant const&) const;
+ virtual bool enter(QVariant const&,bool);
+
+ virtual bool selectIndex(QVariantList const&);
+
+
+protected:
+ QWebElement elementForItem(QString const&) const;
+ virtual QRect visualRect(QWebElement const&) const;
+
+private:
+ QDeclarativeWebView *q;
+};
+
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtuitest_widgets.pro b/plugins/qtuitest_widgets/qtuitest_widgets.pro
new file mode 100644
index 0000000..c9c1185
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtuitest_widgets.pro
@@ -0,0 +1,8 @@
+TEMPLATE=subdirs
+SUBDIRS=\
+ qtwidgets
+
+!symbian:SUBDIRS +=qgraphicsviewwidgets
+
+enable_hbwidgets:SUBDIRS += hbwidgets
+enable_qmlwidget:SUBDIRS += qmlwidgets
diff --git a/plugins/qtuitest_widgets/qtwidgets/DESCRIPTION b/plugins/qtuitest_widgets/qtwidgets/DESCRIPTION
new file mode 100644
index 0000000..5735373
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/DESCRIPTION
@@ -0,0 +1 @@
+QtUitest plugin containing logic for interacting with Qt widgets.
diff --git a/plugins/qtuitest_widgets/qtwidgets/qtwidgets.pro b/plugins/qtuitest_widgets/qtwidgets/qtwidgets.pro
new file mode 100644
index 0000000..52c11c7
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/qtwidgets.pro
@@ -0,0 +1,103 @@
+SOURCES += \
+ testabstractbutton.cpp \
+ testabstractitemview.cpp \
+ testabstractspinbox.cpp \
+ testcalendarwidget.cpp \
+ testcheckbox.cpp \
+ testcombobox.cpp \
+ testdateedit.cpp \
+ testdatetimeedit.cpp \
+ testdockwidget.cpp \
+ testfactory.cpp \
+ testgenericcheckwidget.cpp \
+ testgenerictextwidget.cpp \
+ testgroupbox.cpp \
+ testheaderview.cpp \
+ testignore.cpp \
+ testlabel.cpp \
+ testlineedit.cpp \
+ testlistview.cpp \
+ testmenu.cpp \
+ testmenubar.cpp \
+ testpushbutton.cpp \
+ testtabbar.cpp \
+ testtext.cpp \
+ testtextedit.cpp \
+ testtimeedit.cpp \
+ testtoolbar.cpp \
+ testtreeview.cpp \
+ testtreewidget.cpp \
+ testgenericinputmethod.cpp
+
+HEADERS += \
+ testabstractbutton.h \
+ testabstractitemview.h \
+ testabstractspinbox.h \
+ testcalendarwidget.h \
+ testcheckbox.h \
+ testcombobox.h \
+ testdateedit.h \
+ testdatetimeedit.h \
+ testdockwidget.h \
+ testfactory.h \
+ testgenericcheckwidget.h \
+ testgenerictextwidget.h \
+ testgroupbox.h \
+ testheaderview.h \
+ testignore.h \
+ testlabel.h \
+ testlineedit.h \
+ testlistview.h \
+ testwidgetslog.h \
+ testmenu.h \
+ testmenubar.h \
+ testpushbutton.h \
+ testtabbar.h \
+ testtext.h \
+ testtextedit.h \
+ testtimeedit.h \
+ testtoolbar.h \
+ testtreeview.h \
+ testtreewidget.h \
+ testgenericinputmethod.h
+
+TEMPLATE=lib
+CONFIG+=plugin
+VPATH+=$$PWD
+INCLUDEPATH+=$$PWD
+INCLUDEPATH+=$$SRCROOT/libqtuitest
+TARGET=qtwidgets
+TARGET=$$qtLibraryTarget($$TARGET)
+
+unix:!symbian {
+ MOC_DIR=$$OUT_PWD/.moc
+ OBJECTS_DIR=$$OUT_PWD/.obj
+ target.path=$$[QT_INSTALL_PLUGINS]/qtuitest_widgets
+ INSTALLS+=target
+ LIBS+=-L$$BUILDROOT/lib/ -lqtuitest
+}
+
+symbian {
+ TARGET.EPOCALLOWDLLDATA=1
+ TARGET.CAPABILITY += AllFiles ReadDeviceData ReadUserData SwEvent WriteUserData NetworkServices
+ MOC_DIR=$$OUT_PWD/moc
+ OBJECTS_DIR=$$OUT_PWD/obj
+ LIBS+=-lqtuitest.lib -lws32 -leuser -lcone
+}
+
+win32 {
+ CONFIG(debug,debug|release): LIBS+=-L$$BUILDROOT/libqtuitest -lqtuitestd
+ CONFIG(release,debug|release):LIBS+=-L$$BUILDROOT/libqtuitest -lqtuitest
+ target.path=$$[QT_INSTALL_PLUGINS]/qtuitest_widgets
+ INSTALLS+=target
+}
+
+mac {
+ LIBS+=-L$$BUILDROOT/lib -lqtuitest
+}
+
+contains(QT_CONFIG, webkit) {
+ QT+=webkit
+ SOURCES+=testwebview.cpp
+ HEADERS+=testwebview.h
+}
diff --git a/plugins/qtuitest_widgets/qtwidgets/testabstractbutton.cpp b/plugins/qtuitest_widgets/qtwidgets/testabstractbutton.cpp
new file mode 100644
index 0000000..379f92d
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testabstractbutton.cpp
@@ -0,0 +1,195 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testabstractbutton.h"
+#include "testwidgetslog.h"
+
+#include <QAbstractButton>
+#include <QTimer>
+#include <QTime>
+#include <QPointer>
+#include <QStyleOptionButton>
+
+namespace QtUiTest {
+
+TestAbstractButton::TestAbstractButton(QObject *_q)
+ : TestGenericTextWidget(_q), q(qobject_cast<QAbstractButton*>(_q)),
+ m_pressed(false)
+{
+ if (!QtUiTest::connectFirst(q, SIGNAL(pressed()), this, SIGNAL(activated())))
+ Q_ASSERT(false);
+ if (!connect(q, SIGNAL(toggled(bool)), this, SLOT(on_toggled(bool))))
+ Q_ASSERT(false);
+}
+
+void TestAbstractButton::on_toggled(bool state)
+{ emit stateChanged(state); }
+
+Qt::CheckState TestAbstractButton::checkState() const
+{ return q->isChecked() ? Qt::Checked : Qt::Unchecked; }
+
+bool TestAbstractButton::setCheckState(Qt::CheckState state)
+{
+ if (state == checkState()) return true;
+ if (!q->isCheckable()) {
+ QtUiTest::setErrorString("This abstract button is not checkable.");
+ return false;
+ }
+ bool ret = activate(QtUiTest::NoOptions);
+ TestWidgetsLog() << "activated:" << ret;
+ if (ret && (state != checkState()) && !QtUiTest::waitForSignal(q, SIGNAL(toggled(bool)))) {
+ QtUiTest::setErrorString("Successfully activated button, but check state did not change "
+ "to expected value.");
+ return false;
+ }
+ TestWidgetsLog() << "state:" << ret;
+ return ret;
+}
+
+bool TestAbstractButton::activate()
+{
+ return activate((QtUiTest::InputOption)0);
+}
+
+bool TestAbstractButton::activate(QtUiTest::InputOption opt)
+{
+ if (QtUiTest::mousePreferred()) {
+ int t;
+ m_pressed = false;
+
+ QPoint pos;
+ if (q->isCheckable()) {
+ QStyle const* style = q->style();
+ QStyleOptionButton opt;
+ opt.initFrom(q);
+ QRect rect = style->subElementRect( QStyle::SE_CheckBoxIndicator, &opt, q);
+ pos = rect.center();
+ } else {
+ pos = q->rect().center();
+ }
+
+ QRegion region = QRegion(pos.x()-1, pos.y()-1, 3, 3);
+ for (t = 0; t < 2; ++t) {
+ ensureVisibleRegion(region);
+ QtUiTest::mousePress(mapToGlobal(pos), Qt::LeftButton, opt);
+ QtUiTest::waitForSignal(q, SIGNAL(pressed()));
+ if (q->isDown())
+ break;
+ }
+ if (!q->isDown()) {
+ qWarning("Button did not react to mouse press.");
+ QtUiTest::mouseRelease(mapToGlobal(pos), Qt::LeftButton, opt);
+ return false;
+ }
+ if (t > 0)
+ qWarning("Button did not react to mouse press on first try.");
+
+ QtUiTest::mouseRelease(mapToGlobal(pos), Qt::LeftButton, opt);
+ return true;
+ } else {
+ Qt::Key key = Qt::Key(QtUiTest::Key_ActivateButton);
+ Qt::KeyboardModifiers mod = 0;
+
+ if (q->focusPolicy() == Qt::NoFocus) {
+ /* Handle buttons which need to be activated by a shortcut */
+ QKeySequence ks = q->shortcut();
+ TestWidgetsLog() << "Can't give focus to button; need to use shortcut"
+ << ks.toString();
+ if (ks.isEmpty()) {
+ QtUiTest::setErrorString("Button has NoFocus policy set and does not appear "
+ "to have any shortcut set. Therefore, it is impossible to activate "
+ "using only the keyboard.");
+ return false;
+ }
+
+ int key_and_mod = ks[0];
+ mod = QFlag(key_and_mod & (0xfe000000));
+ key = Qt::Key(key_and_mod & (0x01ffffff));
+ }
+ else {
+ if (!hasFocus()) setFocus();
+ if (!hasFocus()) return false;
+ }
+
+ QPointer<QObject> safeQ(q);
+
+ if (!QtUiTest::keyClick(q, SIGNAL(pressed()), key, mod, opt))
+ return false;
+
+ if (safeQ && q->isDown() && !QtUiTest::waitForSignal(q, SIGNAL(released()))) {
+ QtUiTest::setErrorString("Button did not become released after key click");
+ return false;
+ }
+ return true;
+ }
+ return false;
+}
+
+QString TestAbstractButton::labelText() const
+{
+ QString ret = text();
+ if (ret.isEmpty())
+ return ret;
+
+ QObject *w = parent();
+ while (w) {
+ QtUiTest::Widget *qw = qtuitest_cast<QtUiTest::Widget*>(w);
+ QtUiTest::LabelWidget *lw = qtuitest_cast<QtUiTest::LabelWidget*>(w);
+ if (lw) {
+ if (!lw->labelText().isEmpty()) {
+ ret.prepend(lw->labelText() + "/");
+ break;
+ }
+ }
+ w = qw->parent();
+ }
+ return ret;
+}
+
+QObject* TestAbstractButton::buddy() const
+{
+ return q;
+}
+
+bool TestAbstractButton::canWrap(QObject *o)
+{ return qobject_cast<QAbstractButton*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testabstractbutton.h b/plugins/qtuitest_widgets/qtwidgets/testabstractbutton.h
new file mode 100644
index 0000000..687c56e
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testabstractbutton.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTABSTRACTBUTTON_H
+#define TESTABSTRACTBUTTON_H
+
+#include "testgenerictextwidget.h"
+
+class QAbstractButton;
+
+namespace QtUiTest {
+
+class TestAbstractButton : public TestGenericTextWidget,
+ public QtUiTest::CheckWidget,
+ public QtUiTest::ActivateWidget,
+ public QtUiTest::LabelWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::CheckWidget
+ QtUiTest::ActivateWidget
+ QtUiTest::LabelWidget)
+
+public:
+ TestAbstractButton(QObject*);
+
+ virtual Qt::CheckState checkState() const;
+ virtual bool setCheckState(Qt::CheckState);
+ virtual bool activate();
+
+ virtual QString labelText() const;
+ virtual QObject* buddy() const;
+
+ static bool canWrap(QObject*);
+
+protected:
+ bool activate(QtUiTest::InputOption);
+
+signals:
+ void stateChanged(int);
+ void activated();
+
+private slots:
+ void on_toggled(bool);
+
+private:
+ QAbstractButton *q;
+ bool m_pressed;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testabstractitemview.cpp b/plugins/qtuitest_widgets/qtwidgets/testabstractitemview.cpp
new file mode 100644
index 0000000..ccb1371
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testabstractitemview.cpp
@@ -0,0 +1,475 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testabstractitemview.h"
+#include "testwidgetslog.h"
+
+#include <QListView>
+#include <QTimer>
+#include <QScrollBar>
+#include <QComboBox>
+#include <QGraphicsProxyWidget>
+#include <QGraphicsView>
+
+#include <qtuitestnamespace.h>
+
+namespace QtUiTest {
+
+TestAbstractItemView::TestAbstractItemView(QObject *_q)
+ : TestWidget(_q), q(qobject_cast<QAbstractItemView*>(_q))
+{
+ if (q && q->parent() && qobject_cast<QComboBox*>(q->parent()->parent())) {
+ // The test object of the combobox will handle recording
+ return;
+ }
+
+ QtUiTest::connectFirst(q, SIGNAL(activated(QModelIndex)),
+ this, SLOT(on_activated(QModelIndex)));
+ QtUiTest::connectFirst(q, SIGNAL(pressed(QModelIndex)),
+ this, SLOT(on_activated(QModelIndex)));
+}
+
+void TestAbstractItemView::on_activated(QModelIndex const& ind)
+{
+ // Timer discourages duplicate signal emission.
+ if (m_lastActivatedTimer.elapsed() > 500 || m_lastActivatedTimer.elapsed() < 0) {
+ TestWidgetsLog() << "emit selected" << ind.data().toString();
+ emit selected(printable(ind.data().toString()));
+ m_lastActivatedTimer.start();
+ } else {
+ TestWidgetsLog() << "Would emit selected" << ind.data().toString()
+ << "except we have already done that recently.";
+ }
+}
+
+QString TestAbstractItemView::selectedText() const
+{
+ TestWidgetsLog();
+ return printable(q->currentIndex().data().toString());
+}
+
+QString TestAbstractItemView::text() const
+{
+ TestWidgetsLog();
+ return list().join("\n");
+}
+
+QStringList TestAbstractItemView::list() const
+{
+ class QModelListGetter : public QModelViewIterator<QAbstractItemView>
+ {
+ public:
+ QModelListGetter(QAbstractItemView *view)
+ : QModelViewIterator<QAbstractItemView>(view) {};
+
+ QStringList getList() {
+ list.clear();
+ iterate(view()->rootIndex());
+ return list;
+ }
+ protected:
+ virtual void visit(QModelIndex const &index)
+ { list << itemForIndex(index); }
+
+ QStringList list;
+ };
+
+ return QModelListGetter(q).getList();
+}
+
+QModelIndex TestAbstractItemView::indexForItem(QString const &item) const
+{
+ QModelIndex ret;
+
+ class QModelIndexGetter : public QModelViewIterator<QAbstractItemView>
+ {
+ public:
+ QModelIndexGetter(QAbstractItemView *view, QString const &item)
+ : QModelViewIterator<QAbstractItemView>(view), matches(0), m_item(item) {};
+ QModelIndex index;
+ int matches;
+
+ protected:
+ void visit(QModelIndex const &idx) {
+
+ if (itemForIndex(idx) == m_item) {
+ ++matches;
+ index = idx;
+ }
+ }
+ private:
+ QString m_item;
+ };
+
+ QModelIndexGetter indexGetter(q, item);
+ indexGetter.iterate(q->rootIndex());
+
+ // No matching item
+ if (!indexGetter.matches) {
+ TestWidgetsLog() << "no matching item for" << item;
+ }
+
+ // More than one matching item
+ else if (indexGetter.matches > 1) {
+ qWarning("QtUitest: more than one item matches '%s' in item view", qPrintable(item));
+ TestWidgetsLog() << indexGetter.matches << "matches for" << item;
+ }
+
+ else
+ ret = indexGetter.index;
+
+ return ret;
+}
+
+QModelIndex TestAbstractItemView::indexFromList(QVariantList const &list) const
+{
+ QVariantList indexList = list;
+ QModelIndex ret;
+ if (list.size() > 1) {
+ int column = indexList.takeLast().toInt();
+ int row = indexList.takeLast().toInt();
+ ret = q->model()->index(row, column, indexFromList(indexList));
+ }
+ return ret;
+}
+
+
+QVariantList TestAbstractItemView::listFromIndex(QModelIndex const &index) const
+{
+ QVariantList ret;
+ if (index.parent().isValid()) {
+ ret << listFromIndex(index.parent());
+ }
+ if (index.isValid()) {
+ ret << index.row() << index.column();
+ }
+
+ return ret;
+}
+
+QRect TestAbstractItemView::visualRect(QString const &item) const
+{
+ QRect ret;
+
+ QModelIndex index = indexForItem(item);
+
+ if (index.isValid()) {
+ ret = q->visualRect(index);
+ ret.moveTopLeft(q->mapFromGlobal(q->viewport()->mapToGlobal(ret.topLeft())));
+ }
+
+ return ret;
+}
+
+bool TestAbstractItemView::isMultiSelection() const
+{ return (q->selectionMode() > QAbstractItemView::SingleSelection); }
+
+bool TestAbstractItemView::canSelect(QString const &item) const
+{
+ if (q->selectionMode() == QAbstractItemView::NoSelection)
+ return false;
+
+ return list().contains(item);
+}
+
+bool TestAbstractItemView::canSelectMulti(QStringList const &items) const
+{
+ if (!isMultiSelection())
+ return false;
+
+ QSet<QString> itemSet = items.toSet();
+ return ((itemSet & list().toSet()) == itemSet);
+}
+
+bool TestAbstractItemView::select(QString const &item)
+{
+ TestWidgetsLog() << item;
+
+ if (!canSelect(item)) {
+ TestWidgetsLog() << "can't select" << item;
+ return false;
+ }
+
+ if (!QtUiTest::mousePreferred() && (!setFocus() || !hasFocus())) {
+ QtUiTest::setErrorString("Couldn't give focus to item view");
+ return false;
+ }
+
+ return select(indexForItem(item));
+}
+
+bool TestAbstractItemView::select(QModelIndex const &index)
+{
+ if (QtUiTest::mousePreferred()) {
+ if (!ensureVisible(index)) {
+ TestWidgetsLog() << "couldn't make item visible";
+ return false;
+ }
+ QPoint pos = q->visualRect(index).center();
+ TestWidgetsLog() << "after ensureVisible, item is at" << pos;
+
+ while (q->parentWidget()) {
+ // Workaround to allow selection from QComboBoxes embedded in a QGraphicsView
+ QGraphicsProxyWidget *gpw = q->parentWidget()->graphicsProxyWidget();
+ if (!gpw) break;
+ QGraphicsScene *scene = gpw->scene();
+ if (!scene) break;
+ QGraphicsView *view = scene->views().first();
+ if (!view) break;
+ QtUiTest::mouseClick(view->mapToGlobal(view->mapFromScene(gpw->mapToScene(pos))), Qt::LeftButton);
+ return true;
+ }
+
+ QtUiTest::mouseClick(q->viewport()->mapToGlobal(pos), Qt::LeftButton);
+ return true;
+
+ } else {
+ // Consume pending key events, if any.
+ while (QtUiTest::waitForEvent(q, QEvent::KeyRelease, 200, Qt::QueuedConnection))
+ {}
+
+ const int maxtries = 100;
+
+ // Move vertically
+ int desiredY = q->visualRect(index).center().y();
+ int currentY = q->visualRect(q->currentIndex()).center().y();
+
+ for (int i = 0; i < maxtries && desiredY != currentY; ++i) {
+ Qt::Key key;
+ if (desiredY < currentY) {
+ key = Qt::Key_Up;
+ TestWidgetsLog() << "Up (desired=" << desiredY << ", current=" << currentY << ")";
+ } else {
+ key = Qt::Key_Down;
+ TestWidgetsLog() << "Down (desired=" << desiredY << ", current=" << currentY << ")";
+ }
+ if (!QtUiTest::keyClick(q, key)) return false;
+ desiredY = q->visualRect(index).center().y();
+ currentY = q->visualRect(q->currentIndex()).center().y();
+ }
+ if (desiredY != currentY) {
+ QtUiTest::setErrorString(QString(
+ "Up/down keys failed to move highlight vertically; desired position %1, "
+ "current position %2").arg(desiredY).arg(currentY));
+ return false;
+ }
+
+ // Move horizontally
+ int desiredX = q->visualRect(index).center().x();
+ int currentX = q->visualRect(q->currentIndex()).center().x();
+
+ for (int i = 0; i < maxtries && desiredX != currentX; ++i) {
+ Qt::Key key;
+ if (desiredX < currentX) {
+ key = Qt::Key_Left;
+ TestWidgetsLog() << "Left (desired=" << desiredX << ", current=" << currentX << ")";
+ } else {
+ key = Qt::Key_Right;
+ TestWidgetsLog() << "Right (desired=" << desiredX << ", current=" << currentX << ")";
+ }
+ if (!QtUiTest::keyClick(q, key)) return false;
+ desiredX = q->visualRect(index).center().x();
+ currentX = q->visualRect(q->currentIndex()).center().x();
+ }
+ if (desiredX != currentX) {
+ QtUiTest::setErrorString(QString(
+ "Left/right keys failed to move highlight horizontally; desired position %1, "
+ "current position %2").arg(desiredX).arg(currentX));
+ return false;
+ }
+
+ TestWidgetsLog() << "hit activate key";
+ if (!QtUiTest::keyClick(q, QtUiTest::Key_Activate)) return false;
+ return true;
+ }
+
+ return false;
+}
+
+bool TestAbstractItemView::selectMulti(QStringList const &items)
+{
+ if (!canSelectMulti(items)) return false;
+
+ TestWidgetsLog() << items;
+
+ return false;
+}
+
+bool TestAbstractItemView::selectIndex(QVariantList const &indexList)
+{
+ QModelIndex idx = indexFromList(indexList);
+ if (idx.isValid()) {
+ return select(idx);
+ }
+ else {
+ QtUiTest::setErrorString("Invalid index");
+ return false;
+ }
+}
+
+QVariantList TestAbstractItemView::selectedIndex() const
+{
+ return listFromIndex(q->currentIndex());
+}
+
+bool TestAbstractItemView::ensureVisible(QString const &item)
+{
+ return ensureVisible(indexForItem(item));
+}
+
+bool TestAbstractItemView::ensureVisible(QModelIndex const &index)
+{
+ QPoint p = q->visualRect(index).center();
+
+ if (q->viewport()->rect().contains(p)) {
+ TestWidgetsLog() << "item is already visible";
+ return true;
+ }
+
+ if (!QtUiTest::mousePreferred())
+ return false;
+
+ /* Figure out the points to click for scrolling in each direction */
+ QScrollBar *vbar = q->verticalScrollBar();
+ QScrollBar *hbar = q->horizontalScrollBar();
+ QPoint up = vbar->mapToGlobal(QPoint(vbar->width()/2,5));
+ QPoint down = vbar->mapToGlobal(QPoint(vbar->width()/2,vbar->height()-5));
+ QPoint left = hbar->mapToGlobal(QPoint(5, hbar->height()/2));
+ QPoint right = hbar->mapToGlobal(QPoint(hbar->width()-5,hbar->height()/2));
+
+ // While p is above rect...
+ while (p.y() < q->viewport()->rect().top()) {
+ if (!vbar->isVisible()) return false;
+ TestWidgetsLog() << "up" << "\nrect:" << rect() << "p:" << p;
+ QtUiTest::mouseClick(up);
+ waitForSignal(vbar, SIGNAL(valueChanged(int)));
+ p = q->visualRect(index).center();
+ }
+ // While p is below rect...
+ while (p.y() > q->viewport()->rect().bottom()) {
+ if (!vbar->isVisible()) return false;
+ TestWidgetsLog() << "down" << "\nrect:" << rect() << "p:" << p;
+ QtUiTest::mouseClick(down);
+ waitForSignal(vbar, SIGNAL(valueChanged(int)));
+ p = q->visualRect(index).center();
+ }
+ // While p is left of rect...
+ while (p.x() < q->viewport()->rect().left()) {
+ if (!hbar->isVisible()) return false;
+ TestWidgetsLog() << "left" << "\nrect:" << rect() << "p:" << p;
+ QtUiTest::mouseClick(left);
+ waitForSignal(hbar, SIGNAL(valueChanged(int)));
+ p = q->visualRect(index).center();
+ }
+ // While p is right of rect...
+ while (p.x() > q->viewport()->rect().right()) {
+ if (!hbar->isVisible()) return false;
+ TestWidgetsLog() << "right" << "\nrect:" << rect() << "p:" << p;
+ QtUiTest::mouseClick(right);
+ waitForSignal(hbar, SIGNAL(valueChanged(int)));
+ p = q->visualRect(index).center();
+ }
+
+ if (!q->viewport()->rect().contains(p)) {
+ TestWidgetsLog() << "failed" << "\nrect:" << q->viewport()->rect() << "p:" << p;
+ return false;
+ }
+
+ return true;
+}
+
+bool TestAbstractItemView::canEnter(QVariant const& item) const
+{
+ bool ret = false;
+ QModelIndex ci = q->currentIndex();
+ if (ci.isValid() && q->selectionMode() != QAbstractItemView::NoSelection && ci.flags() & Qt::ItemIsEditable) {
+ QWidget *indexWidget = q->indexWidget(ci);
+ if (!indexWidget) {
+ // FIXME: Should simulate correct events to enter edit mode
+ q->edit(ci);
+ indexWidget = q->indexWidget(ci);
+ }
+ InputWidget* iw = qtuitest_cast<InputWidget*>(indexWidget);
+ if (iw) {
+ ret = iw->canEnter(item);
+ // FIXME: Should simulate correct events to leave edit mode
+ q->setFocus();
+ } else {
+ SelectWidget* sw = qtuitest_cast<SelectWidget*>(indexWidget);
+ if (sw) {
+ ret = sw->canSelect(item.toString());
+ q->setFocus();
+ }
+ }
+ }
+ return ret;
+}
+
+bool TestAbstractItemView::enter(QVariant const& item, bool noCommit)
+{
+ bool ret = false;
+ QModelIndex ci = q->currentIndex();
+ if (ci.isValid() && q->selectionMode() != QAbstractItemView::NoSelection && ci.flags() & Qt::ItemIsEditable) {
+ QWidget *indexWidget = q->indexWidget(ci);
+ if (!indexWidget) {
+ // FIXME: Should simulate correct events to enter edit mode
+ q->edit(ci);
+ indexWidget = q->indexWidget(ci);
+ }
+ InputWidget* iw = qtuitest_cast<InputWidget*>(indexWidget);
+ if (iw) {
+ ret = iw->enter(item, noCommit);
+ // FIXME: Should simulate correct events to leave edit mode
+ q->setFocus();
+ } else {
+ SelectWidget* sw = qtuitest_cast<SelectWidget*>(indexWidget);
+ ret = sw->select(item.toString());
+ q->setFocus();
+ }
+ }
+
+ return ret;
+}
+
+bool TestAbstractItemView::canWrap(QObject* o)
+{ return qobject_cast<QAbstractItemView*>(o); }
+
+}
diff --git a/plugins/qtuitest_widgets/qtwidgets/testabstractitemview.h b/plugins/qtuitest_widgets/qtwidgets/testabstractitemview.h
new file mode 100644
index 0000000..b6a5ddb
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testabstractitemview.h
@@ -0,0 +1,185 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTABSTRACTITEMVIEW_H
+#define TESTABSTRACTITEMVIEW_H
+
+#include <testwidget.h>
+#include <QAbstractItemView>
+#include <QTime>
+
+const int QTUITEST_MAX_LIST=15000;
+
+namespace QtUiTest {
+
+class TestAbstractItemView : public TestWidget,
+ public QtUiTest::TextWidget,
+ public QtUiTest::ListWidget,
+ public QtUiTest::SelectWidget,
+ public QtUiTest::IndexedWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::TextWidget
+ QtUiTest::ListWidget
+ QtUiTest::SelectWidget
+ QtUiTest::IndexedWidget)
+
+public:
+ TestAbstractItemView(QObject*);
+
+ virtual QString text() const;
+ virtual QString selectedText() const;
+
+ virtual QStringList list() const;
+ virtual QRect visualRect(QString const&) const;
+ virtual bool ensureVisible(QString const&);
+
+ virtual bool canEnter(QVariant const&) const;
+ virtual bool enter(QVariant const&,bool);
+
+ virtual bool isMultiSelection() const;
+ virtual bool canSelect(QString const&) const;
+ virtual bool canSelectMulti(QStringList const&) const;
+ virtual bool select(QString const&);
+ virtual bool selectMulti(QStringList const&);
+
+ virtual bool selectIndex(QVariantList const&);
+ virtual QVariantList selectedIndex() const;
+
+ static bool canWrap(QObject*);
+
+protected:
+ virtual QModelIndex indexForItem(QString const&) const;
+ virtual QModelIndex indexFromList(QVariantList const&) const;
+ virtual QVariantList listFromIndex(QModelIndex const&) const;
+ virtual bool ensureVisible(QModelIndex const&);
+ virtual bool select(QModelIndex const&);
+
+signals:
+ void selected(const QString&);
+
+private slots:
+ void on_activated(QModelIndex const&);
+
+private:
+ QAbstractItemView *q;
+ QTime m_lastActivatedTimer;
+};
+
+template <typename T>
+class QModelViewIterator
+{
+public:
+ QModelViewIterator(T* view)
+ : m_view(view), count(0)
+ {}
+
+ virtual ~QModelViewIterator()
+ {}
+
+ virtual void iterate(QModelIndex rootIndex = QModelIndex(), bool recurse=true)
+ {
+ QModelIndexList seen;
+ iterate(rootIndex, &seen, recurse, true);
+ }
+
+protected:
+ T* view() const
+ { return m_view; }
+ QAbstractItemModel* model() const
+ { return m_view->model(); }
+
+ virtual void visit(QModelIndex const&) = 0;
+ virtual void overFlow()
+ {
+ QtUiTest::setErrorString("Maximum number of items exceeded");
+ }
+ virtual bool isRowHidden(int, const QModelIndex&)
+ {
+ return false;
+ }
+ virtual QString itemForIndex(QModelIndex const& idx) const
+ {
+ return TestWidget::printable(idx.data().toString());
+ }
+
+private:
+ void iterate(QModelIndex const &index, QModelIndexList *seen, bool recurse, bool isRoot=false)
+ {
+ if (++count > QTUITEST_MAX_LIST) {
+ overFlow();
+ return;
+ }
+
+ if (index.isValid()) {
+ visit(index);
+ (*seen) << index;
+ }
+
+ for (int i = 0, max_i = model()->rowCount(index); i < max_i && count <= QTUITEST_MAX_LIST; ++i) {
+ if (isRowHidden(i, index)) {
+ continue;
+ }
+ for (int j = 0, max_j = model()->columnCount(index);
+ j < max_j && count <= QTUITEST_MAX_LIST; ++j) {
+ QModelIndex child;
+ if (model()->hasIndex(i, j, index)) {
+ child = model()->index(i, j, index);
+ }
+ if (child.isValid() && !seen->contains(child) && (isRoot || recurse)) {
+#if 0
+ /* Very verbose! */
+ qDebug() << "child at (" << i << "," << j << ")" << child.data();
+#endif
+ iterate(child, seen, recurse);
+ }
+ }
+ }
+ }
+
+ T *m_view;
+ int count;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testabstractspinbox.cpp b/plugins/qtuitest_widgets/qtwidgets/testabstractspinbox.cpp
new file mode 100644
index 0000000..3469667
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testabstractspinbox.cpp
@@ -0,0 +1,125 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testabstractspinbox.h"
+#include "testwidgetslog.h"
+
+#include <QPointer>
+#include <QSpinBox>
+#include <QValidator>
+#include <QVariant>
+
+namespace QtUiTest {
+
+TestAbstractSpinBox::TestAbstractSpinBox(QObject *_q)
+ : TestGenericTextWidget(_q), q(qobject_cast<QAbstractSpinBox*>(_q))
+{
+//TestWidgetsLog();
+}
+
+bool TestAbstractSpinBox::canEnter(QVariant const& item) const
+{
+ if (!item.canConvert<QString>()) return false;
+
+ int dontcare = 0;
+ QString text = item.toString();
+ return (QValidator::Acceptable==q->validate(text, dontcare));
+}
+
+bool TestAbstractSpinBox::enter(QVariant const& item, bool noCommit)
+{
+ if (!canEnter(item)) return false;
+ if (!hasFocus() && !setFocus()) return false;
+
+ using namespace QtUiTest;
+
+ QPointer<QObject> safeThis = this;
+ if (!safeThis) {
+ setErrorString("Widget was destroyed while entering text.");
+ return false;
+ }
+
+ InputWidget* iw = qtuitest_cast<InputWidget*>(inputProxy());
+ TestWidgetsLog() << iw;
+
+ //FIXME: This shouldn't be necessary
+ bool kt = q->keyboardTracking();
+ q->setKeyboardTracking(true);
+
+ //FIXME: Doesn't use mouse events...
+ bool ret = true;
+
+ /* Use input method if available... */
+ if (iw) {
+ ret = iw->canEnter(item) && iw->enter(item, noCommit);
+ } else {
+ //FIXME: Should clear existing text using keyClicks, not API
+ q->clear();
+ /* ...otherwise, generate key clicks ourself */
+ foreach (QChar c, item.toString()) {
+ TestWidgetsLog() << asciiToModifiers(c.toLatin1());
+ keyClick( asciiToKey(c.toLatin1()), asciiToModifiers(c.toLatin1()) );
+ }
+ }
+
+ waitForSignal(q, SIGNAL(valueChanged(int)));
+ q->setKeyboardTracking(kt);
+
+ if (!safeThis) {
+ setErrorString("Widget was destroyed while entering text.");
+ return false;
+ }
+
+ if (mousePreferred()) {
+ return ret;
+ }
+
+ if (!noCommit) {
+ keyClick(QtUiTest::Key_Activate);
+ }
+
+ return ret;
+}
+
+bool TestAbstractSpinBox::canWrap(QObject *o)
+{ return qobject_cast<QAbstractSpinBox*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testabstractspinbox.h b/plugins/qtuitest_widgets/qtwidgets/testabstractspinbox.h
new file mode 100644
index 0000000..1f3444e
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testabstractspinbox.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTABSTRACTSPINBOX_H
+#define TESTABSTRACTSPINBOX_H
+
+#include "testgenerictextwidget.h"
+
+class QAbstractSpinBox;
+
+namespace QtUiTest {
+
+class TestAbstractSpinBox : public TestGenericTextWidget
+{
+ Q_OBJECT
+
+public:
+ TestAbstractSpinBox(QObject*);
+
+ virtual bool canEnter(QVariant const&) const;
+ virtual bool enter(QVariant const&,bool);
+
+ static bool canWrap(QObject*);
+
+private:
+ QAbstractSpinBox *q;
+};
+
+}
+#endif
diff --git a/plugins/qtuitest_widgets/qtwidgets/testcalendarwidget.cpp b/plugins/qtuitest_widgets/qtwidgets/testcalendarwidget.cpp
new file mode 100644
index 0000000..68897c6
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testcalendarwidget.cpp
@@ -0,0 +1,185 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testcalendarwidget.h"
+#include "testwidgetslog.h"
+
+#include <qtuitestnamespace.h>
+
+#include <QAbstractItemView>
+#include <QCalendarWidget>
+#include <QMenu>
+#include <QSpinBox>
+#include <QToolButton>
+
+namespace QtUiTest {
+
+/* FIXME replace this with canSelect */
+QString const GetListRegExp = QString("QTUITEST_REGEX_");
+
+TestCalendarWidget::TestCalendarWidget(QObject *_q)
+ : TestWidget(_q), q(qobject_cast<QCalendarWidget*>(_q))
+{}
+
+QStringList TestCalendarWidget::list() const
+{
+ QStringList ret;
+ QtUiTest::ListWidget *calendarView
+ = qtuitest_cast<QtUiTest::ListWidget*>(
+ q->findChild<QAbstractItemView*>());
+
+ if (!calendarView) {
+ return ret;
+ }
+
+ ret = calendarView->list();
+
+ /* Append months */
+ QStringList months;
+ for (int i = 1; i <= 12; ++i) {
+ months << QDate::longMonthName(i);
+ }
+ ret << months;
+
+ /* Append years */
+ /* FIXME replace this with canSelect() */
+ ret << (GetListRegExp + "[0-9]{4}");
+
+ return ret;
+}
+
+/* FIXME make this less of a hack. */
+QRect TestCalendarWidget::visualRect(QString const &item) const
+{
+ TestWidgetsLog() << item << "my geometry is" << geometry();
+
+ QRect ret;
+
+ QAbstractItemView *view = q->findChild<QAbstractItemView*>();
+ QtUiTest::ListWidget *calendarView
+ = qtuitest_cast<QtUiTest::ListWidget*>(view);
+
+ if (!calendarView) {
+ return ret;
+ }
+
+ ret = calendarView->visualRect(item);
+ if (!ret.isNull()) {
+ ret.moveTopLeft( q->mapFromGlobal( view->mapToGlobal(ret.topLeft()) ) );
+ TestWidgetsLog() << item << "is a visible day at" << ret;
+ return ret;
+ }
+
+ QToolButton *yearButton = 0;
+ QToolButton *monthButton = 0;
+ QSpinBox *yearSpin = q->findChild<QSpinBox*>();
+ QMenu *monthMenu = 0;
+
+ QList<QToolButton*> blist = q->findChildren<QToolButton*>();
+ foreach(QToolButton *b, blist) {
+ if (!monthButton && (monthMenu = b->menu())) {
+ monthButton = b;
+ }
+ if (!b->menu()) {
+ yearButton = b;
+ }
+ }
+ TestWidgetsLog() << "monthButton" << monthButton << "yearButton" << yearButton;
+ TestWidgetsLog() << "item" << item << "monthMenu" << monthMenu;
+
+ if (yearButton && yearButton->isVisible() && yearButton->text() == item) {
+ QPoint p = q->mapFromGlobal( yearButton->mapToGlobal(QPoint(yearButton->width()+5, yearButton->height()/2)) );
+ ret = QRect(p.x() - 2, p.y() - 2, 5, 5);
+ TestWidgetsLog() << "click near yearbutton";
+ } else if (yearSpin && yearSpin->isVisible() && yearSpin->value() == item.toInt()) {
+ TestWidgetsLog() << "confirm spinbox";
+ QPoint p = q->mapFromGlobal( yearSpin->mapToGlobal(QPoint(yearSpin->width()+5, yearSpin->height()/2)) );
+ ret = QRect(p.x() - 2, p.y() - 2, 5, 5);
+ } else if (monthButton && monthButton->isVisible() && monthButton->text() == item) {
+ QPoint p = q->mapFromGlobal( monthButton->mapToGlobal(QPoint(-5, monthButton->height()/2)) );
+ ret = QRect(p.x() - 2, p.y() - 2, 5, 5);
+ TestWidgetsLog() << "click near monthbutton";
+ } else if (monthMenu && monthMenu->isVisible()
+ && qtuitest_cast<QtUiTest::ListWidget*>(monthMenu)
+ && qtuitest_cast<QtUiTest::ListWidget*>(monthMenu)->list().contains(item)) {
+ ret = qtuitest_cast<QtUiTest::ListWidget*>(monthMenu)->visualRect(item);
+ ret.moveTopLeft( q->mapFromGlobal( monthMenu->mapToGlobal(ret.topLeft()) ) );
+ TestWidgetsLog() << "click on monthmenu";
+ } else {
+ do {
+ QStringList items = list();
+ if (items.contains(item)) {
+ ret = QRect(-1, -1, 1, 1);
+ ret.moveTopLeft( q->mapFromGlobal(QPoint(-1,-1)) );
+ break;
+ }
+ foreach (QString s, items) {
+ if (!s.startsWith(GetListRegExp)) continue;
+ QRegExp re(s.mid(GetListRegExp.length()));
+ if (re.exactMatch(item)) {
+ ret = QRect(-1, -1, 1, 1);
+ ret.moveTopLeft( q->mapFromGlobal(QPoint(-1,-1)) );
+ break;
+ }
+ }
+ if (!ret.isNull()) break;
+ } while(0);
+ }
+
+ TestWidgetsLog() << "returning rect" << ret;
+
+ return ret;
+}
+
+/* FIXME implement these. */
+bool TestCalendarWidget::canSelect(QString const&) const
+{ return false; }
+
+bool TestCalendarWidget::select(QString const&)
+{ return false; }
+
+bool TestCalendarWidget::ensureVisible(QString const&)
+{ return false; }
+
+bool TestCalendarWidget::canWrap(QObject *o)
+{ return qobject_cast<QCalendarWidget*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testcalendarwidget.h b/plugins/qtuitest_widgets/qtwidgets/testcalendarwidget.h
new file mode 100644
index 0000000..5846a95
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testcalendarwidget.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTCALENDARWIDGET_H
+#define TESTCALENDARWIDGET_H
+
+#include <testwidget.h>
+
+class QCalendarWidget;
+
+namespace QtUiTest {
+
+class TestCalendarWidget : public TestWidget, public QtUiTest::ListWidget,
+ public QtUiTest::SelectWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::ListWidget
+ QtUiTest::SelectWidget)
+
+public:
+ TestCalendarWidget(QObject*);
+
+ virtual QStringList list() const;
+ virtual QRect visualRect(QString const&) const;
+ virtual bool ensureVisible(QString const&);
+
+ virtual bool canSelect(QString const&) const;
+ virtual bool select(QString const&);
+
+ static bool canWrap(QObject*);
+
+private:
+ QCalendarWidget *q;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testcheckbox.cpp b/plugins/qtuitest_widgets/qtwidgets/testcheckbox.cpp
new file mode 100644
index 0000000..cb7c5ee
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testcheckbox.cpp
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testcheckbox.h"
+#include "testwidgetslog.h"
+
+#include <QCheckBox>
+
+namespace QtUiTest {
+
+TestCheckBox::TestCheckBox(QObject *_q)
+ : TestAbstractButton(_q), q(qobject_cast<QCheckBox*>(_q))
+{ TestWidgetsLog(); }
+
+bool TestCheckBox::isTristate() const
+{ TestWidgetsLog(); return q->isTristate(); }
+
+Qt::CheckState TestCheckBox::checkState() const
+{ TestWidgetsLog(); return q->checkState(); }
+
+bool TestCheckBox::setCheckState(Qt::CheckState state)
+{
+ Qt::CheckState initState = checkState();
+ if (state == initState) return true;
+
+ bool ret = activate(QtUiTest::NoOptions);
+ TestWidgetsLog() << "activated:" << ret;
+
+ if (ret && (state == initState) && !QtUiTest::waitForSignal(q, SIGNAL(stateChanged(int)))) {
+ QtUiTest::setErrorString("Successfully activated button, but check state did not change "
+ "to expected value.");
+ return false;
+ }
+
+ // Give application time to respond to first activation
+ QtUiTest::wait(20);
+
+ if (state != checkState()) {
+ ret = activate(QtUiTest::NoOptions);
+ TestWidgetsLog() << "activated:" << ret;
+ }
+
+ if (ret && (state != checkState()) && !QtUiTest::waitForSignal(q, SIGNAL(stateChanged(int)))) {
+ QtUiTest::setErrorString("Successfully activated button, but check state did not change "
+ "to expected value.");
+ return false;
+ }
+ TestWidgetsLog() << "state:" << ret;
+ return ret;
+}
+
+bool TestCheckBox::canWrap(QObject *o)
+{ return qobject_cast<QCheckBox*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testcheckbox.h b/plugins/qtuitest_widgets/qtwidgets/testcheckbox.h
new file mode 100644
index 0000000..2698ce7
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testcheckbox.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTCHECKBOX_H
+#define TESTCHECKBOX_H
+
+#include "testabstractbutton.h"
+
+class QCheckBox;
+
+namespace QtUiTest {
+
+class TestCheckBox : public TestAbstractButton
+{
+ Q_OBJECT
+public:
+ TestCheckBox(QObject*);
+
+ virtual bool isTristate() const;
+ virtual Qt::CheckState checkState() const;
+ virtual bool setCheckState(Qt::CheckState);
+
+ static bool canWrap(QObject*);
+
+private:
+ QCheckBox *q;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testcombobox.cpp b/plugins/qtuitest_widgets/qtwidgets/testcombobox.cpp
new file mode 100644
index 0000000..0def518
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testcombobox.cpp
@@ -0,0 +1,252 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testcombobox.h"
+#include "testwidgetslog.h"
+
+#include <qtuitestnamespace.h>
+
+#include <QComboBox>
+#include <QAbstractItemView>
+
+namespace QtUiTest {
+
+TestComboBox::TestComboBox(QObject *_q)
+ : TestWidget(_q), q(qobject_cast<QComboBox*>(_q))
+{
+ TestWidgetsLog();
+ connect(q, SIGNAL(activated(QString)), this, SIGNAL(selected(QString)));
+}
+
+QString TestComboBox::text() const
+{ TestWidgetsLog(); return list().join("\n"); }
+
+QString TestComboBox::selectedText() const
+{ TestWidgetsLog(); return q->currentText(); }
+
+QStringList TestComboBox::list() const
+{
+ QStringList ret;
+ for (int i = 0, max = q->count(); i < max; ++i) {
+ ret << q->itemText(i);
+ }
+ TestWidgetsLog() << ret;
+ return ret;
+}
+
+QRect TestComboBox::visualRect(QString const &item) const
+{
+ TestWidgetsLog();
+ QRect ret;
+ QtUiTest::ListWidget *viewList
+ = qtuitest_cast<QtUiTest::ListWidget*>(q->view());
+ if (viewList) {
+ ret = viewList->visualRect(item);
+ }
+ return ret;
+}
+
+QString TestComboBox::labelText() const
+{
+ QString ret = selectedText();
+ if (ret.isEmpty())
+ return ret;
+
+ QObject *w = parent();
+ while (w) {
+ QtUiTest::Widget *qw = qtuitest_cast<QtUiTest::Widget*>(w);
+ QtUiTest::LabelWidget *lw = qtuitest_cast<QtUiTest::LabelWidget*>(w);
+ if (lw) {
+ if (!lw->labelText().isEmpty()) {
+ ret.prepend(lw->labelText() + "/");
+ break;
+ }
+ }
+ w = qw->parent();
+ }
+ return ret;
+}
+
+QObject* TestComboBox::buddy() const
+{
+ return q;
+}
+
+bool TestComboBox::canSelect(QString const &item) const
+{ return list().contains(item); }
+
+bool TestComboBox::select(QString const &item)
+{
+ TestWidgetsLog() << item;
+ if (!canSelect(item)) return false;
+ if (selectedText() == item) return true;
+
+ QtUiTest::Widget *wView
+ = qtuitest_cast<QtUiTest::Widget*>(q->view());
+ QtUiTest::SelectWidget *sView
+ = qtuitest_cast<QtUiTest::SelectWidget*>(q->view());
+ if (!wView || !sView) {
+ QtUiTest::setErrorString("Can't find a pointer to the item view for this combobox.");
+ return false;
+ }
+
+ TestWidgetsLog() << "view isVisible()" << wView->isVisible();
+
+ /* Open the view if it is not currently open. */
+ if (!wView->isVisible()) {
+ if (QtUiTest::mousePreferred()) {
+ QStyle const* style = q->style();
+ QStyleOptionComboBox opt;
+ opt.initFrom(q);
+ QRect rect = style->subControlRect( QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxArrow, q);
+ QPoint pos = rect.center();
+ TestWidgetsLog() << "local pos" << pos;
+ pos = mapToGlobal(pos);
+ /* May take more than one click. */
+ for (int i = 0; i < 2 && !wView->isVisible(); ++i) {
+ TestWidgetsLog() << "global pos" << pos;
+ TestWidgetsLog() << "Going to click at" << pos << "to open the view";
+ QtUiTest::mouseClick(pos, Qt::LeftButton);
+ QtUiTest::waitForSignal(q, SIGNAL(highlighted(int)));
+ }
+ // Combo box tries to detect and ignore "accidental" double clicks,
+ // so wait for a bit to ensure any subsequent clicks aren't
+ // ignored.
+ QtUiTest::wait( qApp->doubleClickInterval() );
+ } else {
+ TestWidgetsLog() << "Going to give myself focus";
+ if (!setFocus()) {
+ QtUiTest::setErrorString("Could not give focus to combobox");
+ return false;
+ }
+ if (q->isEditable()) {
+ return selectWithKeys(item);
+ } else {
+ //FIXME: This doesn't work if the combobox is editable
+ QtUiTest::keyClick(QtUiTest::Key_Select);
+ if (!q->view()->hasFocus() && !QtUiTest::waitForEvent( q->view(), QEvent::FocusIn)) {
+ QtUiTest::setErrorString("Could not give focus to combobox popup.");
+ return false;
+ }
+ }
+ }
+ }
+
+ /* Select the desired item from the view. */
+ TestWidgetsLog() << "Calling select() on the view";
+ bool ret = sView->select(item);
+
+ // Wait up to 1 second for the view to disappear after selection.
+ for (int i = 0; i < 1000 && wView->isVisible(); i+=100, QtUiTest::wait(100))
+ {}
+
+ if (!ret && QtUiTest::errorString().isEmpty()) {
+ QtUiTest::setErrorString(
+ "Selecting from embedded item view in combo box failed for an unknown reason.");
+ }
+
+ return ret;
+}
+
+bool TestComboBox::selectWithKeys(QString const &item)
+{
+ QStringList allItems = list();
+
+ const int maxtries = 100;
+ int desiredIndex = allItems.indexOf(item);
+
+ if (-1 == desiredIndex)
+ return false;
+
+ int currentIndex = q->currentIndex();
+
+ // Move vertically
+ Qt::Key key;
+ if (desiredIndex > currentIndex)
+ key = Qt::Key_Down;
+ else
+ key = Qt::Key_Up;
+
+ for (int i = 0; i < maxtries && selectedText() != item; ++i) {
+ TestWidgetsLog() << "keyClick" << (key==Qt::Key_Down ? "Down" : "Up");
+ if (!QtUiTest::keyClick(q, key)) return false;
+ }
+ QString selected = selectedText();
+ TestWidgetsLog() << "selectedText() now" << selected;
+ if (selected != item) {
+ QtUiTest::setErrorString(QString(
+ "Up/down keys should have caused item %1 to become selected, but item %2 "
+ "is selected instead.").arg(item).arg(selected));
+ return false;
+ }
+ return true;
+}
+
+bool TestComboBox::canEnter(QVariant const& item) const
+{
+ if (q->isEditable()) {
+ if (!item.canConvert<QString>()) return false;
+ int dontcare = 0;
+ QString text = item.toString();
+ const QValidator *validator = q->validator();
+ if (validator) {
+ return (QValidator::Acceptable==validator->validate(text, dontcare));
+ } else {
+ return true;
+ }
+ } else {
+ return canSelect(item.toString());
+ }
+}
+
+bool TestComboBox::enter(QVariant const& item, bool noCommit)
+{
+ if (q->isEditable()) {
+ return TestWidget::enter(item, noCommit);
+ } else {
+ return select(item.toString());
+ }
+}
+
+bool TestComboBox::canWrap(QObject *o)
+{ return qobject_cast<QComboBox*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testcombobox.h b/plugins/qtuitest_widgets/qtwidgets/testcombobox.h
new file mode 100644
index 0000000..c8e72dd
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testcombobox.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTCOMBOBOX_H
+#define TESTCOMBOBOX_H
+
+#include <testwidget.h>
+
+class QComboBox;
+
+namespace QtUiTest {
+
+class TestComboBox : public TestWidget,
+ public QtUiTest::TextWidget,
+ public QtUiTest::ListWidget,
+ public QtUiTest::LabelWidget,
+ public QtUiTest::SelectWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::TextWidget
+ QtUiTest::ListWidget
+ QtUiTest::LabelWidget
+ QtUiTest::SelectWidget)
+public:
+ TestComboBox(QObject*);
+
+ virtual QString text() const;
+ virtual QString selectedText() const;
+
+ virtual QStringList list() const;
+ virtual QRect visualRect(QString const&) const;
+
+ virtual QString labelText() const;
+ virtual QObject* buddy() const;
+
+ virtual bool canSelect(QString const&) const;
+ virtual bool select(QString const&);
+
+ virtual bool canEnter(QVariant const&) const;
+ virtual bool enter(QVariant const&,bool);
+
+ static bool canWrap(QObject*);
+
+signals:
+ void selected(QString const&);
+
+private:
+ bool selectWithKeys(QString const&);
+
+ QComboBox *q;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testdateedit.cpp b/plugins/qtuitest_widgets/qtwidgets/testdateedit.cpp
new file mode 100644
index 0000000..a14622f
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testdateedit.cpp
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testdateedit.h"
+#include "testwidgetslog.h"
+
+#include <QDateEdit>
+
+namespace QtUiTest {
+
+TestDateEdit::TestDateEdit(QObject* _q)
+ : TestDateTimeEdit(_q), q(qobject_cast<QDateEdit*>(_q))
+{
+ TestWidgetsLog();
+
+ disconnect(q, SIGNAL(dateTimeChanged(QDateTime)), this, 0);
+ connect(q, SIGNAL(dateTimeChanged(QDateTime)),
+ this, SLOT(onDateTimeChanged(QDateTime)));
+}
+
+void TestDateEdit::onDateTimeChanged(QDateTime const& dt)
+{
+ emit entered(dt.date());
+}
+
+QString TestDateEdit::text() const
+{
+ TestWidgetsLog();
+ return q->date().toString(q->displayFormat());
+}
+
+QVariant TestDateEdit::value() const
+{
+ return q->date();
+}
+
+bool TestDateEdit::canWrap(QObject *o)
+{ return qobject_cast<QDateEdit*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testdateedit.h b/plugins/qtuitest_widgets/qtwidgets/testdateedit.h
new file mode 100644
index 0000000..3494e14
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testdateedit.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTDATEEDIT_H
+#define TESTDATEEDIT_H
+
+#include "testdatetimeedit.h"
+
+class QDateEdit;
+
+namespace QtUiTest {
+
+class TestDateEdit : public TestDateTimeEdit
+{
+ Q_OBJECT
+public:
+ TestDateEdit(QObject*);
+
+ virtual QString text() const;
+ virtual QVariant value() const;
+
+ static bool canWrap(QObject*);
+
+private slots:
+ void onDateTimeChanged(QDateTime const&);
+
+private:
+ QDateEdit *q;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testdatetimeedit.cpp b/plugins/qtuitest_widgets/qtwidgets/testdatetimeedit.cpp
new file mode 100644
index 0000000..a1f6a56
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testdatetimeedit.cpp
@@ -0,0 +1,463 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testdatetimeedit.h"
+#include "testwidgetslog.h"
+
+#include <QLayout>
+#include <QLineEdit>
+#include <QStyleOptionSpinBox>
+
+namespace QtUiTest {
+
+TestDateTimeEdit::TestDateTimeEdit(QObject* _q)
+ : TestGenericTextWidget(_q), q(qobject_cast<QDateTimeEdit*>(_q))
+{
+ TestWidgetsLog();
+ connect(q, SIGNAL(dateTimeChanged(QDateTime)),
+ this, SLOT(onDateTimeChanged(QDateTime)));
+}
+
+void TestDateTimeEdit::onDateTimeChanged(QDateTime const& dt)
+{ emit entered(dt); }
+
+QString TestDateTimeEdit::text() const
+{
+ TestWidgetsLog();
+ return q->dateTime().toString();
+}
+
+QVariant TestDateTimeEdit::value() const
+{
+ return q->dateTime();
+}
+
+QRegExp dateFormatToRegExp(QString const& format)
+{
+ QString re;
+ QString fmt = format;
+
+#define REPLACE_TOK(A,B) \
+ if (fmt.startsWith(A)) { \
+ re += B; \
+ fmt.remove(0, qstrlen(A)); \
+ continue; \
+ }
+ while (!fmt.isEmpty()) {
+ REPLACE_TOK("yyyy", "(\\d{4})");
+ REPLACE_TOK("yy", "(\\d{2})");
+
+ REPLACE_TOK("MMMM", "(\\w+)");
+ REPLACE_TOK("MMM", "(\\w+)");
+ REPLACE_TOK("MM", "([01]\\d)");
+ REPLACE_TOK("M", "(\\d\\d?)");
+
+ REPLACE_TOK("dddd", "(\\w+)");
+ REPLACE_TOK("ddd", "(\\w+)");
+ REPLACE_TOK("dd", "([0123]\\d)");
+ REPLACE_TOK("d", "(\\d{1,2})");
+
+ REPLACE_TOK("hh", "([012]\\d)");
+ REPLACE_TOK("h", "(\\d{1,2})");
+
+ REPLACE_TOK("HH", "([012]\\d)");
+ REPLACE_TOK("H", "(\\d{1,2})");
+
+ REPLACE_TOK("mm", "([0-5]\\d)");
+ REPLACE_TOK("m", "(\\d{1,2})");
+
+ REPLACE_TOK("ss", "([0-5]\\d)");
+ REPLACE_TOK("s", "(\\d{1,2})");
+
+ REPLACE_TOK("zzz", "(\\d{3})");
+ REPLACE_TOK("z", "(\\d{0,3})");
+
+ REPLACE_TOK("AP", "(AM|PM)");
+ REPLACE_TOK("ap", "(am|pm)");
+ REPLACE_TOK("A", "(AM|PM)");
+ REPLACE_TOK("a", "(am|pm)");
+
+ re += QString("\\x%1").arg(fmt.at(0).unicode(), 4, 16, QChar('0'));
+ fmt.remove(0,1);
+ }
+#undef REPLACE_TOK
+
+ TestWidgetsLog() << format << "resulted in" << re;
+
+ return QRegExp(re);
+}
+
+bool TestDateTimeEdit::canEnter(QVariant const& item) const
+{
+ QString text;
+ if (item.canConvert<QDateTime>()) {
+ text = item.value<QDateTime>().toString( q->displayFormat() );
+ } else if (item.canConvert<QDate>()) {
+ text = item.value<QDate>().toString( q->displayFormat() );
+ } else if (item.canConvert<QTime>()) {
+ text = item.value<QTime>().toString( q->displayFormat() );
+ } else {
+ text = item.toString();
+ }
+ int dont_care = 0;
+ TestWidgetsLog() << text << "format:" << q->displayFormat();
+ bool ret = (QValidator::Acceptable ==
+ static_cast<QAbstractSpinBox*>(q)->validate(text, dont_care));
+ if (ret) {
+ TestWidgetsLog() << "Can enter" << item;
+ } else {
+ TestWidgetsLog() << "Can't enter" << item;
+ }
+ return ret;
+}
+
+QPoint TestDateTimeEdit::nextClick( QStringList const& cap,
+ QMap<QDateTimeEdit::Section,int> const& capMap,
+ bool *final, bool *ok)
+{
+ if (ok) *ok = false;
+ if (final) *final = false;
+
+ QPoint ret;
+
+ int activeSection = -1;
+ int moveUpDown = 0;
+ int sectionsNeedingChanges = 0;
+
+ /* Sections, from most to least significant.
+ * It is necessary to edit most significant first because that can affect
+ * the allowed values from less significant fields (e.g., can't select
+ * '30' in days if '02' is selected for month).
+ */
+ static const QDateTimeEdit::Section sections[] = {
+ QDateTimeEdit::YearSection,
+ QDateTimeEdit::MonthSection,
+ QDateTimeEdit::DaySection,
+ QDateTimeEdit::HourSection,
+ QDateTimeEdit::MinuteSection,
+ QDateTimeEdit::SecondSection,
+ QDateTimeEdit::MSecSection,
+ QDateTimeEdit::AmPmSection,
+ (QDateTimeEdit::Section)0
+ };
+
+ {
+ int i = 0;
+ for (QDateTimeEdit::Section section = sections[i];
+ section;
+ section = sections[++i]) {
+ if (!(q->displayedSections() & section)) continue;
+ QString text = q->sectionText(section);
+ int cap_i = capMap.value(section);
+ TestWidgetsLog() << "i" << i << "text" << text << "cap_i" << cap_i
+ << "cap" << cap.at(cap_i);
+ if (text != cap.at(cap_i)) {
+ ++sectionsNeedingChanges;
+ if (-1 == activeSection) {
+ bool is_int = false;
+ int src = text.toInt(&is_int);
+ if (!is_int) return ret;
+ int dest = cap.at(cap_i).toInt(&is_int);
+ if (!is_int) return ret;
+ moveUpDown = (dest - src);
+ activeSection = cap_i;
+ }
+ }
+ }
+ }
+
+ /* If there is only one section that requires a change,
+ * AND that section is off the desired value by one,
+ * AND that section already has focus,
+ * then this should be the last necessary click. */
+ if (final && (1 == sectionsNeedingChanges) && (1 == qAbs(moveUpDown)) && q->currentSectionIndex() == activeSection)
+ *final = true;
+
+ TestWidgetsLog() << "activeSection" << activeSection << "currentSectionIndex" << q->currentSectionIndex();
+
+ if (-1 == activeSection) {
+ /* No clicking required; already at target value */
+ if (final) *final = true;
+ } else if (q->currentSectionIndex() != activeSection) {
+ /* Clicking required; need to move cursor to correct section */
+ int begin = -1, end = -1;
+ {
+ QString text = q->text();
+ for (int i = 0; i < activeSection; ++i) {
+ QString sec = q->sectionText(q->sectionAt(i));
+ text.replace(text.indexOf(sec), sec.length(), QString(sec.length(), '_'));
+ }
+ QString sec = q->sectionText(q->sectionAt(activeSection));
+ begin = text.indexOf(sec);
+ end = begin + sec.length();
+ TestWidgetsLog() << "sec" << sec << "lies from" << begin << "to" << end << "in" << text;
+ }
+ QPoint pos(0, q->height()/2);
+ QLineEdit* le = q->findChild<QLineEdit*>();
+ QPoint clickPos;
+ while (le->rect().contains(pos) && clickPos.isNull()) {
+ int cursor = le->cursorPositionAt(pos);
+ if (cursor >= begin && cursor < end) {
+ clickPos = q->mapFromGlobal(le->mapToGlobal(pos));
+ }
+ pos.setX(pos.x() + 2);
+ }
+ ret = clickPos;
+ if (ret.isNull()) {
+ if (ok) *ok = false;
+ QtUiTest::setErrorString(QString("Could not determine where to click in "
+ "date edit to move cursor between position %1 and %2").arg(begin).arg(end));
+ return ret;
+ }
+ } else if (moveUpDown != 0) {
+ /* Clicking required; need to move up */
+ QStyle const* style = q->style();
+ QStyleOptionSpinBox opt;
+ opt.initFrom(q);
+ QRect rect = style->subControlRect(QStyle::CC_SpinBox, &opt,
+ (moveUpDown > 0) ? QStyle::SC_SpinBoxUp : QStyle::SC_SpinBoxDown,
+ q);
+ TestWidgetsLog() << "move " << ((moveUpDown > 0) ? "up" : "down") << rect;
+ ret = rect.center();
+ }
+
+ if (ok) *ok = true;
+ return ret;
+}
+
+bool TestDateTimeEdit::enterByMouse(QString const& format, QDateTime const& dt)
+{
+ bool final = false;
+ bool ok = true;
+
+ QRegExp re( dateFormatToRegExp(format) );
+ if (-1 == re.indexIn( dt.toString(format) )) {
+ TestWidgetsLog() << "regex didn't match, re:" << re << "date:" << dt.toString(format);
+ return false;
+ }
+
+ QStringList cap = re.capturedTexts();
+ cap.removeFirst();
+
+ TestWidgetsLog() << "cap" << cap << "text" << q->text();
+
+ /* Mapping from section to index in cap.
+ * Wouldn't be necessary if QDateTimeEdit had the inverse of sectionAt().
+ */
+ QMap<QDateTimeEdit::Section,int> capMap;
+ for (int i = 0; i < q->sectionCount(); ++i) {
+ capMap.insert( q->sectionAt(i), i );
+ }
+
+ do {
+ QPoint nc = nextClick(cap, capMap, &final, &ok);
+ if (ok) {
+ if (!ensureVisiblePoint(nc)) return false;
+ QtUiTest::mouseClick(q->mapToGlobal(nc));
+// On some platforms, this takes too long
+#ifndef Q_OS_MAC
+ QtUiTest::waitForSignal(q, SIGNAL(dateTimeChanged(QDateTime)));
+#endif
+ }
+ } while (!final && ok);
+
+ return ok;
+}
+
+bool TestDateTimeEdit::enterByKeys(QString const& format, QDateTime const& dt, bool noCommit)
+{
+ if (!hasEditFocus() && !setEditFocus(true)) return false;
+ TestWidgetsLog() << "got focus";
+
+ for (int i = 0, m = q->sectionCount(); i < m; ++i) {
+ if (!enterSectionByKeys(q->sectionAt(i), format, dt))
+ return false;
+ }
+
+ if (noCommit) return true;
+
+ return setEditFocus(false);
+}
+
+bool TestDateTimeEdit::enter(QVariant const& item, bool noCommit)
+{
+ QString text;
+ QDateTime dt;
+ QString format = q->displayFormat();
+ TestWidgetsLog() << "Format: " << format;
+ if (item.canConvert<QDateTime>()) {
+ dt = item.value<QDateTime>();
+ text = dt.toString( format );
+ TestWidgetsLog() << "QDateTime";
+ } else if (item.canConvert<QDate>()) {
+ dt = QDateTime(item.value<QDate>(), QTime());
+ text = dt.toString( format );
+ TestWidgetsLog() << "QDate";
+ } else if (item.canConvert<QTime>()) {
+ dt = QDateTime(QDate(1970,1,1), item.value<QTime>());
+ text = dt.toString( format );
+ TestWidgetsLog() << "QTime";
+ } else {
+ text = item.toString();
+ dt = QDateTime::fromString(text, format);
+ TestWidgetsLog() << "String";
+ }
+ int dont_care = 0;
+ if (QValidator::Acceptable !=
+ static_cast<QAbstractSpinBox*>(q)->validate(text, dont_care)) {
+ TestWidgetsLog() << "Can't enter" << item << "(text:" << text << ")";
+ return false;
+ }
+
+ if (text == q->text()) return true;
+
+ if (QtUiTest::mousePreferred()) {
+ return enterByMouse(format, dt);
+ } else {
+ return enterByKeys(format, dt, noCommit);
+ }
+
+ return false;
+}
+
+bool TestDateTimeEdit::enterSectionByKeys(QDateTimeEdit::Section section,
+ QString const& fmt, QDateTime const& dt)
+{
+ using namespace QtUiTest;
+
+ if (fmt.isEmpty() || !dt.isValid()) return false;
+
+#define TRY(str) if (fmt.contains(str)) { \
+ text = dt.toString(str); \
+}
+
+ QString text;
+ switch (section) {
+ case QDateTimeEdit::YearSection:
+ TRY("yyyy")
+ else TRY("yy");
+ break;
+ case QDateTimeEdit::MonthSection:
+ TRY("MMMM")
+ else TRY("MMM")
+ else TRY("MM")
+ else TRY("M");
+ break;
+ case QDateTimeEdit::DaySection:
+ TRY("dddd")
+ else TRY("ddd")
+ else TRY("dd")
+ else TRY("d");
+ break;
+ case QDateTimeEdit::HourSection:
+ TRY("hh")
+ else TRY("h")
+ else TRY("HH")
+ else TRY("H");
+ if (fmt.contains("AP") || fmt.contains("ap")) {
+ // Need to use 12 hour format
+ if (fmt.contains("hh")) {
+ text = dt.toString("hh ap");
+ text = text.left(text.indexOf(' '));
+ }
+ else if (fmt.contains("h")) {
+ text = dt.toString("h ap");
+ text = text.left(text.indexOf(' '));
+ }
+ }
+ break;
+ case QDateTimeEdit::MinuteSection:
+ TRY("mm")
+ else TRY("m");
+ break;
+ case QDateTimeEdit::SecondSection:
+ TRY("ss")
+ else TRY("s");
+ break;
+ case QDateTimeEdit::MSecSection:
+ TRY("zzz")
+ else TRY("z");
+ break;
+ case QDateTimeEdit::AmPmSection:
+ TRY("AP")
+ else TRY("ap");
+ break;
+ default:
+ return false;
+ }
+#undef TRY
+
+ if (text.isEmpty()) return false;
+
+ QMap<int,int> sectionMap;
+ for (int i = 0; i < q->sectionCount(); ++i) {
+ sectionMap.insert(q->sectionAt(i), i);
+ }
+
+ int i = 0;
+ while (q->currentSection() != section && ++i < 100) {
+ Qt::KeyboardModifiers mod = (q->currentSectionIndex() < sectionMap[section]) ? Qt::KeyboardModifiers(0) : Qt::ShiftModifier;
+ TestWidgetsLog() << "Entering extra key click (before " + text + ") to move to prev/next section";
+ if (!keyClick(q, Qt::Key_Tab)) {
+ setErrorString("Key click did not go to the expected widget.");
+ return false;
+ }
+ }
+ if (q->currentSection() != section) {
+ setErrorString("Could not move focus to desired section.");
+ return false;
+ }
+
+ TestWidgetsLog() << "Going to enter" << text << "in section" << section;
+
+ foreach (QChar const& c, text) {
+ if (!keyClick(q, asciiToKey(c.toLatin1()))) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool TestDateTimeEdit::canWrap(QObject *o)
+{ return qobject_cast<QDateTimeEdit*>(o); }
+
+}
diff --git a/plugins/qtuitest_widgets/qtwidgets/testdatetimeedit.h b/plugins/qtuitest_widgets/qtwidgets/testdatetimeedit.h
new file mode 100644
index 0000000..204446d
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testdatetimeedit.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTDATETIMEEDIT_H
+#define TESTDATETIMEEDIT_H
+
+#include "testgenerictextwidget.h"
+#include <QDateTimeEdit>
+
+namespace QtUiTest {
+
+class TestDateTimeEdit : public TestGenericTextWidget
+{
+ Q_OBJECT
+public:
+ TestDateTimeEdit(QObject*);
+
+ virtual QString text() const;
+ virtual QVariant value() const;
+
+ virtual bool canEnter(QVariant const&) const;
+ virtual bool enter(QVariant const&,bool);
+
+ static bool canWrap(QObject*);
+
+protected:
+ bool enterByKeys(QString const&,QDateTime const&,bool);
+ bool enterByMouse(QString const&,QDateTime const&);
+ bool enterSectionByKeys(QDateTimeEdit::Section,QString const&,
+ QDateTime const&);
+ QPoint nextClick(QStringList const&,
+ QMap<QDateTimeEdit::Section,int> const&,bool*,bool*);
+
+private slots:
+ void onDateTimeChanged(QDateTime const&);
+
+signals:
+ void entered(QVariant const&);
+
+private:
+ QDateTimeEdit *q;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testdockwidget.cpp b/plugins/qtuitest_widgets/qtwidgets/testdockwidget.cpp
new file mode 100644
index 0000000..9b24e13
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testdockwidget.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testdockwidget.h"
+#include "testwidgetslog.h"
+
+#include <QDockWidget>
+
+namespace QtUiTest {
+
+TestDockWidget::TestDockWidget(QObject* _q)
+ : TestGenericTextWidget(_q), q(qobject_cast<QDockWidget*>(_q))
+{ TestWidgetsLog(); }
+
+QString TestDockWidget::text() const
+{
+ TestWidgetsLog();
+ return windowTitle();
+}
+
+QString TestDockWidget::labelText() const
+{
+ QString ret = text();
+ if (ret.isEmpty())
+ return ret;
+
+ QObject *w = parent();
+ while (w) {
+ QtUiTest::Widget *qw = qtuitest_cast<QtUiTest::Widget*>(w);
+ QtUiTest::LabelWidget *lw = qtuitest_cast<QtUiTest::LabelWidget*>(w);
+ if (lw) {
+ if (!lw->labelText().isEmpty()) {
+ ret.prepend(lw->labelText() + "/");
+ break;
+ }
+ }
+ w = qw->parent();
+ }
+ return ret;
+}
+
+QObject* TestDockWidget::buddy() const
+{
+ return q->widget();
+}
+
+bool TestDockWidget::canWrap(QObject *o)
+{ return qobject_cast<QDockWidget*>(o); }
+
+QString TestDockWidget::convertToPlainText(QString const &richText)
+{
+ static QRegExp rxBr("<br */?>");
+ static QRegExp rxHtml("<[^>]+>");
+
+ QString ret(richText);
+ ret.replace(rxBr, "\n");
+ ret.replace(rxHtml, QString());
+ return ret;
+}
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testdockwidget.h b/plugins/qtuitest_widgets/qtwidgets/testdockwidget.h
new file mode 100644
index 0000000..d77840c
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testdockwidget.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTDOCKWIDGET_H
+#define TESTDOCKWIDGET_H
+
+#include "testgenerictextwidget.h"
+
+class QDockWidget;
+
+namespace QtUiTest {
+
+class TestDockWidget : public TestGenericTextWidget,
+ public QtUiTest::LabelWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(QtUiTest::LabelWidget)
+
+public:
+ TestDockWidget(QObject*);
+
+ virtual QString text() const;
+
+ virtual QString labelText() const;
+ virtual QObject* buddy() const;
+
+ static bool canWrap(QObject*);
+
+private:
+ static QString convertToPlainText(QString const&);
+
+ QDockWidget *q;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testfactory.cpp b/plugins/qtuitest_widgets/qtwidgets/testfactory.cpp
new file mode 100644
index 0000000..3a4182c
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testfactory.cpp
@@ -0,0 +1,183 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testfactory.h"
+
+#include "testabstractbutton.h"
+#include "testabstractitemview.h"
+#include "testabstractspinbox.h"
+#include "testcalendarwidget.h"
+#include "testcheckbox.h"
+#include "testcombobox.h"
+#include "testdateedit.h"
+#include "testdatetimeedit.h"
+#include "testdockwidget.h"
+#include "testgenericcheckwidget.h"
+#include "testgenerictextwidget.h"
+#include "testgroupbox.h"
+#include "testheaderview.h"
+#include "testignore.h"
+#include "testlabel.h"
+#include "testlineedit.h"
+#include "testlistview.h"
+#include "testmenu.h"
+#include "testmenubar.h"
+#include "testpushbutton.h"
+#include "testtabbar.h"
+#include "testtextedit.h"
+#include "testtimeedit.h"
+#include "testtoolbar.h"
+#include "testtreeview.h"
+#include "testtreewidget.h"
+#include "testgenericinputmethod.h"
+
+#if !defined(QT_NO_WEBKIT)
+# include "testwebview.h"
+#endif
+
+#include <testwidget.h>
+#include "testwidgetslog.h"
+#include <QApplication>
+
+namespace QtUiTest {
+
+TestWidgetsFactory::TestWidgetsFactory()
+{
+}
+
+QObject* TestWidgetsFactory::create(QObject* o)
+{
+ QObject* ret = 0;
+
+#define TRY(Klass) \
+ if (Klass::canWrap(o)) { \
+ ret = new Klass(o); \
+ break; \
+ }
+
+ /* Order is important here; classes should be listed in order of
+ * most to least derived. */
+
+ do {
+ /* Qt widgets */
+ TRY(TestDateEdit);
+ TRY(TestTimeEdit);
+ TRY(TestDateTimeEdit);
+ TRY(TestCalendarWidget);
+ TRY(TestDateTimeEdit);
+ TRY(TestHeaderView);
+ TRY(TestTreeWidget);
+ TRY(TestTreeView);
+ TRY(TestListView);
+ TRY(TestAbstractItemView);
+ TRY(TestTabBar);
+ TRY(TestMenuBar);
+ TRY(TestToolBar);
+ TRY(TestMenu);
+ TRY(TestDockWidget);
+#if !defined(QT_NO_WEBKIT)
+ TRY(TestWebView);
+#endif
+ TRY(TestLabel);
+ TRY(TestAbstractSpinBox);
+ TRY(TestGroupBox);
+ TRY(TestCheckBox);
+ TRY(TestComboBox);
+ TRY(TestLineEdit);
+ TRY(TestTextEdit);
+ TRY(TestPushButton);
+ TRY(TestAbstractButton);
+ TRY(TestGenericCheckWidget);
+ TRY(TestGenericTextWidget);
+ TRY(TestIgnore);
+ TRY(TestWidget);
+ TRY(TestGenericInputMethod);
+ } while(0);
+
+ TestWidgetsLog() << o << ret;
+
+ return ret;
+}
+
+QStringList TestWidgetsFactory::keys() const
+{
+ /* Order doesn't matter here. */
+ return QStringList()
+ << "QAbstractButton"
+ << "QAbstractItemView"
+ << "QAbstractSlider"
+ << "QAbstractSpinBox"
+ << "QCalendarWidget"
+ << "QCheckBox"
+ << "QComboBox"
+ << "QDateEdit"
+ << "QDateTimeEdit"
+ << "QDockWidget"
+ << "QFrame"
+ << "QGroupBox"
+ << "QHeaderView"
+ << "QLCDNumber"
+ << "QLabel"
+ << "QLineEdit"
+ << "QListView"
+ << "QMenu"
+ << "QMenuBar"
+ << "QMessageBox"
+ << "QProgressBar"
+ << "QPushButton"
+ << "QStackedWidget"
+ << "QTabBar"
+ << "QTextEdit"
+ << "QTimeEdit"
+ << "QToolBar"
+ << "QTreeView"
+ << "QTreeWidget"
+#if !defined(QT_NO_WEBKIT)
+ << "QWebView"
+#endif
+ << "QWidget"
+ << "QInputContext"
+ ;
+}
+
+}
+#include <qplugin.h>
+Q_EXPORT_PLUGIN2(qttestwidgets, QtUiTest::TestWidgetsFactory)
diff --git a/plugins/qtuitest_widgets/qtwidgets/testfactory.h b/plugins/qtuitest_widgets/qtwidgets/testfactory.h
new file mode 100644
index 0000000..af62e70
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testfactory.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTFACTORY_H
+#define TESTFACTORY_H
+
+#include <QObject>
+
+#include <qtuitestwidgetinterface.h>
+
+namespace QtUiTest {
+
+class TestWidgetsFactory : public QObject, public QtUiTest::WidgetFactory
+{
+ Q_OBJECT
+ Q_INTERFACES(QtUiTest::WidgetFactory)
+
+public:
+ TestWidgetsFactory();
+
+ virtual QObject* create(QObject*);
+ virtual QStringList keys() const;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testgenericcheckwidget.cpp b/plugins/qtuitest_widgets/qtwidgets/testgenericcheckwidget.cpp
new file mode 100644
index 0000000..b35d939
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testgenericcheckwidget.cpp
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testgenericcheckwidget.h"
+#include "testwidgetslog.h"
+
+#include <QWidget>
+#include <QVariant>
+
+namespace QtUiTest {
+
+QList<QByteArray> TestGenericCheckWidget::checkProperties = QList<QByteArray>()
+ << "checked"
+;
+
+TestGenericCheckWidget::TestGenericCheckWidget(QObject* _q)
+ : TestWidget(_q), q(qobject_cast<QWidget*>(_q))
+{
+ TestWidgetsLog();
+ foreach (QByteArray property, checkProperties) {
+ if (-1 != q->metaObject()->indexOfProperty(property)) {
+ checkProperty = property;
+ break;
+ }
+ }
+}
+
+Qt::CheckState TestGenericCheckWidget::checkState() const
+{
+ TestWidgetsLog();
+ return q->property(checkProperty).toBool()
+ ? Qt::Checked
+ : Qt::Unchecked;
+}
+
+bool TestGenericCheckWidget::canWrap(QObject *o)
+{
+ QWidget *w;
+ if (!(w = qobject_cast<QWidget*>(o)))
+ return false;
+
+ foreach (QByteArray property, checkProperties)
+ if (-1 != o->metaObject()->indexOfProperty(property))
+ return true;
+
+ return false;
+}
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testgenericcheckwidget.h b/plugins/qtuitest_widgets/qtwidgets/testgenericcheckwidget.h
new file mode 100644
index 0000000..759b1d3
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testgenericcheckwidget.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTGENERICCHECKWIDGET_H
+#define TESTGENERICCHECKWIDGET_H
+
+#include <testwidget.h>
+
+namespace QtUiTest {
+
+class TestGenericCheckWidget : public TestWidget, public QtUiTest::CheckWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(QtUiTest::CheckWidget)
+public:
+ TestGenericCheckWidget(QObject*);
+
+ virtual Qt::CheckState checkState() const;
+
+ static bool canWrap(QObject*);
+
+private:
+ QWidget *q;
+ QByteArray checkProperty;
+ static QList<QByteArray> checkProperties;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testgenericinputmethod.cpp b/plugins/qtuitest_widgets/qtwidgets/testgenericinputmethod.cpp
new file mode 100644
index 0000000..8b01697
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testgenericinputmethod.cpp
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testgenericinputmethod.h"
+
+#include <qtuitestnamespace.h>
+#include <QInputContext>
+#include <QInputMethodEvent>
+#include <QDebug>
+
+namespace QtUiTest {
+
+TestGenericInputMethod::TestGenericInputMethod(QObject *_q)
+ : q(qobject_cast<QInputContext*>(_q))
+{
+}
+
+bool TestGenericInputMethod::canEnter(QVariant const& item) const
+{
+ return true;
+}
+
+bool TestGenericInputMethod::enter(QVariant const& item, bool noCommit)
+{
+ QInputMethodEvent event;
+ event.setCommitString(item.toString());
+ q->sendEvent(event);
+ return true;
+}
+
+bool TestGenericInputMethod::canWrap(QObject *o)
+{
+ return qobject_cast<QInputContext*>(o);
+}
+
+}
diff --git a/plugins/qtuitest_widgets/qtwidgets/testgenericinputmethod.h b/plugins/qtuitest_widgets/qtwidgets/testgenericinputmethod.h
new file mode 100644
index 0000000..c8f6dca
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testgenericinputmethod.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTGENERICINPUTMETHOD_H
+#define TESTGENERICINPUTMETHOD_H
+
+#include "testwidget.h"
+
+class QInputContext;
+
+namespace QtUiTest {
+
+class TestGenericInputMethod : public QObject,
+ QtUiTest::InputWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::InputWidget)
+
+public:
+ TestGenericInputMethod(QObject*);
+
+ virtual bool canEnter(QVariant const&) const;
+ virtual bool enter(QVariant const&,bool);
+
+ static bool canWrap(QObject*);
+
+private:
+ QInputContext *q;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testgenerictextwidget.cpp b/plugins/qtuitest_widgets/qtwidgets/testgenerictextwidget.cpp
new file mode 100644
index 0000000..a8719cc
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testgenerictextwidget.cpp
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testgenerictextwidget.h"
+#include "testwidgetslog.h"
+
+#include <QWidget>
+#include <QVariant>
+
+namespace QtUiTest {
+
+QList<QByteArray> TestGenericTextWidget::textProperties = QList<QByteArray>()
+ << "text"
+ << "plainText"
+ << "value"
+ << "title"
+;
+QList<QByteArray> TestGenericTextWidget::selectedTextProperties = QList<QByteArray>()
+ << "selectedText"
+;
+
+TestGenericTextWidget::TestGenericTextWidget(QObject* _q)
+ : TestWidget(_q), q(qobject_cast<QWidget*>(_q))
+{
+ TestWidgetsLog() << _q;
+ foreach (QByteArray property, textProperties) {
+ if (-1 != q->metaObject()->indexOfProperty(property)) {
+ textProperty = property;
+ break;
+ }
+ }
+ foreach (QByteArray property, selectedTextProperties) {
+ if (-1 != q->metaObject()->indexOfProperty(property)) {
+ selectedTextProperty = property;
+ break;
+ }
+ }
+}
+
+QString TestGenericTextWidget::text() const
+{ TestWidgetsLog(); return q->property(textProperty).toString(); }
+
+QString TestGenericTextWidget::selectedText() const
+{
+ TestWidgetsLog();
+ QString ret;
+ if (!selectedTextProperty.isEmpty())
+ ret = q->property(selectedTextProperty).toString();
+ if (ret.isEmpty())
+ ret = text();
+ return ret;
+}
+
+bool TestGenericTextWidget::canWrap(QObject *o)
+{
+ QWidget *w;
+ if (!(w = qobject_cast<QWidget*>(o)))
+ return false;
+
+ foreach (QByteArray property, textProperties)
+ if (-1 != o->metaObject()->indexOfProperty(property))
+ return true;
+
+ return false;
+}
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testgenerictextwidget.h b/plugins/qtuitest_widgets/qtwidgets/testgenerictextwidget.h
new file mode 100644
index 0000000..baad629
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testgenerictextwidget.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTGENERICTEXTWIDGET_H
+#define TESTGENERICTEXTWIDGET_H
+
+#include <testwidget.h>
+
+namespace QtUiTest {
+
+class TestGenericTextWidget : public TestWidget, public QtUiTest::TextWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(QtUiTest::TextWidget)
+public:
+ TestGenericTextWidget(QObject*);
+
+ virtual QString text() const;
+ virtual QString selectedText() const;
+
+ static bool canWrap(QObject*);
+
+private:
+ QWidget *q;
+ QByteArray textProperty;
+ QByteArray selectedTextProperty;
+ static QList<QByteArray> textProperties;
+ static QList<QByteArray> selectedTextProperties;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testgroupbox.cpp b/plugins/qtuitest_widgets/qtwidgets/testgroupbox.cpp
new file mode 100644
index 0000000..d33a9e7
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testgroupbox.cpp
@@ -0,0 +1,132 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testgroupbox.h"
+#include "testwidgetslog.h"
+
+#include <QGroupBox>
+#include <QStyleOptionGroupBox>
+
+namespace QtUiTest {
+
+TestGroupBox::TestGroupBox(QObject *_q)
+ : TestGenericTextWidget(_q), q(qobject_cast<QGroupBox*>(_q))
+{
+ connect(q, SIGNAL(toggled(bool)), this, SLOT(on_toggled(bool)));
+}
+
+void TestGroupBox::on_toggled(bool state)
+{ emit stateChanged(state); }
+
+Qt::CheckState TestGroupBox::checkState() const
+{ return q->isChecked() ? Qt::Checked : Qt::Unchecked; }
+
+bool TestGroupBox::setCheckState(Qt::CheckState state)
+{
+ TestWidgetsLog() << state << checkState() << q->isCheckable();
+ if (state == checkState()) return true;
+ if (!q->isCheckable()) return false;
+
+ if (QtUiTest::mousePreferred()) {
+ QStyle const* style = q->style();
+ QStyleOptionGroupBox opt;
+ opt.initFrom(q);
+ QRect rect = style->subControlRect(QStyle::CC_GroupBox, &opt, QStyle::SC_GroupBoxCheckBox, q);
+ QPoint p = rect.center();
+ if (!ensureVisiblePoint(p)) return false;
+ if (!QtUiTest::mouseClick(q, SIGNAL(toggled(bool)), mapToGlobal( p ) )) return false;
+ } else {
+ if (!setFocus()) {
+ QtUiTest::setErrorString("Couldn't toggle group box check state: couldn't give "
+ "focus to group box.");
+ return false;
+ }
+ if (!QtUiTest::keyClick(q, SIGNAL(toggled(bool)), QtUiTest::Key_ActivateButton )) return false;
+ }
+
+ return state == checkState();
+}
+
+QString TestGroupBox::labelText() const
+{
+ QString ret = text();
+ if (ret.isEmpty())
+ return ret;
+
+ QObject *w = parent();
+ while (w) {
+ QtUiTest::Widget *qw = qtuitest_cast<QtUiTest::Widget*>(w);
+ QtUiTest::LabelWidget *lw = qtuitest_cast<QtUiTest::LabelWidget*>(w);
+ if (lw) {
+ if (!lw->labelText().isEmpty()) {
+ ret.prepend(lw->labelText() + "/");
+ break;
+ }
+ }
+ w = qw->parent();
+ }
+ return ret;
+}
+
+QObject* TestGroupBox::buddy() const
+{
+ QObject *buddy = q;
+
+ if (!q->isCheckable()) {
+ // If the widget is a QGroupBox, and it has exactly one focusable child widget,
+ // consider that child widget the buddy
+ QList<QWidget*> focusableWidgets;
+ foreach (QWidget* fw, q->findChildren<QWidget*>()) {
+ if (fw->focusPolicy() != Qt::NoFocus)
+ focusableWidgets << fw;
+ }
+ if (focusableWidgets.count() == 1) {
+ buddy = focusableWidgets[0];
+ }
+ }
+
+ return buddy;
+}
+
+bool TestGroupBox::canWrap(QObject *o)
+{ return qobject_cast<QGroupBox*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testgroupbox.h b/plugins/qtuitest_widgets/qtwidgets/testgroupbox.h
new file mode 100644
index 0000000..08fa82e
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testgroupbox.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTGROUPBOX_H
+#define TESTGROUPBOX_H
+
+#include "testgenerictextwidget.h"
+
+class QGroupBox;
+
+namespace QtUiTest {
+
+class TestGroupBox : public TestGenericTextWidget,
+ public QtUiTest::CheckWidget,
+ public QtUiTest::LabelWidget
+
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::CheckWidget
+ QtUiTest::LabelWidget)
+
+public:
+ TestGroupBox(QObject*);
+
+ virtual Qt::CheckState checkState() const;
+ virtual bool setCheckState(Qt::CheckState);
+
+ virtual QString labelText() const;
+ virtual QObject* buddy() const;
+
+ static bool canWrap(QObject*);
+
+signals:
+ void stateChanged(int);
+
+private slots:
+ void on_toggled(bool);
+
+private:
+ QGroupBox *q;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testheaderview.cpp b/plugins/qtuitest_widgets/qtwidgets/testheaderview.cpp
new file mode 100644
index 0000000..c8f2b8f
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testheaderview.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testheaderview.h"
+#include "testwidgetslog.h"
+
+#include <QListView>
+#include <QTimer>
+#include <QScrollBar>
+#include <QComboBox>
+
+#include <qtuitestnamespace.h>
+
+namespace QtUiTest {
+
+TestHeaderView::TestHeaderView(QObject *_q)
+ : TestWidget(_q), q(static_cast<QHeaderView*>(_q))
+{
+}
+
+QStringList TestHeaderView::list() const
+{
+ QStringList ret;
+
+ for (int i=0; i<q->count(); ++i) {
+ ret << (q->model()->headerData(i, q->orientation())).toString();
+ }
+
+ return ret;
+}
+
+QRect TestHeaderView::visualRect(QString const &item) const
+{
+ int index = list().indexOf(item);
+ QPoint zero;
+ int sectionSize = q->sectionSize(index);
+ int sectionPos = q->sectionPosition(index);
+ return q->orientation() == Qt::Horizontal
+ ? QRect(zero.x() + sectionPos, zero.y(), sectionSize, q->height())
+ : QRect(zero.x(), zero.y() + sectionPos, q->width(), sectionSize);
+}
+
+bool TestHeaderView::canWrap(QObject* o)
+{ return qobject_cast<QHeaderView*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testheaderview.h b/plugins/qtuitest_widgets/qtwidgets/testheaderview.h
new file mode 100644
index 0000000..5970dd1
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testheaderview.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTHEADERVIEW_H
+#define TESTHEADERVIEW_H
+
+#include <testwidget.h>
+
+#include <QHeaderView>
+
+namespace QtUiTest {
+
+class TestHeaderView : public TestWidget,
+ public QtUiTest::ListWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(QtUiTest::ListWidget)
+
+public:
+ TestHeaderView(QObject*);
+
+ virtual QStringList list() const;
+ virtual QRect visualRect(QString const&) const;
+
+ static bool canWrap(QObject*);
+
+signals:
+ void selected(const QString&);
+
+private:
+ QHeaderView *q;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testignore.cpp b/plugins/qtuitest_widgets/qtwidgets/testignore.cpp
new file mode 100644
index 0000000..cd63018
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testignore.cpp
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testignore.h"
+#include "testwidgetslog.h"
+
+namespace QtUiTest {
+
+TestIgnore::TestIgnore(QObject* _q)
+ : TestWidget(_q), q(_q)
+{ TestWidgetsLog(); }
+
+bool TestIgnore::canWrap(QObject *o)
+{
+ QString cn = o->metaObject()->className();
+ return (cn == "QStackedWidget" ||
+ cn == "QFrame" ||
+ cn == "QWidget");
+}
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testignore.h b/plugins/qtuitest_widgets/qtwidgets/testignore.h
new file mode 100644
index 0000000..db0ae98
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testignore.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTIGNORE_H
+#define TESTIGNORE_H
+
+#include <testwidget.h>
+
+namespace QtUiTest {
+
+class TestIgnore : public TestWidget
+{
+ Q_OBJECT
+public:
+ TestIgnore(QObject*);
+ virtual bool ignoreScan() const { return true; }
+
+ static bool canWrap(QObject*);
+
+private:
+ QObject *q;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testlabel.cpp b/plugins/qtuitest_widgets/qtwidgets/testlabel.cpp
new file mode 100644
index 0000000..b5ce0cc
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testlabel.cpp
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testlabel.h"
+#include "testwidgetslog.h"
+
+#include <QLabel>
+#include <QGroupBox>
+
+namespace QtUiTest {
+
+TestLabel::TestLabel(QObject* _q)
+ : TestGenericTextWidget(_q), q(qobject_cast<QLabel*>(_q))
+{ TestWidgetsLog(); }
+
+QString TestLabel::text() const
+{
+ TestWidgetsLog();
+ QString text = TestGenericTextWidget::text();
+ if (q->textFormat() != Qt::PlainText)
+ text = convertToPlainText(text);
+
+ return text;
+}
+
+QString TestLabel::labelText() const
+{
+ QString ret = text();
+ if (ret.isEmpty())
+ return ret;
+
+ QObject *w = parent();
+ while (w) {
+ QtUiTest::Widget *qw = qtuitest_cast<QtUiTest::Widget*>(w);
+ QtUiTest::LabelWidget *lw = qtuitest_cast<QtUiTest::LabelWidget*>(w);
+ if (lw) {
+ if (!lw->labelText().isEmpty()) {
+ ret.prepend(lw->labelText() + "/");
+ break;
+ }
+ }
+ w = qw->parent();
+ }
+ return ret;
+}
+
+QObject* TestLabel::buddy() const
+{
+ return q->buddy();
+}
+
+bool TestLabel::canWrap(QObject *o)
+{ return qobject_cast<QLabel*>(o); }
+
+QString TestLabel::convertToPlainText(QString const &richText)
+{
+ static QRegExp rxBr("<br */?>");
+ static QRegExp rxHtml("<[^>]+>");
+
+ QString ret(richText);
+ ret.replace(rxBr, "\n");
+ ret.replace(rxHtml, QString());
+ return ret;
+}
+
+// Returns a groupbox prefix for widgets that are owned by a groupbox
+QString TestLabel::groupBoxName() const
+{
+ QWidget *parent = q;
+ QGroupBox *gb;
+ QString ret;
+ do {
+ parent = qobject_cast<QWidget*>(parent->parent());
+ gb = qobject_cast<QGroupBox*>(parent);
+ if (gb && !gb->title().isEmpty())
+ ret += gb->title() + "/";
+ } while (parent);
+
+ ret.chop(1);
+ return ret;
+}
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testlabel.h b/plugins/qtuitest_widgets/qtwidgets/testlabel.h
new file mode 100644
index 0000000..dbca3b4
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testlabel.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTLABEL_H
+#define TESTLABEL_H
+
+#include "testgenerictextwidget.h"
+
+class QLabel;
+
+namespace QtUiTest {
+
+class TestLabel : public TestGenericTextWidget,
+ public QtUiTest::LabelWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(QtUiTest::LabelWidget)
+
+public:
+ TestLabel(QObject*);
+
+ virtual bool ignoreScan() const { return true; }
+
+ virtual QString text() const;
+
+ virtual QString labelText() const;
+ virtual QObject* buddy() const;
+
+ static bool canWrap(QObject*);
+
+private:
+ static QString convertToPlainText(QString const&);
+ QString groupBoxName() const;
+
+ QLabel *q;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testlineedit.cpp b/plugins/qtuitest_widgets/qtwidgets/testlineedit.cpp
new file mode 100644
index 0000000..4f24e5c
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testlineedit.cpp
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testlineedit.h"
+#include "testtext.h"
+#include "testwidgetslog.h"
+
+#include <QDesktopWidget>
+#include <QLayout>
+#include <QLineEdit>
+#include <QPointer>
+#include <QValidator>
+#include <QVariant>
+#include <QDateTimeEdit>
+
+namespace QtUiTest {
+
+TestLineEdit::TestLineEdit(QObject *_q)
+ : TestGenericTextWidget(_q), q(qobject_cast<QLineEdit*>(_q))
+{
+ if (q && qobject_cast<QDateTimeEdit*>(q->parent())) {
+ // The test object of the parent will handle recording
+ return;
+ }
+
+ connect(q, SIGNAL(textEdited(QString)), this, SLOT(onTextEdited(QString)));
+}
+
+void TestLineEdit::onTextEdited(QString const& item)
+{ emit entered(item); }
+
+bool TestLineEdit::canEnter(QVariant const& item) const
+{
+ if (!item.canConvert<QString>()) return false;
+ if (!q->validator()) return true;
+
+ int dontcare = 0;
+ QString text = item.toString();
+ return (QValidator::Acceptable==q->validator()->validate(text, dontcare));
+}
+
+bool TestLineEdit::enter(QVariant const& item, bool noCommit)
+{
+ if (!canEnter(item)) return false;
+
+ bool hadEditFocus = false;
+
+ if (!hadEditFocus && !setEditFocus(true)) return false;
+
+ using namespace QtUiTest;
+
+ QPointer<QObject> safeThis = this;
+
+ if (!safeThis) {
+ setErrorString("Widget was destroyed while entering text.");
+ return false;
+ }
+
+ QString oldText = text();
+ QString selectedText = q->selectedText();
+ QString itemString = item.toString();
+
+ QString expectedText = oldText;
+ if (selectedText == "") {
+ expectedText.insert(q->cursorPosition(), itemString);
+ // If there's text currently in the field, and we don't already have
+ // edit focus, then erase it first.
+ if (!oldText.isEmpty() && !hadEditFocus) {
+ if (!TestText::eraseTextByKeys(q)) return false;
+ expectedText = itemString;
+ }
+ } else {
+ expectedText.replace(selectedText, itemString);
+ }
+
+ InputWidget *iw = qtuitest_cast<InputWidget*>(inputProxy());
+
+ if (!safeThis) {
+ setErrorString("Widget was destroyed while entering text.");
+ return false;
+ }
+
+ TestWidgetsLog() << iw;
+
+ if (iw) {
+ if (!TestText::enterTextByProxy(iw, q, itemString, expectedText, !noCommit)) return false;
+ } else {
+ if (!TestText::enterText(q, itemString, expectedText, !noCommit)) return false;
+ }
+
+ if (!safeThis) {
+ setErrorString("Widget was destroyed while entering text.");
+ return false;
+ }
+
+ if (!noCommit && hasEditFocus()) {
+ if (!setEditFocus(false)) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+bool TestLineEdit::canWrap(QObject *o)
+{ return qobject_cast<QLineEdit*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testlineedit.h b/plugins/qtuitest_widgets/qtwidgets/testlineedit.h
new file mode 100644
index 0000000..ec94ae7
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testlineedit.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTLINEEDIT_H
+#define TESTLINEEDIT_H
+
+#include "testgenerictextwidget.h"
+
+class QLineEdit;
+
+namespace QtUiTest {
+
+class TestLineEdit : public TestGenericTextWidget
+{
+ Q_OBJECT
+
+
+public:
+ TestLineEdit(QObject*);
+
+ virtual bool canEnter(QVariant const&) const;
+ virtual bool enter(QVariant const&,bool);
+
+ static bool canWrap(QObject*);
+
+private slots:
+ void onTextEdited(QString const&);
+
+signals:
+ void entered(QVariant const&);
+
+private:
+ QLineEdit *q;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testlistview.cpp b/plugins/qtuitest_widgets/qtwidgets/testlistview.cpp
new file mode 100644
index 0000000..96507e2
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testlistview.cpp
@@ -0,0 +1,96 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testlistview.h"
+#include "testwidgetslog.h"
+
+#include <QListView>
+
+#include <qtuitestnamespace.h>
+
+namespace QtUiTest {
+
+TestListView::TestListView(QObject *_q)
+ : TestAbstractItemView(_q), q(qobject_cast<QListView*>(_q))
+{}
+
+QStringList TestListView::list() const
+{
+ QStringList list;
+
+ QAbstractItemModel *model = q->model();
+ QModelIndex index = q->rootIndex();
+ int count = 0;
+
+ for (int i = 0, max_i = model->rowCount(index); i < max_i && count <= QTUITEST_MAX_LIST; ++i) {
+ if (model->hasIndex(i, q->modelColumn(), index)) {
+ list << model->data(model->index(i, q->modelColumn(), index)).toString();
+ }
+ }
+
+ return list;
+}
+
+QModelIndex TestListView::indexForItem(QString const &item) const
+{
+ QModelIndex ret;
+
+ QStringList list;
+
+ QAbstractItemModel *model = q->model();
+ QModelIndex index = q->rootIndex();
+ int count = 0;
+
+ for (int i = 0, max_i = model->rowCount(index); i < max_i && count <= QTUITEST_MAX_LIST; ++i) {
+ int j = q->modelColumn();
+ QModelIndex child;
+ if (model->hasIndex(i, j, index) && model->data(model->index(i, j, index)).toString() == item) {
+ ret = model->index(i, j, index);
+ }
+ }
+
+ return ret;
+}
+
+bool TestListView::canWrap(QObject* o)
+{ return qobject_cast<QListView*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testlistview.h b/plugins/qtuitest_widgets/qtwidgets/testlistview.h
new file mode 100644
index 0000000..3a3dea9
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testlistview.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTLISTVIEW_H
+#define TESTLISTVIEW_H
+
+#include "testabstractitemview.h"
+
+#include <QListView>
+
+namespace QtUiTest {
+
+class TestListView : public TestAbstractItemView
+{
+ Q_OBJECT
+
+public:
+ TestListView(QObject*);
+ virtual QStringList list() const;
+ static bool canWrap(QObject*);
+
+protected:
+ virtual QModelIndex indexForItem(QString const&) const;
+
+private:
+ QListView *q;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testmenu.cpp b/plugins/qtuitest_widgets/qtwidgets/testmenu.cpp
new file mode 100644
index 0000000..66e1e58
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testmenu.cpp
@@ -0,0 +1,398 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testmenu.h"
+#include "testwidgetslog.h"
+
+#include <QMenu>
+#include <QAction>
+
+namespace QtUiTest {
+
+TestMenu::TestMenu(QObject *_q)
+ : TestWidget(_q), q(qobject_cast<QMenu*>(_q)), lastAction(0)
+{
+ // For accurate ordering of events recording, these connections
+ // must come before all others.
+ QtUiTest::connectFirst(q, SIGNAL(hovered(QAction*)),
+ this, SLOT(on_hovered(QAction*)));
+}
+
+void TestMenu::on_hovered(QAction* a)
+{
+ if (lastAction)
+ QtUiTest::disconnectFirst(lastAction, 0, this, 0);
+ lastAction = a;
+ if (lastAction) {
+ QtUiTest::connectFirst(lastAction, SIGNAL(toggled(bool)),
+ this, SLOT(on_toggled(bool)));
+ QtUiTest::connectFirst(lastAction, SIGNAL(triggered(bool)),
+ this, SLOT(on_triggered(bool)));
+ }
+}
+
+void TestMenu::on_toggled(bool state)
+{ emit stateChanged(state); }
+
+QString textForAction(QMenu* m, QAction* a)
+{
+ QString ret;
+ foreach (QAction* child, m->actions()) {
+ if (child == a) {
+ ret = a->text();
+ ret.replace("/","\\/");
+ } else if (child->menu()) {
+ ret = textForAction(child->menu(), a);
+ if (!ret.isEmpty())
+ ret.prepend(child->menu()->title().replace("/","\\/") + "/");
+ }
+ if (!ret.isEmpty())
+ break;
+ }
+ return ret;
+}
+
+void TestMenu::on_triggered(bool)
+{
+ /*
+ Both the top level and submenus emit the triggered() signal.
+ We only want to emit selected() if we are the top level menu.
+ */
+ bool top_level = true;
+ if (q->menuAction()) {
+ foreach (QWidget* w, q->menuAction()->associatedWidgets()) {
+ if (qobject_cast<QMenu*>(w)) {
+ top_level = false;
+ break;
+ }
+ }
+ }
+
+ if (!top_level) return;
+
+ emit selected(textForAction(q,lastAction));
+}
+
+QString TestMenu::text() const
+{
+ return list().join("\n");
+}
+
+QString TestMenu::selectedText() const
+{
+ QString ret;
+
+ QAction *active = q->activeAction();
+ if (!active) return ret;
+
+ QMenu *child = active->menu();
+ if (!child || !child->activeAction())
+ return active->text().replace("/", "\\/");
+
+ return active->text().replace("/", "\\/") + "/" + qtuitest_cast<QtUiTest::TextWidget*>(child)->selectedText();
+}
+
+QStringList TestMenu::list() const
+{
+ QStringList ret;
+
+ /* Iterate through every action */
+ foreach( QAction *a, q->actions() ) {
+ if (!a->isEnabled() || a->isSeparator())
+ continue;
+ QString t = a->text();
+ t.replace("/","\\/");
+ if (!t.isEmpty()) ret << t;
+ if (a->menu() && a->menu() != q) {
+ QStringList sub = qtuitest_cast<QtUiTest::ListWidget*>(a->menu())->list();
+ foreach (QString s, sub) {
+ if (!s.isEmpty()) ret << t + "/" + s;
+ }
+ }
+ }
+
+ return ret;
+}
+
+QRect TestMenu::visualRect(QString const &item) const
+{
+ TestWidgetsLog() << item;
+ static QRegExp slashRe("[^\\\\]/");
+ QRect ret;
+
+ int ind;
+ if (0 != (ind = item.indexOf(slashRe)+1)) {
+ QString top(item.left(ind));
+ QString rest(item.mid(ind+1));
+
+ QAction *a(q->activeAction());
+ QString t = a->text();
+ t.replace("/","\\/");
+ if (!a || t != top || !a->menu()) {
+ TestWidgetsLog() << "The desired submenu" << item << "is not visible";
+ return ret;
+ }
+
+ ret = qtuitest_cast<QtUiTest::ListWidget*>(a->menu())->visualRect(rest);
+ ret.moveTopLeft( q->mapFromGlobal( a->menu()->mapToGlobal( ret.topLeft() ) ) );
+ return ret;
+ }
+
+ QAction *a = actionForItem(item);
+ if (a) ret = q->actionGeometry(a);
+
+ return ret;
+}
+
+QAction *TestMenu::actionForItem(QString const &item) const
+{
+ static QRegExp amperRe("&(.)");
+ QAction *ret = 0;
+ foreach( QAction *a, q->actions() ) {
+ QString t = a->text();
+ t.replace("/","\\/");
+ if (t == item) {
+ ret = a;
+ break;
+ } else {
+ t.replace(amperRe, "\\1");
+ if (t == item) {
+ ret = a;
+ }
+ }
+ }
+
+ if (!ret) {
+ setErrorString("Item \"" + item + "\" is not available");
+ } else if (!ret->isEnabled()) {
+ setErrorString("Item \"" + item + "\" is not enabled");
+ ret = 0;
+ }
+
+ return ret;
+}
+
+Qt::CheckState TestMenu::checkState() const
+{
+ QAction *active = q->activeAction();
+ return (active && active->isChecked()) ? Qt::Checked : Qt::Unchecked;
+}
+
+bool TestMenu::ensureVisible(QString const&)
+{ return false; }
+
+bool TestMenu::canSelect(QString const &item) const
+{
+ QStringList l = list();
+ return l.contains(item) || l.contains(labelText(item));
+}
+
+bool TestMenu::select(QString const &item)
+{
+ if (!isVisible()) {
+ setErrorString("Can't select \"" + item + "\" because menu is not visible");
+ return false;
+ }
+
+ TestWidgetsLog() << item;
+ static QRegExp slashRe("[^\\\\]/");
+
+ QString topItem = item;
+ QString rest;
+
+ int ind;
+ if (0 != (ind = item.indexOf(slashRe)+1)) {
+ topItem = item.left(ind);
+ rest = item.mid(ind+1);
+ }
+
+ QRect r = visualRect(topItem);
+ if (r.isNull()) {
+ if (errorString().isEmpty()) {
+ setErrorString("Can't find visual rect for item \"" + topItem + "\" in menu");
+ }
+ return false;
+ }
+
+ QPoint pos = r.center();
+
+ bool useMouse = mousePreferred();
+ if (useMouse) {
+ while (!rect().contains(pos)) {
+ QRect visibleRect = visibleRegion().boundingRect();
+ QPoint globalPos = mapToGlobal(visibleRect.topLeft());
+ if (pos.y() < globalPos.y()) {
+ TestWidgetsLog() << "click to scroll up";
+ mouseClick(QPoint(globalPos.x() + visibleRect.width() / 2, globalPos.y() + 8));
+ QtUiTest::wait(200);
+ } else {
+ TestWidgetsLog() << "click to scroll down";
+ mouseClick(QPoint(globalPos.x() + visibleRect.width() / 2, globalPos.y() + visibleRect.height() - 8));
+ QtUiTest::wait(200);
+ }
+
+ pos = visualRect(topItem).center();
+ }
+ TestWidgetsLog() << "click on item";
+ if (!mouseClick(q, mapToGlobal(pos)))
+ return false;
+// waitForSignal(q, SIGNAL(triggered(QAction*)));
+ } else {
+ Qt::Key key;
+ if ( pos.y() > q->actionGeometry(q->activeAction()).center().y() )
+ key = Qt::Key_Down;
+ else
+ key = Qt::Key_Up;
+
+ while ( selectedText() != topItem ) {
+ TestWidgetsLog() << "key" << ((key == Qt::Key_Down) ? "down" : "up");
+ if (!keyClick(q, key)) return false;
+ }
+
+ TestWidgetsLog() << "select key";
+ // If this is the last item, it should be trigged...
+ if (item == topItem) {
+ if (!keyClick(q->activeAction(), SIGNAL(triggered(bool)), QtUiTest::Key_Activate))
+ return false;
+ }
+ // ...but if it has a submenu, it won't be; rather, its menu will be shown.
+ else if (q->activeAction() && q->activeAction()->menu()) {
+ if (!keyClick(q->activeAction()->menu(), QtUiTest::Key_Activate))
+ return false;
+ }
+
+ // And if it doesn't have a submenu and isn't the final item... well, that shouldn't
+ // happen, but that will be caught below.
+ }
+
+ if (topItem != item) {
+ QAction *a(q->activeAction());
+ if (!a || !a->menu()) {
+ setErrorString("Failed to select \"" + item + "\" because " +
+ (!a ? "focus could not be given to a parent item."
+ : "an item was expected to have a submenu, but didn't."));
+ return false;
+ }
+
+ // Wait until the menu is visible
+ if (!a->menu()->isVisible() && !waitForEvent(a->menu(), QEvent::Show)) {
+ setErrorString("Failed to select \"" + item + "\" because a submenu did not become "
+ "visible when it should have.");
+ return false;
+ }
+
+ TestWidgetsLog() << "calling select() on child";
+ return qtuitest_cast<SelectWidget*>(a->menu())->select(rest);
+ }
+ return true;
+}
+
+bool TestMenu::isCheckable(const QString &item)
+{
+ static QRegExp slashRe("[^\\\\]/");
+ bool ret = false;
+ int ind;
+ if (0 != (ind = item.indexOf(slashRe)+1)) {
+ QString top(item.left(ind));
+ QString rest(item.mid(ind+1));
+
+ QAction *a = actionForItem(top);
+ if (!a || !a->menu()) {
+ TestWidgetsLog() << "The desired submenu" << item << "is not valid";
+ return ret;
+ }
+
+ return qtuitest_cast<QtUiTest::CheckItemWidget*>(a->menu())->isCheckable(rest);
+ }
+
+ QAction *a = actionForItem(item);
+ if (a) ret = a->isCheckable();
+
+ return ret;
+}
+
+bool TestMenu::isChecked(const QString &item) const
+{
+ static QRegExp slashRe("[^\\\\]/");
+
+ bool ret = false;
+ int ind;
+ if (0 != (ind = item.indexOf(slashRe)+1)) {
+ QString top(item.left(ind));
+ QString rest(item.mid(ind+1));
+
+ QAction *a = actionForItem(top);
+ if (!a || !a->menu()) {
+ TestWidgetsLog() << "The desired submenu" << item << "is not valid";
+ return ret;
+ }
+
+ return qtuitest_cast<QtUiTest::CheckItemWidget*>(a->menu())->isChecked(rest);
+ }
+
+ QAction *a = actionForItem(item);
+ if (a) {
+ ret = a->isChecked();
+ } else {
+ setErrorString("Cannot get check status for item \"" + item + "\"");
+ }
+
+ return ret;
+}
+
+bool TestMenu::setChecked(const QString &item, bool value)
+{
+ if (isChecked(item) == value) {
+ return true;
+ }
+
+ return select(item);
+}
+
+bool TestMenu::hasFocus() const
+{
+ return !q->isHidden();
+}
+
+bool TestMenu::canWrap(QObject *o)
+{ return qobject_cast<QMenu*>(o); }
+
+}
diff --git a/plugins/qtuitest_widgets/qtwidgets/testmenu.h b/plugins/qtuitest_widgets/qtwidgets/testmenu.h
new file mode 100644
index 0000000..17a45aa
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testmenu.h
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTMENU_H
+#define TESTMENU_H
+
+#include <testwidget.h>
+
+#include <QtGlobal>
+
+class QMenu;
+class QAction;
+
+namespace QtUiTest {
+
+class TestMenu : public TestWidget, public QtUiTest::TextWidget,
+ public QtUiTest::ListWidget, public QtUiTest::CheckWidget,
+ public QtUiTest::SelectWidget, public QtUiTest::CheckItemWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::TextWidget
+ QtUiTest::ListWidget
+ QtUiTest::CheckWidget
+ QtUiTest::CheckItemWidget
+ QtUiTest::SelectWidget)
+
+public:
+ TestMenu(QObject*);
+
+ virtual QString text() const;
+ virtual QString selectedText() const;
+
+ virtual QStringList list() const;
+ virtual QRect visualRect(QString const&) const;
+ virtual bool ensureVisible(QString const&);
+
+ virtual Qt::CheckState checkState() const;
+
+ virtual bool canSelect(const QString&) const;
+ virtual bool select(const QString&);
+
+ virtual bool isCheckable(const QString&);
+ virtual bool isChecked(const QString&) const;
+ virtual bool setChecked(const QString&, bool);
+
+ virtual bool hasFocus() const;
+
+ static bool canWrap(QObject*);
+
+signals:
+ void stateChanged(int);
+ void selected(const QString&);
+
+private slots:
+ void on_hovered(QAction*);
+ void on_triggered(bool);
+ void on_toggled(bool);
+
+private:
+ QMenu *q;
+ QAction *lastAction;
+
+ QAction *actionForItem(QString const&) const;
+};
+
+}
+
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testmenubar.cpp b/plugins/qtuitest_widgets/qtwidgets/testmenubar.cpp
new file mode 100644
index 0000000..095b5d4
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testmenubar.cpp
@@ -0,0 +1,391 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testmenubar.h"
+#include "testwidgetslog.h"
+
+#include <QMenuBar>
+#include <QMenu>
+#include <QAction>
+
+namespace QtUiTest {
+
+TestMenuBar::TestMenuBar(QObject *_q)
+ : TestWidget(_q), q(qobject_cast<QMenuBar*>(_q)), lastAction(0)
+{
+ // For accurate ordering of events recording, these connections
+ // must come before all others.
+// QtUiTest::connectFirst(q, SIGNAL(hovered(QAction*)),
+// this, SLOT(on_hovered(QAction*)));
+}
+/*
+void TestMenuBar::on_hovered(QAction* a)
+{
+ if (lastAction)
+ QtUiTest::disconnectFirst(lastAction, 0, this, 0);
+ lastAction = a;
+ if (lastAction) {
+ QtUiTest::connectFirst(lastAction, SIGNAL(toggled(bool)),
+ this, SLOT(on_toggled(bool)));
+ QtUiTest::connectFirst(lastAction, SIGNAL(triggered(bool)),
+ this, SLOT(on_triggered(bool)));
+ }
+}
+
+void TestMenuBar::on_toggled(bool state)
+{ emit stateChanged(state); }
+*/
+/*
+QString textForAction(QMenu* m, QAction* a)
+{
+ QString ret;
+ foreach (QAction* child, m->actions()) {
+ if (child == a) {
+ ret = a->text();
+ ret.replace("/","\\/");
+ } else if (child->menu()) {
+ ret = textForAction(child->menu(), a);
+ if (!ret.isEmpty())
+ ret.prepend(child->menu()->title().replace("/","\\/") + "/");
+ }
+ if (!ret.isEmpty())
+ break;
+ }
+ return ret;
+}
+*/
+/*
+void TestMenuBar::on_triggered(bool)
+{
+ // Both the top level and submenus emit the triggered() signal.
+ // We only want to emit selected() if we are the top level menu.
+
+ bool top_level = true;
+ if (q->menuAction()) {
+ foreach (QWidget* w, q->menuAction()->associatedWidgets()) {
+ if (qobject_cast<QMenu*>(w)) {
+ top_level = false;
+ break;
+ }
+ }
+ }
+
+ if (!top_level) return;
+
+ emit selected(textForAction(q,lastAction));
+// }
+*/
+QString TestMenuBar::text() const
+{
+ return list().join("\n");
+}
+
+QString TestMenuBar::selectedText() const
+{
+ QString ret;
+
+ QAction *active = q->activeAction();
+ if (!active) return ret;
+
+ QMenu *child = active->menu();
+ if (!child || !child->activeAction())
+ return active->text().replace("/", "\\/");
+
+ return active->text().replace("/", "\\/") + "/" + qtuitest_cast<QtUiTest::TextWidget*>(child)->selectedText();
+}
+
+QStringList TestMenuBar::list() const
+{
+ QStringList ret;
+
+ /* Iterate through every action */
+ foreach( QAction *a, q->actions() ) {
+ if (!a->isEnabled())
+ continue;
+ QString t = a->text();
+ t.replace("/","\\/");
+ if (!t.isEmpty()) ret << t;
+ if (a->menu()) {
+ QStringList sub = qtuitest_cast<QtUiTest::ListWidget*>(a->menu())->list();
+ foreach (QString s, sub) {
+ if (!s.isEmpty()) ret << t + "/" + s;
+ }
+ }
+ }
+
+ return ret;
+}
+
+QRect TestMenuBar::visualRect(QString const &item) const
+{
+ TestWidgetsLog() << item;
+ static QRegExp slashRe("[^\\\\]/");
+ static QRegExp amperRe("&(.)");
+ QRect ret;
+
+ int ind;
+ if (0 != (ind = item.indexOf(slashRe)+1)) {
+ QString top(item.left(ind));
+ QString rest(item.mid(ind+1));
+
+ QAction *a(q->activeAction());
+ QString t = a->text();
+ t.replace("/","\\/");
+ if (!a || t != top || !a->menu()) {
+ TestWidgetsLog() << "The desired submenu" << item << "is not visible";
+ return ret;
+ }
+
+ ret = qtuitest_cast<QtUiTest::ListWidget*>(a->menu())->visualRect(rest);
+ ret.moveTopLeft( q->mapFromGlobal( a->menu()->mapToGlobal( ret.topLeft() ) ) );
+ return ret;
+ }
+
+ QAction *a = actionForItem(item);
+ if (a) ret = q->actionGeometry(a);
+
+ return ret;
+}
+
+QAction *TestMenuBar::actionForItem(QString const &item) const
+{
+ static QRegExp amperRe("&(.)");
+ QAction *ret = 0;
+ foreach( QAction *a, q->actions() ) {
+ QString t = a->text();
+ t.replace("/","\\/");
+ if (t == item) {
+ ret = a;
+ break;
+ } else {
+ t.replace(amperRe, "\\1");
+ if (t == item) {
+ ret = a;
+ }
+ }
+ }
+
+ if (!ret) {
+ setErrorString("Item \"" + item + "\" is not available");
+ } else if (!ret->isEnabled()) {
+ setErrorString("Item \"" + item + "\" is not enabled");
+ ret = 0;
+ }
+
+ return ret;
+}
+
+Qt::CheckState TestMenuBar::checkState() const
+{
+ QAction *active = q->activeAction();
+ return (active && active->isChecked()) ? Qt::Checked : Qt::Unchecked;
+}
+
+bool TestMenuBar::ensureVisible(QString const&)
+{ return false; }
+
+bool TestMenuBar::canSelect(QString const &item) const
+{
+ return list().contains(item);
+}
+
+bool TestMenuBar::select(QString const &item)
+{
+ if (!isVisible()) {
+ setErrorString("Can't select \"" + item + "\" because menu is not visible");
+ return false;
+ }
+
+ TestWidgetsLog() << item;
+ static QRegExp slashRe("[^\\\\]/");
+
+ QString topItem = item;
+ QString rest;
+
+ int ind;
+ if (0 != (ind = item.indexOf(slashRe)+1)) {
+ topItem = item.left(ind);
+ rest = item.mid(ind+1);
+ }
+
+ QAction *action = actionForItem(topItem);
+
+ QRect r = visualRect(topItem);
+ if (r.isNull()) {
+ if (errorString().isEmpty()) {
+ setErrorString("Can't find visual rect for item \"" + topItem + "\" in menu");
+ }
+ return false;
+ }
+
+ QPoint pos = r.center();
+
+ if (mousePreferred()) {
+ while (!rect().contains(pos)) {
+ QRect visibleRect = visibleRegion().boundingRect();
+ QPoint globalPos = mapToGlobal(visibleRect.topLeft());
+ if (pos.y() < globalPos.y()) {
+ TestWidgetsLog() << "click to scroll up";
+ mouseClick(QPoint(globalPos.x() + visibleRect.width() / 2, globalPos.y() + 8));
+ QtUiTest::wait(200);
+ } else {
+ TestWidgetsLog() << "click to scroll down";
+ mouseClick(QPoint(globalPos.x() + visibleRect.width() / 2, globalPos.y() + visibleRect.height() - 8));
+ QtUiTest::wait(200);
+ }
+
+ pos = visualRect(topItem).center();
+ }
+
+ if (!mouseClick(action->menu(), SIGNAL(aboutToShow()), mapToGlobal(pos)))
+ return false;
+ } else {
+ Qt::Key key;
+ if ( pos.y() > q->actionGeometry(q->activeAction()).center().y() )
+ key = Qt::Key_Down;
+ else
+ key = Qt::Key_Up;
+
+ while ( selectedText() != topItem ) {
+ TestWidgetsLog() << "key" << ((key == Qt::Key_Down) ? "down" : "up");
+ if (!keyClick(q, key)) return false;
+ }
+
+ TestWidgetsLog() << "select key";
+ // If this is the last item, it should be trigged...
+ if (item == topItem) {
+ if (!keyClick(q->activeAction(), SIGNAL(triggered(bool)), QtUiTest::Key_Select))
+ return false;
+ }
+ // ...but if it has a submenu, it won't be; rather, its menu will be shown.
+ else if (q->activeAction() && q->activeAction()->menu()) {
+ if (!keyClick(q->activeAction()->menu(), QtUiTest::Key_Select))
+ return false;
+ }
+
+ // And if it doesn't have a submenu and isn't the final item... well, that shouldn't
+ // happen, but that will be caught below.
+ }
+
+ if (topItem != item) {
+
+ if (!action->menu()->isVisible() && !waitForEvent(action->menu(), QEvent::Show)) {
+ setErrorString("Failed to select \"" + item + "\" because a submenu did not become "
+ "visible when it should have.");
+ return false;
+ }
+
+ TestWidgetsLog() << "calling select() on child";
+ return qtuitest_cast<SelectWidget*>(action->menu())->select(rest);
+ }
+
+ return true;
+}
+
+bool TestMenuBar::isCheckable(const QString &item)
+{
+ static QRegExp slashRe("[^\\\\]/");
+
+ bool ret = false;
+ int ind;
+ if (0 != (ind = item.indexOf(slashRe)+1)) {
+ QString top(item.left(ind));
+ QString rest(item.mid(ind+1));
+
+ QAction *a = actionForItem(top);
+ if (!a || !a->menu()) {
+ TestWidgetsLog() << "The desired submenu" << item << "is not valid";
+ return ret;
+ }
+
+ return qtuitest_cast<QtUiTest::CheckItemWidget*>(a->menu())->isCheckable(rest);
+ }
+
+ QAction *a = actionForItem(item);
+ if (a) ret = a->isCheckable();
+
+ return ret;
+}
+
+bool TestMenuBar::isChecked(const QString &item) const
+{
+ static QRegExp slashRe("[^\\\\]/");
+
+ bool ret = false;
+ int ind;
+ if (0 != (ind = item.indexOf(slashRe)+1)) {
+ QString top(item.left(ind));
+ QString rest(item.mid(ind+1));
+
+ QAction *a = actionForItem(top);
+
+ if (!a || !a->menu()) {
+ TestWidgetsLog() << "The desired submenu" << item << "is not valid";
+ return ret;
+ }
+
+ return qtuitest_cast<QtUiTest::CheckItemWidget*>(a->menu())->isChecked(rest);
+ }
+
+ QAction *a = actionForItem(item);
+ if (a) ret = a->isChecked();
+
+ return ret;
+}
+
+bool TestMenuBar::setChecked(const QString &item, bool value)
+{
+ if (isChecked(item) == value) {
+ return true;
+ }
+
+ return select(item);
+}
+
+bool TestMenuBar::hasFocus() const
+{
+ return !q->isHidden();
+}
+
+bool TestMenuBar::canWrap(QObject *o)
+{ return qobject_cast<QMenuBar*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testmenubar.h b/plugins/qtuitest_widgets/qtwidgets/testmenubar.h
new file mode 100644
index 0000000..229e4f7
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testmenubar.h
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTMENUBAR_H
+#define TESTMENUBAR_H
+
+#include <testwidget.h>
+
+#include <QtGlobal>
+
+class QMenuBar;
+class QAction;
+
+namespace QtUiTest {
+
+class TestMenuBar : public TestWidget, public QtUiTest::TextWidget,
+ public QtUiTest::ListWidget, public QtUiTest::CheckWidget,
+ public QtUiTest::SelectWidget, public CheckItemWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::TextWidget
+ QtUiTest::ListWidget
+ QtUiTest::CheckWidget
+ QtUiTest::CheckItemWidget
+ QtUiTest::SelectWidget)
+
+public:
+ TestMenuBar(QObject*);
+
+ virtual QString text() const;
+ virtual QString selectedText() const;
+
+ virtual QStringList list() const;
+ virtual QRect visualRect(QString const&) const;
+ virtual bool ensureVisible(QString const&);
+
+ virtual Qt::CheckState checkState() const;
+
+ virtual bool canSelect(const QString&) const;
+ virtual bool select(const QString&);
+
+ virtual bool isCheckable(const QString&);
+ virtual bool isChecked(const QString&) const;
+ virtual bool setChecked(const QString&, bool);
+
+ virtual bool hasFocus() const;
+
+ static bool canWrap(QObject*);
+
+signals:
+ void stateChanged(int);
+ void selected(const QString&);
+
+//private slots:
+// void on_hovered(QAction*);
+// void on_triggered(bool);
+// void on_toggled(bool);
+
+private:
+ QMenuBar *q;
+ QAction *lastAction;
+
+ QAction *actionForItem(QString const&) const;
+};
+
+}
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testpushbutton.cpp b/plugins/qtuitest_widgets/qtwidgets/testpushbutton.cpp
new file mode 100644
index 0000000..6d3bd35
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testpushbutton.cpp
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testpushbutton.h"
+#include "testwidgetslog.h"
+
+#include <QMenu>
+#include <QPushButton>
+
+namespace QtUiTest {
+
+TestPushButton::TestPushButton(QObject *_q)
+ : TestAbstractButton(_q), q(qobject_cast<QPushButton*>(_q))
+{}
+
+QStringList TestPushButton::list() const
+{
+ QStringList ret;
+
+ QtUiTest::ListWidget *menu
+ = qtuitest_cast<QtUiTest::ListWidget*>(q->menu());
+
+ if (menu)
+ ret = menu->list();
+
+ return ret;
+}
+
+QRect TestPushButton::visualRect(QString const &item) const
+{
+ TestWidgetsLog();
+ QRect ret;
+ QtUiTest::ListWidget *lMenu
+ = qtuitest_cast<QtUiTest::ListWidget*>(q->menu());
+
+ if (lMenu)
+ ret = lMenu->visualRect(item);
+ return ret;
+}
+
+bool TestPushButton::ensureVisible(QString const& item)
+{
+ bool ret = false;
+
+ QtUiTest::ListWidget *menu
+ = qtuitest_cast<QtUiTest::ListWidget*>(q->menu());
+
+ if (menu)
+ ret = menu->ensureVisible(item);
+
+ return ret;
+}
+
+bool TestPushButton::canSelect(QString const &item) const
+{ return list().contains(item); }
+
+bool TestPushButton::select(QString const &item)
+{
+ bool ret = false;
+
+ QtUiTest::SelectWidget *menu
+ = qtuitest_cast<QtUiTest::SelectWidget*>(q->menu());
+
+ if (menu)
+ {
+ activate();
+ ret = menu->select(item);
+ }
+
+ return ret;
+}
+
+bool TestPushButton::canWrap(QObject *o)
+{ return qobject_cast<QPushButton*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testpushbutton.h b/plugins/qtuitest_widgets/qtwidgets/testpushbutton.h
new file mode 100644
index 0000000..5a3f420
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testpushbutton.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTPUSHBUTTON_H
+#define TESTPUSHBUTTON_H
+
+#include "testabstractbutton.h"
+
+class QPushButton;
+
+namespace QtUiTest {
+
+class TestPushButton : public TestAbstractButton,
+ public QtUiTest::ListWidget, public QtUiTest::SelectWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::ListWidget
+ QtUiTest::SelectWidget)
+
+public:
+ TestPushButton(QObject*);
+
+ virtual QStringList list() const;
+ virtual QRect visualRect(QString const&) const;
+ virtual bool ensureVisible(QString const&);
+
+ virtual bool canSelect(const QString&) const;
+ virtual bool select(const QString&);
+
+ static bool canWrap(QObject*);
+
+private:
+ QPushButton *q;
+};
+
+}
+
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testtabbar.cpp b/plugins/qtuitest_widgets/qtwidgets/testtabbar.cpp
new file mode 100644
index 0000000..4a7bd8a
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testtabbar.cpp
@@ -0,0 +1,231 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testtabbar.h"
+
+#include "testwidgetslog.h"
+
+#include <QTabBar>
+#include <QTabWidget>
+#include <QToolButton>
+
+namespace QtUiTest {
+
+TestTabBar::TestTabBar(QObject *_q)
+ : TestWidget(_q), q(qobject_cast<QTabBar*>(_q))
+{
+ connect(q, SIGNAL(currentChanged(int)),
+ this, SLOT(on_currentChanged(int)));
+}
+
+void TestTabBar::on_currentChanged(int index)
+{ emit selected(q->tabText(index)); }
+
+QString TestTabBar::text() const
+{ return list().join("\n"); }
+
+QString TestTabBar::selectedText() const
+{ return q->tabText(q->currentIndex()); }
+
+QStringList TestTabBar::list() const
+{
+ QStringList ret;
+ for (int i = 0, max = q->count(); i < max; ++i)
+ ret << q->tabText(i);
+ return ret;
+}
+
+QRect TestTabBar::visualRect(QString const &item) const
+{
+ int index = indexForItem(item);
+ if (index != -1)
+ return q->visibleRegion().subtracted(q->childrenRegion()).intersected(QRegion(q->tabRect(index))).boundingRect();
+ else
+ return QRect();
+}
+
+bool TestTabBar::ensureVisible(QString const& item)
+{
+ /* First, find desired index. */
+ int desired = indexForItem(item);
+ if (-1 == desired) return false;
+
+ QToolButton* leftB = 0;
+ QToolButton* rightB = 0;
+
+ QList<QToolButton*> buttons = q->findChildren<QToolButton*>();
+ QRegion buttonRegion;
+ foreach (QToolButton* b, buttons) {
+ if (b->arrowType() == Qt::LeftArrow) {
+ leftB = b;
+ buttonRegion |= b->geometry();
+ } else if (b->arrowType() == Qt::RightArrow) {
+ rightB = b;
+ buttonRegion |= b->geometry();
+ }
+ }
+ QRect buttonRect = buttonRegion.boundingRect();
+
+ int clicks = 0;
+ /* While desired tab isn't visible... */
+ while (q->visibleRegion().subtracted(buttonRect).intersected( q->tabRect(desired) ).isEmpty()
+ && clicks < 50) {
+
+ TestWidgetsLog() << "visible:" << q->visibleRegion().boundingRect() << "buttons:" << buttonRect << "tab:" << q->tabRect(desired);
+
+ QObject* button = 0;
+
+ /* Shall we go to the left or the right? */
+ if (q->tabRect(desired).left() >= q->visibleRegion().subtracted(buttonRect).boundingRect().right())
+ button = rightB;
+ else
+ button = leftB;
+
+ QtUiTest::ActivateWidget* aw
+ = qtuitest_cast<QtUiTest::ActivateWidget*>(button);
+ if (!aw) return false;
+ aw->activate();
+
+ ++clicks;
+ }
+
+ return !q->visibleRegion().subtracted(buttonRect).intersected( q->tabRect(desired) ).isEmpty();
+}
+
+bool TestTabBar::canSelect(QString const& item) const
+{
+ return indexForItem(item) != -1;
+}
+
+bool isAncestor(QObject* parent, QObject* child)
+{
+ bool ret = false;
+ QObject* p = child;
+ while (p && !ret) {
+ ret = (p == parent);
+ p = p->parent();
+ }
+ return ret;
+}
+
+bool TestTabBar::select(QString const& item)
+{
+ using namespace QtUiTest;
+
+ QStringList allTabs;
+ int desired = -1;
+ desired = indexForItem(item);
+ for (int i = 0, max = q->count(); i < max && -1 == desired; ++i) {
+ if (q->tabText(i) == item)
+ desired = i;
+ allTabs << q->tabText(i);
+ }
+ if (-1 == desired) {
+ setErrorString(
+ "Could not select tab '" + item + "' because there is no tab with that text");
+ return false;
+ }
+ if (q->currentIndex() == desired) return true;
+
+ QString originalTab = q->tabText(q->currentIndex());
+
+ if (mousePreferred()) {
+ if (!ensureVisible(item)) return false;
+ QPoint p = visualRect(item).center();
+ if (!ensureVisiblePoint(p)) return false;
+ mouseClick(mapToGlobal(p));
+ QtUiTest::waitForSignal(q, SIGNAL(currentChanged(int)));
+ if (q->currentIndex() != desired) {
+ setErrorString(
+ "Clicked on tab '" + item + "' but it did not appear to become selected.\n"
+ "Selected tab is: " + selectedText());
+ return false;
+ }
+ return true;
+ }
+
+ if (!setFocus()) return false;
+
+ Qt::Key key;
+ int diff = 0;
+ if (desired < q->currentIndex()) {
+ key = Qt::Key_Left;
+ diff = q->currentIndex() - desired;
+ }
+ else {
+ key = Qt::Key_Right;
+ diff = desired - q->currentIndex();
+ }
+ for (int i = 0; i < diff; ++i) {
+ if (!setFocus()) return false;
+ if (!keyClick(q, SIGNAL(currentChanged(int)), key))
+ return false;
+ }
+
+ if (q->currentIndex() == desired) return true;
+ setErrorString(
+ QString("Can't change tabs: pressed the %1 key %2 times which should have "
+ "moved from '%3' to '%4', but the current tab ended up as '%5'.")
+ .arg((key == Qt::Key_Right) ? "Right" : "Left")
+ .arg(diff)
+ .arg(originalTab)
+ .arg(item)
+ .arg(q->tabText(q->currentIndex()))
+ );
+ return false;
+}
+
+int TestTabBar::indexForItem(QString const& item) const
+{
+ for (int i = 0, max = q->count(); i < max; ++i) {
+ if (q->tabText(i) == item || labelText(q->tabText(i)) == item)
+ return i;
+ }
+ return -1;
+}
+
+bool TestTabBar::inherits(QtUiTest::WidgetType type) const
+{ return (QtUiTest::TabBar == type); }
+
+bool TestTabBar::canWrap(QObject *o)
+{ return qobject_cast<QTabBar*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testtabbar.h b/plugins/qtuitest_widgets/qtwidgets/testtabbar.h
new file mode 100644
index 0000000..b636bec
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testtabbar.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTTABBAR_H
+#define TESTTABBAR_H
+
+#include <testwidget.h>
+
+class QTabBar;
+
+namespace QtUiTest {
+
+class TestTabBar : public TestWidget,
+ public QtUiTest::TextWidget,
+ public QtUiTest::ListWidget,
+ public QtUiTest::SelectWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::TextWidget
+ QtUiTest::ListWidget
+ QtUiTest::SelectWidget)
+
+public:
+ TestTabBar(QObject*);
+
+ virtual QString text() const;
+ virtual QString selectedText() const;
+
+ virtual QStringList list() const;
+ virtual QRect visualRect(QString const&) const;
+ virtual bool ensureVisible(QString const&);
+
+ virtual bool canSelect(QString const&) const;
+ virtual bool select(QString const&);
+
+ virtual bool inherits(QtUiTest::WidgetType) const;
+
+ static bool canWrap(QObject*);
+
+signals:
+ void selected(const QString&);
+
+private slots:
+ void on_currentChanged(int);
+
+private:
+ int indexForItem(QString const&) const;
+ QTabBar *q;
+};
+
+}
+
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testtext.cpp b/plugins/qtuitest_widgets/qtwidgets/testtext.cpp
new file mode 100644
index 0000000..e62cc27
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testtext.cpp
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testtext.h"
+#include "testwidgetslog.h"
+
+#include <QPointer>
+#include <QVariant>
+
+using namespace QtUiTest;
+
+bool TestText::enterText(QObject* q, QString const& item, QString const& expectedText, bool commit)
+{
+ QByteArray textChanged = textChangedSignal(q);
+ TextWidget* tw = qtuitest_cast<TextWidget*>(q);
+
+ foreach (QChar const& c, item) {
+ TestWidgetsLog() << asciiToModifiers(c.toLatin1());
+ if (!keyClick(q, textChanged, asciiToKey(c.toLatin1()), asciiToModifiers(c.toLatin1()) ))
+ return false;
+ }
+
+ QString newText = tw->text();
+ if (newText != expectedText) {
+ setErrorString(QString("After entering text, expected text of:\n%1\nBut text was:\n%2")
+ .arg(expectedText)
+ .arg(newText));
+ return false;
+ }
+
+ if (commit) {
+#ifdef Q_OS_SYMBIAN
+ keyClick(Qt::Key_Select);
+#else
+ QtUiTest::Widget* w = qtuitest_cast<QtUiTest::Widget*>(q);
+ if (w) return w->setEditFocus(false);
+#endif
+ }
+
+ return true;
+}
+
+bool TestText::enterTextByProxy(QtUiTest::InputWidget* proxy, QObject* q, QString const& item, QString const& expectedText, bool commit)
+{
+ TextWidget* tw = qtuitest_cast<TextWidget*>(q);
+ QByteArray textChanged = textChangedSignal(q);
+ QPointer<QObject> safeQ(q);
+
+ if (!proxy->enter(item, !commit)) return false;
+
+ QString newText;
+
+ for (int i = expectedText.length(); i != 0; --i) {
+ if (!safeQ) {
+ setErrorString("Widget was destroyed while entering text.");
+ return false;
+ }
+ newText = tw->text();
+ if (newText == expectedText) {
+ break;
+ }
+ if (!waitForSignal(q, textChanged)) {
+ setErrorString("Text did not change on focused widget due to key clicks");
+ return false;
+ }
+ }
+
+ if (newText != expectedText) newText = tw->text();
+ if (newText != expectedText) {
+ setErrorString(QString("After entering text, expected text of:\n%1\nBut text was:\n%2")
+ .arg(expectedText)
+ .arg(newText));
+ return false;
+ }
+
+ return true;
+}
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testtext.h b/plugins/qtuitest_widgets/qtwidgets/testtext.h
new file mode 100644
index 0000000..6168c1e
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testtext.h
@@ -0,0 +1,139 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTTEXT_H
+#define TESTTEXT_H
+
+#include <qtuitestnamespace.h>
+#include <qrect.h>
+#include <qpoint.h>
+#include "testwidgetslog.h"
+
+namespace QtUiTest {
+
+namespace TestText {
+
+ inline
+ QByteArray textChangedSignal(QObject* q)
+ {
+ QByteArray textChangedSignal("textChanged(QString)");
+ if (-1 == q->metaObject()->indexOfSignal(textChangedSignal)) {
+ textChangedSignal = "textChanged()";
+ }
+ textChangedSignal.prepend(QSIGNAL_CODE);
+ return textChangedSignal;
+ }
+
+ // Erase the text in the widget q by using key clicks
+ template <typename T> inline
+ bool eraseTextByKeys(T* q)
+ {
+ using namespace QtUiTest;
+
+ if (!q->hasFocus()) {
+ setErrorString("Cannot erase text from unfocused widget.");
+ return false;
+ }
+
+ Widget* w = qtuitest_cast<Widget*>(q);
+ bool hadEditFocus = w->hasEditFocus();
+ if (!w->setEditFocus(true)) {
+ setErrorString("Couldn't erase text from widget: couldn't give edit focus to widget.");
+ return false;
+ }
+
+ const int MAX = q->text().length()+1;
+ int i = 0;
+
+ int pos = q->cursorPosition();
+ int oldPos = -1;
+ TestWidgetsLog() << "pos" << pos << "MAX" << MAX;
+
+ while (oldPos != pos && (++i < MAX) && (pos < MAX-1)) {
+ keyClick(q, SIGNAL(cursorPositionChanged(int,int)), Qt::Key_Right);
+ oldPos = pos;
+ pos = q->cursorPosition();
+ }
+
+ if (i >= MAX) {
+ setErrorString("Could not move cursor to rightmost position in widget.");
+ return false;
+ }
+
+ QByteArray textChanged = textChangedSignal(q);
+ i = 0;
+ do {
+ if (!keyClick(q, textChanged, Qt::Key_Backspace))
+ return false;
+ } while (q->cursorPosition() != 0 && (++i < MAX));
+
+ if (i >= MAX || !q->text().isEmpty()) {
+ setErrorString("Could not erase all text by pressing backspace.");
+ return false;
+ }
+
+ if (!w->setEditFocus(hadEditFocus)) {
+ setErrorString("Couldn't return widget to original edit focus state.");
+ return false;
+ }
+
+ return true;
+ }
+
+ template <typename T> inline
+ bool eraseTextByMouse(T* q)
+ {
+// QtUiTest::setErrorString("Erasing text by mouse is not implemented.");
+// return false;
+
+ //FIXME: For now, erase text using keys. Not sure if erasing text using
+ // the mouse makes sense in Qt.
+ return eraseTextByKeys(q);
+ }
+
+ bool enterText(QObject* q, QString const& item, QString const& expectedText, bool commit = true);
+ bool enterTextByProxy(QtUiTest::InputWidget* proxy, QObject* q, QString const& item, QString const& expectedText, bool commit = true);
+};
+
+}
+
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testtextedit.cpp b/plugins/qtuitest_widgets/qtwidgets/testtextedit.cpp
new file mode 100644
index 0000000..9e43324
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testtextedit.cpp
@@ -0,0 +1,298 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testtext.h"
+#include "testtextedit.h"
+#include "testwidgetslog.h"
+
+#include <QLayout>
+#include <QPointer>
+#include <QTextDocumentFragment>
+#include <QTextEdit>
+#include <QTextBlock>
+#include <QTextFragment>
+#include <QScrollBar>
+
+namespace QtUiTest {
+
+TestTextEdit::TestTextEdit(QObject *_q)
+ : TestWidget(_q)
+ , lastEntered()
+ , lastCursorPosition(-1)
+ , committed(false)
+ , q(qobject_cast<QTextEdit*>(_q))
+{
+ lastCursorPosition = cursorPosition();
+ connect(q, SIGNAL(textChanged()), this, SLOT(onTextChanged()));
+ connect(q, SIGNAL(textChanged()), this, SIGNAL(textChanged()));
+ connect(q, SIGNAL(cursorPositionChanged()), this, SLOT(onCursorPositionChanged()));
+}
+
+QString TestTextEdit::text() const
+{ return q->toPlainText(); }
+
+QString TestTextEdit::selectedText() const
+{ return q->textCursor().selection().toPlainText(); }
+
+QStringList TestTextEdit::list() const
+{
+ QStringList ret;
+ QTextDocument *doc = q->document();
+
+ for (int i = 0, blockCount = doc->blockCount(); i < blockCount; ++i) {
+ QTextBlock block = doc->findBlockByNumber(i);
+ QTextBlock::iterator it;
+ for (it = block.begin(); !(it.atEnd()); ++it) {
+ QTextFragment fragment = it.fragment();
+ if (fragment.isValid() && fragment.charFormat().isAnchor()) {
+ ret << fragment.text();
+ }
+ }
+ }
+
+ return ret;
+}
+
+QTextFragment TestTextEdit::fragmentForItem(QString const &item) const
+{
+ QTextFragment ret;
+ QTextDocument *doc = q->document();
+
+ for (int i = 0, blockCount = doc->blockCount(); i < blockCount; ++i) {
+ QTextBlock block = doc->findBlockByNumber(i);
+ QTextBlock::iterator it;
+ for (it = block.begin(); !(it.atEnd()); ++it) {
+ QTextFragment fragment = it.fragment();
+ if (fragment.isValid() && fragment.charFormat().isAnchor() &&
+ fragment.text() == item) {
+ return fragment;
+ }
+ }
+ }
+
+ return ret;
+}
+
+QRect TestTextEdit::visualRect(QString const &item) const
+{
+ return visualRect(fragmentForItem(item));
+}
+
+QRect TestTextEdit::visualRect(QTextFragment const &fragment) const
+{
+ QRect ret;
+
+ if (fragment.isValid()) {
+ QTextCursor cursor(q->document());
+ cursor.setPosition(fragment.position()+1);
+ ret = q->cursorRect(cursor);
+ }
+
+ return ret;
+}
+
+bool TestTextEdit::canEnter(QVariant const& item) const
+{
+ return item.canConvert<QString>();
+}
+
+bool TestTextEdit::enter(QVariant const& item, bool noCommit)
+{
+ if (!canEnter(item)) return false;
+
+ bool hadEditFocus = hasEditFocus();
+
+ if (!hadEditFocus && !setEditFocus(true)) return false;
+
+ using namespace QtUiTest;
+
+ QPointer<QObject> safeThis = this;
+ if (!safeThis) {
+ setErrorString("Widget was destroyed while entering text.");
+ return false;
+ }
+
+ QString oldText = text();
+ QString itemString = item.toString();
+ QString expectedText = oldText;
+ expectedText.insert(q->textCursor().position(), itemString);
+
+ /* If there's text currently in the field, and we committed it,
+ then erase it first. */
+ if (!oldText.isEmpty() && committed) {
+ if (QtUiTest::mousePreferred()) {
+ if (!TestText::eraseTextByMouse(this)) return false;
+ } else {
+ if (!TestText::eraseTextByKeys(this)) return false;
+ }
+ expectedText = itemString;
+ }
+
+ InputWidget* iw = qtuitest_cast<InputWidget*>(inputProxy());
+
+ if (!safeThis) {
+ setErrorString("Widget was destroyed while entering text.");
+ return false;
+ }
+
+ TestWidgetsLog() << iw;
+
+ if (iw) {
+ if (!TestText::enterTextByProxy(iw, q, itemString, expectedText, !noCommit)) return false;
+ } else {
+ if (!TestText::enterText(q, itemString, expectedText, !noCommit)) return false;
+ }
+
+ if (!safeThis) {
+ setErrorString("Widget was destroyed while entering text.");
+ return false;
+ }
+
+ if (!noCommit && hasEditFocus()) {
+ if (!setEditFocus(false)) {
+ return false;
+ }
+ }
+
+ committed = !noCommit;
+
+ return true;
+}
+
+bool TestTextEdit::canSelect(QString const &item) const
+{ return list().contains(item); }
+
+bool TestTextEdit::ensureVisible(QTextFragment const &item)
+{
+ QPoint p = visualRect(item).center();
+
+ if (q->viewport()->rect().contains(p)) {
+ TestWidgetsLog() << "item is already visible";
+ return true;
+ }
+
+ if (!QtUiTest::mousePreferred())
+ return false;
+
+ /* Figure out the points to click for scrolling in each direction */
+ QScrollBar *vbar = q->verticalScrollBar();
+ QScrollBar *hbar = q->horizontalScrollBar();
+ QPoint up = vbar->mapToGlobal(QPoint(vbar->width()/2,5));
+ QPoint down = vbar->mapToGlobal(QPoint(vbar->width()/2,vbar->height()-5));
+ QPoint left = hbar->mapToGlobal(QPoint(5, hbar->height()/2));
+ QPoint right = hbar->mapToGlobal(QPoint(hbar->width()-5,hbar->height()/2));
+
+ // While p is above rect...
+ while (p.y() < q->viewport()->rect().top()) {
+ if (!vbar->isVisible()) return false;
+ TestWidgetsLog() << "up" << "\nrect:" << rect() << "p:" << p;
+ QtUiTest::mouseClick(up);
+ waitForSignal(vbar, SIGNAL(valueChanged(int)));
+ p = visualRect(item).center();
+ }
+ // While p is below rect...
+ while (p.y() > q->viewport()->rect().bottom()) {
+ if (!vbar->isVisible()) return false;
+ TestWidgetsLog() << "down" << "\nrect:" << rect() << "p:" << p;
+ QtUiTest::mouseClick(down);
+ waitForSignal(vbar, SIGNAL(valueChanged(int)));
+ p = visualRect(item).center();
+ }
+ // While p is left of rect...
+ while (p.x() < q->viewport()->rect().left()) {
+ if (!hbar->isVisible()) return false;
+ TestWidgetsLog() << "left" << "\nrect:" << rect() << "p:" << p;
+ QtUiTest::mouseClick(left);
+ waitForSignal(hbar, SIGNAL(valueChanged(int)));
+ p = visualRect(item).center();
+ }
+ // While p is right of rect...
+ while (p.x() > q->viewport()->rect().right()) {
+ if (!hbar->isVisible()) return false;
+ TestWidgetsLog() << "right" << "\nrect:" << rect() << "p:" << p;
+ QtUiTest::mouseClick(right);
+ waitForSignal(hbar, SIGNAL(valueChanged(int)));
+ p = visualRect(item).center();
+ }
+
+ if (!q->viewport()->rect().contains(p)) {
+ TestWidgetsLog() << "failed" << "\nrect:" << q->viewport()->rect() << "p:" << p;
+ return false;
+ }
+
+ return true;
+}
+
+bool TestTextEdit::select(QString const &item)
+{
+ QTextFragment fragment = fragmentForItem(item);
+ if (!fragment.isValid()) return false;
+ ensureVisible(fragment);
+ QPoint pos = visualRect(item).center();
+ QtUiTest::mouseClick(q->viewport()->mapToGlobal(pos), Qt::LeftButton);
+ return true;
+
+}
+
+bool TestTextEdit::canWrap(QObject *o)
+{ return qobject_cast<QTextEdit*>(o); }
+
+int TestTextEdit::cursorPosition() const
+{
+ return q->textCursor().position();
+}
+
+void TestTextEdit::onTextChanged()
+{
+ if (!hasFocus() || !isVisible()) return;
+ if (q->toPlainText() == lastEntered) return;
+ lastEntered = q->toPlainText();
+ emit entered(lastEntered);
+}
+
+void TestTextEdit::onCursorPositionChanged()
+{
+ int prev = lastCursorPosition;
+ lastCursorPosition = cursorPosition();
+ emit cursorPositionChanged(prev, lastCursorPosition);
+}
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testtextedit.h b/plugins/qtuitest_widgets/qtwidgets/testtextedit.h
new file mode 100644
index 0000000..0795baf
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testtextedit.h
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTTEXTEDIT_H
+#define TESTTEXTEDIT_H
+
+#include <testwidget.h>
+
+class QTextEdit;
+class QTextFragment;
+
+namespace QtUiTest {
+
+class TestTextEdit : public TestWidget,
+ public QtUiTest::TextWidget,
+ public QtUiTest::ListWidget,
+ public QtUiTest::SelectWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::TextWidget
+ QtUiTest::ListWidget
+ QtUiTest::SelectWidget)
+
+public:
+ TestTextEdit(QObject*);
+
+ virtual QString text() const;
+ virtual QString selectedText() const;
+
+ virtual QStringList list() const;
+ virtual QRect visualRect(QString const&) const;
+
+ virtual bool canEnter(QVariant const&) const;
+ virtual bool enter(QVariant const&,bool);
+
+ virtual bool canSelect(QString const&) const;
+ virtual bool select(QString const&);
+
+ static bool canWrap(QObject*);
+
+ int cursorPosition() const;
+
+signals:
+ void cursorPositionChanged(int,int);
+ void textChanged();
+ void entered(QVariant const&);
+
+protected:
+ QTextFragment fragmentForItem(QString const&) const;
+ virtual QRect visualRect(QTextFragment const&) const;
+ virtual bool ensureVisible(QTextFragment const&);
+
+private slots:
+ void onTextChanged();
+ void onCursorPositionChanged();
+
+private:
+ QString lastEntered;
+ int lastCursorPosition;
+ bool committed;
+ QTextEdit *q;
+};
+
+}
+
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testtimeedit.cpp b/plugins/qtuitest_widgets/qtwidgets/testtimeedit.cpp
new file mode 100644
index 0000000..99fb9b4
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testtimeedit.cpp
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testtimeedit.h"
+#include "testwidgetslog.h"
+
+#include <QTimeEdit>
+
+namespace QtUiTest {
+
+TestTimeEdit::TestTimeEdit(QObject* _q)
+ : TestDateTimeEdit(_q), q(qobject_cast<QTimeEdit*>(_q))
+{
+ TestWidgetsLog();
+
+ disconnect(q, SIGNAL(dateTimeChanged(QDateTime)), this, 0);
+ connect(q, SIGNAL(dateTimeChanged(QDateTime)),
+ this, SLOT(onDateTimeChanged(QDateTime)));
+}
+
+void TestTimeEdit::onDateTimeChanged(QDateTime const& dt)
+{
+ emit entered(dt.time());
+}
+
+QString TestTimeEdit::text() const
+{
+ TestWidgetsLog();
+ return q->time().toString(q->displayFormat());
+}
+
+QVariant TestTimeEdit::value() const
+{
+ return q->time();
+}
+
+bool TestTimeEdit::canWrap(QObject *o)
+{ return qobject_cast<QTimeEdit*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testtimeedit.h b/plugins/qtuitest_widgets/qtwidgets/testtimeedit.h
new file mode 100644
index 0000000..d110958
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testtimeedit.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTTIMEEDIT_H
+#define TESTTIMEEDIT_H
+
+#include "testdatetimeedit.h"
+
+class QTimeEdit;
+
+namespace QtUiTest {
+
+class TestTimeEdit : public TestDateTimeEdit
+{
+ Q_OBJECT
+public:
+ TestTimeEdit(QObject*);
+
+ virtual QString text() const;
+ virtual QVariant value() const;
+
+ static bool canWrap(QObject*);
+
+private slots:
+ void onDateTimeChanged(QDateTime const&);
+
+private:
+ QTimeEdit *q;
+};
+
+}
+
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testtoolbar.cpp b/plugins/qtuitest_widgets/qtwidgets/testtoolbar.cpp
new file mode 100644
index 0000000..390ad00
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testtoolbar.cpp
@@ -0,0 +1,116 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testtoolbar.h"
+#include "testwidgetslog.h"
+
+#include <QToolBar>
+#include <QAction>
+
+namespace QtUiTest {
+
+TestToolBar::TestToolBar(QObject *_q)
+ : TestWidget(_q), q(qobject_cast<QToolBar*>(_q)), lastAction(0)
+{
+ // For accurate ordering of events recording, these connections
+ // must come before all others.
+// QtUiTest::connectFirst(q, SIGNAL(hovered(QAction*)),
+// this, SLOT(on_hovered(QAction*)));
+}
+
+QStringList TestToolBar::list() const
+{
+ QStringList ret;
+
+ /* Iterate through every action */
+ foreach( QAction *a, q->actions() ) {
+ if (!a->isVisible())
+ continue;
+ QString t = a->text();
+ t.replace("/","\\/");
+ if (!t.isEmpty()) ret << t;
+ }
+
+ return ret;
+}
+
+QRect TestToolBar::visualRect(QString const &item) const
+{
+//FIXME: Implement me
+ Q_UNUSED(item);
+ QRect ret;
+ return ret;
+}
+
+bool TestToolBar::ensureVisible(QString const&)
+{ return false; }
+
+QString TestToolBar::labelText() const
+{
+ return q->windowTitle();
+}
+
+QObject* TestToolBar::buddy() const
+{
+ return q;
+}
+
+bool TestToolBar::canSelect(QString const &item) const
+{
+ return list().contains(item);
+}
+
+bool TestToolBar::select(QString const &item)
+{
+//FIXME: Implement me
+ Q_UNUSED(item);
+ return false;
+}
+
+bool TestToolBar::hasFocus() const
+{
+ return q->hasFocus();
+}
+
+bool TestToolBar::canWrap(QObject *o)
+{ return qobject_cast<QToolBar*>(o); }
+
+}
diff --git a/plugins/qtuitest_widgets/qtwidgets/testtoolbar.h b/plugins/qtuitest_widgets/qtwidgets/testtoolbar.h
new file mode 100644
index 0000000..817b36e
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testtoolbar.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTTOOLBAR_H
+#define TESTTOOLBAR_H
+
+#include <testwidget.h>
+
+#include <QtGlobal>
+
+class QToolBar;
+class QAction;
+
+namespace QtUiTest {
+
+class TestToolBar : public TestWidget,
+ public QtUiTest::ListWidget, public QtUiTest::LabelWidget,
+ public QtUiTest::SelectWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::ListWidget
+ QtUiTest::LabelWidget
+ QtUiTest::SelectWidget)
+
+public:
+ TestToolBar(QObject*);
+
+ virtual QStringList list() const;
+ virtual QRect visualRect(QString const&) const;
+ virtual bool ensureVisible(QString const&);
+
+ virtual QString labelText() const;
+ virtual QObject* buddy() const;
+
+ virtual bool canSelect(const QString&) const;
+ virtual bool select(const QString&);
+
+ virtual bool hasFocus() const;
+
+ static bool canWrap(QObject*);
+
+signals:
+ void stateChanged(int);
+ void selected(const QString&);
+
+private:
+ QToolBar *q;
+ QAction *lastAction;
+};
+
+}
+
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testtreeview.cpp b/plugins/qtuitest_widgets/qtwidgets/testtreeview.cpp
new file mode 100644
index 0000000..9fc41b2
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testtreeview.cpp
@@ -0,0 +1,193 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testtreeview.h"
+#include "testwidgetslog.h"
+
+#include <QTreeView>
+
+#include <qtuitestnamespace.h>
+
+namespace QtUiTest {
+
+TestTreeView::TestTreeView(QObject *_q)
+ : TestAbstractItemView(_q), q(static_cast<QTreeView*>(_q))
+{
+}
+
+QString TestTreeView::selectedText() const
+{
+ TestWidgetsLog();
+
+ if (q->allColumnsShowFocus()) {
+ return selectedValue().toStringList().join(",");
+ }
+
+ return TestAbstractItemView::selectedText();
+}
+
+QVariant TestTreeView::selectedValue() const
+{
+ TestWidgetsLog();
+
+ if (q->allColumnsShowFocus()) {
+ QStringList columnText;
+ QModelIndex selectedIndex = q->currentIndex();
+
+ for (int i = 0, max_i = q->model()->columnCount(selectedIndex.parent()); i < max_i; ++i) {
+ if (q->isColumnHidden(i)) continue;
+ QModelIndex sibling(selectedIndex.sibling(selectedIndex.row(), i));
+ columnText << TestWidget::printable(sibling.data().toString());
+ }
+
+ return columnText;
+ }
+
+ return TestAbstractItemView::selectedText();
+}
+
+QStringList TestTreeView::list() const
+{
+ class QModelListGetter : public QModelViewIterator<QTreeView>
+ {
+ public:
+ QModelListGetter(QTreeView *view)
+ : QModelViewIterator<QTreeView>(view) {};
+
+ QStringList getList() {
+ list.clear();
+ iterate(view()->rootIndex(), view()->itemsExpandable());
+ return list;
+ }
+ protected:
+ virtual void visit(QModelIndex const &index)
+ {
+ if (index == view()->rootIndex() && !view()->rootIsDecorated()) {
+ return;
+ } else if (view()->isColumnHidden(index.column())) {
+ return;
+ }
+ list << itemForIndex(index);
+ }
+
+ virtual bool isRowHidden(int row, const QModelIndex& index)
+ {
+ return view()->isRowHidden(row, index);
+ }
+
+ virtual QString itemForIndex(QModelIndex const& index) const
+ {
+ QString ret = TestWidget::printable(index.data().toString());
+ ret.replace("/","\\\\/");
+
+ QModelIndex rootIndex = view()->rootIndex();
+ if (index.parent() != rootIndex) {
+ ret = itemForIndex(index.parent()) + "/" + ret;
+ }
+ return ret;
+ }
+ QStringList list;
+ };
+
+ return QModelListGetter(q).getList();
+}
+
+QModelIndex TestTreeView::indexForItem(QString const &item) const
+{
+ return indexForItem(q->rootIndex(), item);
+}
+
+QModelIndex TestTreeView::indexForItem(QModelIndex const &index, QString const &item) const
+{
+ QModelIndex ret;
+ static QRegExp slashRe("[^\\\\]/");
+
+ int ind;
+ if (0 != (ind = item.indexOf(slashRe)+1)) {
+ return indexForItem(indexForItem(index, item.left(ind)), item.mid(ind+1));
+ }
+
+ QString itemUnescaped(item);
+ itemUnescaped.replace("\\/", "/");
+
+ QAbstractItemModel *model = q->model();
+ int count = 0;
+
+ for (int i = 0, max_i = model->rowCount(index); i < max_i && count <= QTUITEST_MAX_LIST; ++i) {
+ if (q->isRowHidden(i, index)) continue;
+ for (int j = 0, max_j = model->columnCount(index); j < max_j && count <= QTUITEST_MAX_LIST; ++j) {
+ if (q->isColumnHidden(j)) continue;
+ if (model->hasIndex(i, j, index) && model->data(model->index(i, j, index)).toString() == itemUnescaped) {
+ if (ret.isValid()) {
+ qWarning("QtUitest: more than one item matches '%s' in item view", qPrintable(item));
+ return ret;
+ } else {
+ ret = model->index(i, j, index);
+ }
+ }
+ }
+ }
+
+ return ret;
+}
+
+bool TestTreeView::ensureVisible(QModelIndex const &index)
+{
+ if (!index.isValid()) return false;
+
+ if (q->itemsExpandable() && !q->isExpanded(index.parent())) {
+ ensureVisible(index.parent());
+ //FIXME: Should expand using mouse/key clicks
+ q->setExpanded(index.parent(), true);
+ }
+
+ return TestAbstractItemView::ensureVisible(index);
+}
+
+bool TestTreeView::canSelect(QString const &item) const
+{
+ return indexForItem(item).isValid();
+}
+
+bool TestTreeView::canWrap(QObject* o)
+{ return qobject_cast<QTreeView*>(o); }
+
+}
diff --git a/plugins/qtuitest_widgets/qtwidgets/testtreeview.h b/plugins/qtuitest_widgets/qtwidgets/testtreeview.h
new file mode 100644
index 0000000..fd6632a
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testtreeview.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTTREEVIEW_H
+#define TESTTREEVIEW_H
+
+#include "testabstractitemview.h"
+
+class QTreeView;
+
+namespace QtUiTest {
+
+class TestTreeView : public TestAbstractItemView
+{
+ Q_OBJECT
+
+public:
+ TestTreeView(QObject*);
+
+ virtual QString selectedText() const;
+ virtual QVariant selectedValue() const;
+ virtual QStringList list() const;
+ virtual bool canSelect(QString const&) const;
+ static bool canWrap(QObject*);
+
+protected:
+ virtual QModelIndex indexForItem(QString const&) const;
+ QModelIndex indexForItem(QModelIndex const&, QString const&) const;
+ virtual bool ensureVisible(QModelIndex const&);
+
+private:
+ QTreeView *q;
+};
+
+}
+
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testtreewidget.cpp b/plugins/qtuitest_widgets/qtwidgets/testtreewidget.cpp
new file mode 100644
index 0000000..e011b0a
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testtreewidget.cpp
@@ -0,0 +1,212 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testtreewidget.h"
+#include "testwidgetslog.h"
+
+#include <QTreeWidget>
+
+#include <qtuitestnamespace.h>
+
+namespace QtUiTest {
+
+TestTreeWidget::TestTreeWidget(QObject *_q)
+ : TestTreeView(_q), q(static_cast<QTreeWidget*>(_q))
+{
+}
+
+QStringList TestTreeWidget::list() const
+{
+ QStringList ret;
+ QTreeWidgetItemIterator it(q);
+ while (*it) {
+ for (int i=0; i<q->columnCount(); ++i) {
+ QtUiTest::ListWidget *lw = qtuitest_cast<QtUiTest::ListWidget*>(q->itemWidget(*it, i));
+ if (lw) {
+ QStringList widgetList = lw->list();
+ QString parent = itemName((*it)->parent(), i);
+ foreach (QString s, widgetList) {
+ ret << parent + "/" + s;
+ }
+ } else {
+ ret << itemName((*it), i);
+ }
+ }
+ ++it;
+ }
+
+ return ret;
+}
+
+QString TestTreeWidget::itemName(QTreeWidgetItem *item, int column) const
+{
+ QString ret;
+ if (!item) return ret;
+ ret = item->text(column);
+ if (item->parent() && item->parent() != q->invisibleRootItem()) {
+ return itemName(item->parent(), 0) + "/" + ret;
+ }
+
+ return ret;
+}
+
+QTreeWidgetItem *TestTreeWidget::itemLookup(QTreeWidgetItem *parent, QString const &name) const
+{
+ QTreeWidgetItem *ret = 0;
+
+ for (int i=0, childCount = parent->childCount(); i < childCount; ++i) {
+ QTreeWidgetItem *item = parent->child(i);
+ for (int j=0, colCount = q->columnCount(); j < colCount; ++j) {
+ if (item->text(j) == name) {
+ return item;
+ }
+ }
+ }
+
+ return ret;
+}
+
+QWidget *TestTreeWidget::itemWidgetLookup(QString const &name, QTreeWidgetItem *parent, QString &remainder) const
+{
+ static QRegExp slashRe("[^\\\\]/");
+ int ind;
+ QString top = name;
+ if ((ind = name.indexOf(slashRe)+1)) {
+ top = name.left(ind);
+ }
+
+ QTreeWidgetItem *widgetItem = itemLookup(parent, top);
+ if (widgetItem == 0) {
+ remainder = name;
+ for (int i=0, colCount = q->columnCount(); i < colCount; ++i) {
+ QWidget *iw = q->itemWidget(parent->child(i), 0);
+ if (iw) {
+ QtUiTest::ListWidget *lw = qtuitest_cast<QtUiTest::ListWidget*>(iw);
+ QStringList widgetList = lw->list();
+ if (widgetList.contains(remainder)) {
+ return iw;
+ }
+ }
+ }
+ return 0;
+ } else {
+ if (!widgetItem->isExpanded()) {
+ widgetItem->setExpanded(true);
+ }
+ return itemWidgetLookup(name.mid(ind+1), widgetItem, remainder);
+ }
+}
+
+bool TestTreeWidget::select(QString const &item)
+{
+ if (!canSelect(item)) {
+ TestWidgetsLog() << "can't select" << item;
+ return false;
+ }
+
+ QModelIndex index = indexForItem(item);
+ if (index.isValid()) {
+ return TestAbstractItemView::select(index);
+ }
+
+ QString remainder;
+ QWidget *w = itemWidgetLookup(item, q->invisibleRootItem(), remainder);
+ QtUiTest::Widget *qw = qtuitest_cast<QtUiTest::Widget*>(w);
+ QtUiTest::ListWidget *lw = qtuitest_cast<QtUiTest::ListWidget*>(w);
+ qw->ensureVisibleRegion(lw->visualRect(remainder));
+ QtUiTest::SelectWidget *sw = qtuitest_cast<QtUiTest::SelectWidget*>(w);
+ if (sw) {
+ return sw->select(remainder);
+ }
+
+ return false;
+}
+
+bool TestTreeWidget::ensureVisible(QString const &item)
+{
+ if (!canSelect(item)) {
+ TestWidgetsLog() << "can't select" << item;
+ return false;
+ }
+
+ QModelIndex index = indexForItem(item);
+ if (index.isValid()) {
+ return TestAbstractItemView::ensureVisible(index);
+ }
+
+ QString remainder;
+ QWidget *w = itemWidgetLookup(item, q->invisibleRootItem(), remainder);
+ QtUiTest::Widget *qw = qtuitest_cast<QtUiTest::Widget*>(w);
+ QtUiTest::ListWidget *lw = qtuitest_cast<QtUiTest::ListWidget*>(w);
+ return qw->ensureVisibleRegion(lw->visualRect(remainder));
+}
+
+QRect TestTreeWidget::visualRect(QString const &item) const
+{
+ QRect ret;
+
+ QModelIndex index = indexForItem(item);
+
+ if (index.isValid()) {
+ return q->visualRect(index);
+ } else {
+ QString remainder;
+ QWidget *w = itemWidgetLookup(item, q->invisibleRootItem(), remainder);
+ QtUiTest::ListWidget *lw = qtuitest_cast<QtUiTest::ListWidget*>(w);
+ if (lw) {
+ QRect rect = lw->visualRect(remainder);
+ rect.moveTopLeft( q->mapFromGlobal( w->mapToGlobal( rect.topLeft() ) ) );
+ return rect;
+ }
+ }
+
+ return ret;
+}
+
+bool TestTreeWidget::canSelect(QString const &item) const
+{
+ return list().contains(item);
+}
+
+bool TestTreeWidget::canWrap(QObject* o)
+{ return qobject_cast<QTreeWidget*>(o); }
+
+}
diff --git a/plugins/qtuitest_widgets/qtwidgets/testtreewidget.h b/plugins/qtuitest_widgets/qtwidgets/testtreewidget.h
new file mode 100644
index 0000000..292362c
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testtreewidget.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTTREEWIDGET_H
+#define TESTTREEWIDGET_H
+
+#include "testtreeview.h"
+
+class QTreeWidget;
+class QTreeWidgetItem;
+
+namespace QtUiTest {
+
+class TestTreeWidget : public TestTreeView
+{
+ Q_OBJECT
+
+public:
+ TestTreeWidget(QObject*);
+
+ virtual QRect visualRect(QString const&) const;
+ virtual QStringList list() const;
+ virtual bool canSelect(QString const&) const;
+ virtual bool select(QString const&);
+ virtual bool ensureVisible(QString const&);
+ static bool canWrap(QObject*);
+
+protected:
+ QString itemName(QTreeWidgetItem *item, int column) const;
+ QTreeWidgetItem *itemLookup(QTreeWidgetItem *parent, QString const &name) const;
+ QWidget *itemWidgetLookup(QString const &name, QTreeWidgetItem *parent, QString &remainder) const;
+
+private:
+ QTreeWidget *q;
+};
+
+}
+
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testwebview.cpp b/plugins/qtuitest_widgets/qtwidgets/testwebview.cpp
new file mode 100644
index 0000000..101287c
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testwebview.cpp
@@ -0,0 +1,188 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testwebview.h"
+#include "testwidgetslog.h"
+
+#include <QWebView>
+#include <QWebPage>
+#include <QWebFrame>
+#include <QWebElementCollection>
+
+namespace QtUiTest {
+
+TestWebView::TestWebView(QObject *_q)
+ : TestWidget(_q), m_progress(0.0), q(qobject_cast<QWebView*>(_q))
+{
+ connect(q->page(), SIGNAL(loadProgress(int)), this, SLOT(on_progress(int)));
+}
+
+QString TestWebView::text() const
+{
+ QWebPage *page = q->page();
+ if (page && page->mainFrame()) {
+ return page->mainFrame()->toPlainText();
+ }
+ return QString();
+}
+
+QString TestWebView::selectedText() const
+{
+ return q->selectedText();
+}
+
+QStringList TestWebView::list() const
+{
+ QStringList ret;
+
+ QWebPage *page = q->page();
+ if (page && page->mainFrame()) {
+ QWebElementCollection links = page->mainFrame()->findAllElements("a[href]");
+ foreach (QWebElement el, links) {
+ QString str = TestWidget::printable(el.toPlainText());
+ if (!str.isEmpty()) ret << str;
+ }
+ }
+ return ret;
+}
+
+QWebElement TestWebView::elementForItem(QString const &item) const
+{
+ QWebElement ret;
+ QWebPage *page = q->page();
+ if (page && page->mainFrame()) {
+ QWebElementCollection links = page->mainFrame()->findAllElements("a[href]");
+ foreach (QWebElement el, links) {
+ if (TestWidget::printable(el.toPlainText()) == item) {
+ ret = el;
+ break;
+ }
+ }
+ }
+ return ret;
+}
+
+QRect TestWebView::visualRect(QString const &item) const
+{
+ return visualRect(elementForItem(item));
+}
+
+QRect TestWebView::visualRect(QWebElement const &el) const
+{
+ QRect ret;
+ if (!el.isNull()) {
+ ret = el.geometry();
+ ret.translate(el.webFrame()->geometry().topLeft()-el.webFrame()->scrollPosition());
+ }
+ return ret;
+}
+
+bool TestWebView::canSelect(QString const &item) const
+{ return list().contains(item); }
+
+bool TestWebView::select(QString const &item)
+{
+ QWebElement el(elementForItem(item));
+ if (el.isNull()) return false;
+
+ QRect rect = visualRect(el);
+ QPoint pos = rect.center();
+ QRect geometry = q->visibleRegion().boundingRect(); //q->geometry();
+ QWebFrame *frame = el.webFrame();
+ QRect horizScroll = frame->scrollBarGeometry(Qt::Horizontal);
+ QRect vertScroll = frame->scrollBarGeometry(Qt::Vertical);
+ if (!horizScroll.isEmpty()) {
+ geometry.setBottom(horizScroll.top()-1);
+ }
+ if (!vertScroll.isEmpty()) {
+ geometry.setRight(vertScroll.left()-1);
+ }
+
+ if (!geometry.contains(pos, true)) {
+ //TODO: Is there a way to get the scrollbar up/down buttons? The scrollbar is
+ // not a QScrollBar. For now, use the API to scroll.
+
+ // Scroll vertically
+ if (geometry.bottom() < rect.bottom()) {
+ frame->scroll(0, rect.bottom() - geometry.bottom() + geometry.height()/2);
+ } else if (geometry.top() > rect.top()) {
+ frame->scroll(0, rect.top() - geometry.top() - geometry.height()/2);
+ }
+
+ // Scroll horizontally
+ if (geometry.right() < pos.x()) {
+ frame->scroll(rect.right() - geometry.right(), 0);
+ } else if (geometry.left() > pos.x()) {
+ frame->scroll(rect.left() - geometry.left(), 0);
+ }
+
+ pos = visualRect(el).center();
+ }
+
+ QtUiTest::mouseClick(q->mapToGlobal(pos), Qt::LeftButton);
+ waitForSignal(q, SIGNAL(linkClicked(QUrl)));
+ return true;
+}
+
+void TestWebView::on_progress(int p)
+{
+ if (m_progress == p/100.0)
+ return;
+ m_progress = p/100.0;
+}
+
+QVariant TestWebView::getProperty(const QString& name) const
+{
+ QVariant ret;
+
+ if (name.toUpper() == "PROGRESS") {
+ ret = m_progress;
+ } else {
+ ret = q->property(name.toLatin1());
+ }
+
+ return ret;
+}
+
+bool TestWebView::canWrap(QObject *o)
+{ return qobject_cast<QWebView*>(o); }
+
+} \ No newline at end of file
diff --git a/plugins/qtuitest_widgets/qtwidgets/testwebview.h b/plugins/qtuitest_widgets/qtwidgets/testwebview.h
new file mode 100644
index 0000000..78cfec0
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testwebview.h
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTWEBVIEW_H
+#define TESTWEBVIEW_H
+
+#include <testwidget.h>
+
+class QWebView;
+class QWebElement;
+
+namespace QtUiTest {
+
+class TestWebView : public TestWidget,
+ public QtUiTest::TextWidget,
+ public QtUiTest::ListWidget,
+ public QtUiTest::SelectWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::TextWidget
+ QtUiTest::ListWidget
+ QtUiTest::SelectWidget)
+
+public:
+ TestWebView(QObject*);
+
+ virtual QString text() const;
+ virtual QString selectedText() const;
+
+ virtual QStringList list() const;
+ virtual QRect visualRect(QString const&) const;
+
+ virtual bool canSelect(QString const&) const;
+ virtual bool select(QString const&);
+
+ virtual QVariant getProperty(const QString&) const;
+
+ static bool canWrap(QObject*);
+
+protected:
+ QWebElement elementForItem(QString const&) const;
+ virtual QRect visualRect(QWebElement const&) const;
+
+private slots:
+ void on_progress(int);
+
+private:
+ qreal m_progress;
+ QWebView *q;
+};
+
+}
+
+#endif
+
diff --git a/plugins/qtuitest_widgets/qtwidgets/testwidgetslog.h b/plugins/qtuitest_widgets/qtwidgets/testwidgetslog.h
new file mode 100644
index 0000000..01d2efe
--- /dev/null
+++ b/plugins/qtuitest_widgets/qtwidgets/testwidgetslog.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTWIDGETSLOG_H
+#define TESTWIDGETSLOG_H
+
+#include <QApplication>
+#include <QStringList>
+
+#include <QDebug>
+#define qLog(A) if (1); else qDebug() << #A
+
+/*
+ This header provides a slight convenience layer on top of qLog.
+
+ By using the TestWidgetsLog macro in the same way qLog would normally be used,
+ a log message will be output which automatically includes the name of the current
+ function.
+*/
+
+namespace TestWidgetsLogImpl
+{
+ /*
+ Returns a log header to be output at the beginning of each TestWidgetsLog.
+ */
+ inline QByteArray header(char const*,int,char const* function)
+ {
+ QString ret = qApp->applicationName();
+
+ // Extract just the name of the function (discard return type and arguments)
+ QString id;
+ QStringList l1 = QString(function).split(" ");
+ QStringList l2 = l1.filter("(");
+ if (l2.count()) id = l2.at(0);
+ else id = l1.at(0);
+ if (id.contains("(")) id = id.left(id.indexOf("("));
+
+ ret += " " + id;
+
+ return ret.toLocal8Bit();
+ }
+};
+
+#define TestWidgetsLog() qLog(QtUitestWidgets) << TestWidgetsLogImpl::header(__FILE__,__LINE__,Q_FUNC_INFO).constData()
+
+#endif
+
diff --git a/plugins/styles/qtuitest/qtuitest.pro b/plugins/styles/qtuitest/qtuitest.pro
new file mode 100644
index 0000000..64bf059
--- /dev/null
+++ b/plugins/styles/qtuitest/qtuitest.pro
@@ -0,0 +1,41 @@
+TEMPLATE=lib
+CONFIG+=plugin
+SOURCES+=style.cpp
+HEADERS+=style.h
+TARGET=qtuiteststyle
+TARGET=$$qtLibraryTarget($$TARGET)
+QT+=network
+INCLUDEPATH+=$$SRCROOT/libqtslave
+INCLUDEPATH+=$$SRCROOT/libqtuitest
+INCLUDEPATH+=$$SRCROOT
+DEPENDPATH+=$$SRCROOT
+
+unix:!symbian {
+ MOC_DIR=$$OUT_PWD/.moc
+ OBJECTS_DIR=$$OUT_PWD/.obj
+ target.path=$$[QT_INSTALL_PLUGINS]/styles
+ INSTALLS+=target
+ LIBS+=-L$$BUILDROOT/lib -lqtslave -lqtuitest
+}
+
+symbian {
+ TARGET.EPOCALLOWDLLDATA=1
+ TARGET.CAPABILITY += AllFiles ReadDeviceData ReadUserData SwEvent WriteUserData NetworkServices
+ MOC_DIR=$$OUT_PWD/moc
+ OBJECTS_DIR=$$OUT_PWD/obj
+ LIBS+=-lqtuitest.lib -lqtslave.lib -lws32 -leuser -lcone
+}
+
+mac {
+ LIBS+=-L$$BUILDROOT/lib -lqtslave -lqtuitest
+ target.path=$$[QT_INSTALL_PLUGINS]/styles
+ INSTALLS+=target
+}
+
+win32 {
+ CONFIG(debug,debug|release): LIBS+=-L$$BUILDROOT/libqtuitest -L$$BUILDROOT/libqtslave/debug -lqtuitestd -lqtslaved
+ CONFIG(release,debug|release):LIBS+=-L$$BUILDROOT/libqtuitest -L$$BUILDROOT/libqtslave/release -lqtuitest -lqtslave
+ target.path=$$[QT_INSTALL_PLUGINS]/styles
+ INSTALLS+=target
+}
+
diff --git a/plugins/styles/qtuitest/style.cpp b/plugins/styles/qtuitest/style.cpp
new file mode 100644
index 0000000..8ec1f3a
--- /dev/null
+++ b/plugins/styles/qtuitest/style.cpp
@@ -0,0 +1,235 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QWidget>
+#include <QDebug>
+#include <qtestslave.h>
+#include "style.h"
+#include <QCoreApplication>
+#ifdef Q_OS_SYMBIAN
+# include <QS60Style>
+# include <sys/socket.h>
+# include <net/if.h>
+#elif defined Q_OS_MAC
+# include <QMacStyle>
+#endif
+
+#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
+extern Q_GUI_EXPORT bool qt_use_native_dialogs;
+#endif
+
+struct TestSlaveServer : public QTcpServer
+{
+ TestSlaveServer()
+ : QTcpServer(), showDebug(false), started(false)
+ {
+ }
+
+ ~TestSlaveServer()
+ {
+ close();
+ }
+
+ void incomingConnection(int sd)
+ { slave.setSocket(sd); }
+
+ void startService();
+ void stopService();
+
+
+ QTestSlave slave;
+ bool showDebug;
+ bool started;
+};
+
+Q_GLOBAL_STATIC(TestSlaveServer, testSlaveServer);
+
+
+void TestSlaveServer::startService()
+{
+ short aut_port = DEFAULT_AUT_PORT;
+ bool parseOk;
+ bool setAutPort = false;
+ QStringList args = QCoreApplication::arguments();
+ QByteArray autPortEnvBa = qgetenv("QTUITEST_PORT");
+ QString autPortEnv = QString(autPortEnvBa);
+ QByteArray debugEnvBa = qgetenv("QTUITEST_DEBUG");
+ QString debugEnv = QString(debugEnvBa);
+
+
+#ifndef QTUITEST_DEBUG
+ int debugValue = debugEnv.toInt(&parseOk);
+ if (parseOk && (debugValue > 0))
+ showDebug = true;
+#else
+ showDebug = true;
+#endif
+
+ if (showDebug)
+ qWarning("QtUiTest: Start service");
+
+ for (int index = 0; index < args.count(); index++){
+ if (args[index].endsWith("qtuitestrunner")){
+ if (showDebug)
+ qWarning() << "QtUiTest: Not starting TestSlaveServer::startService for qtuitestrunner";
+ return;
+ }
+ }
+
+ if (started){
+ if (showDebug)
+ qWarning() << "QtUiTest: Closing TestSlaveServer connection";
+
+ close();
+ }
+ if (!autPortEnv.isEmpty()){
+ aut_port = autPortEnv.toUShort(&parseOk);
+ if (!parseOk){
+ aut_port = DEFAULT_AUT_PORT;
+ qWarning() << "QtUiTest: Unable to parse QTUITEST_PORT" << autPortEnv;
+ }else{
+ setAutPort = true;
+ if (showDebug)
+ qWarning() << "QtUiTest: Set port via QTUITEST_PORT to" << aut_port;
+ }
+ }
+ for (int index = 0; index < args.count(); index++){
+ if ((args[index] == QLatin1String("-autport")) && (index + 1 < args.count())){
+ aut_port = args[index + 1].toUShort(&parseOk);
+ if (!parseOk){
+ aut_port = DEFAULT_AUT_PORT;
+ qWarning() << "QtUiTest: Unable to parse -autport" << args[index];
+ }else{
+ setAutPort = true;
+ if (showDebug)
+ qWarning() << "QtUiTest: Set port via -autport to" << aut_port;
+ }
+ }
+ }
+
+ if (!listen(QHostAddress::Any, aut_port)) {
+ qWarning() << "QtUiTest: couldn't listen for connections on " << aut_port << " :"
+ << errorString() << " started :" << started;
+ started = false;
+ close();
+ }else {
+ started = true;
+ if (showDebug)
+ qWarning() << "QtUiTest: listening for connections on" << aut_port;
+ }
+}
+
+void TestSlaveServer::stopService()
+{
+ if (showDebug)
+ qWarning("QtUiTest : Stoping service");
+
+ close();
+ started = false;
+}
+
+QtUiTestStylePlugin::~QtUiTestStylePlugin()
+{
+ testSlaveServer()->stopService();
+}
+
+void QtUiTestStylePlugin::initSlave()
+{
+#ifdef Q_OS_SYMBIAN
+ struct ifreq ifReq;
+ strcpy( ifReq.ifr_name, "qtuitest");
+ int err = setdefaultif( &ifReq );
+#endif
+
+ testSlaveServer()->startService();
+
+#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
+ // Use QFileDialog instead of native OS file dialog
+ qt_use_native_dialogs = false;
+#endif
+
+#ifdef Q_OS_MAC
+ QTimer::singleShot(200, this, SLOT(raiseWindow()));
+#endif
+}
+
+QStringList QtUiTestStylePlugin::keys() const
+{
+ return QStringList() << "QtUiTest";
+}
+
+QStyle *QtUiTestStylePlugin::create(const QString &key)
+{
+ static bool initialised = false;
+
+ if (key.toLower() == "qtuitest" && !initialised) {
+ initSlave();
+ initialised = true;
+#ifdef Q_OS_SYMBIAN
+ return new QS60Style();
+#elif defined Q_WS_MAC
+ return new QMacStyle();
+#else
+ return qApp->style();
+#endif
+ }
+ return 0;
+}
+
+void QtUiTestStylePlugin::raiseWindow()
+{
+ QWidget *aw = qApp->activeWindow();
+ if (!aw) {
+ bool found = false;
+ foreach (QWidget *w, qApp->topLevelWidgets()) {
+ if (w->isVisible()) {
+ found = true;
+ w->raise();
+ break;
+ }
+ }
+ if (!found) qWarning() << "no visible window";
+ }
+}
+
+#include <qplugin.h>
+Q_EXPORT_PLUGIN2(QtUiTestStylePlugin, QtUiTestStylePlugin)
diff --git a/plugins/styles/qtuitest/style.h b/plugins/styles/qtuitest/style.h
new file mode 100644
index 0000000..29e0ff1
--- /dev/null
+++ b/plugins/styles/qtuitest/style.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtGui>
+#include "qtuitest_config.h"
+
+class QtUiTestStylePlugin : public QStylePlugin
+{
+ Q_OBJECT
+
+public:
+ QtUiTestStylePlugin() {};
+ virtual ~QtUiTestStylePlugin();
+
+ QStringList keys() const;
+ QStyle *create(const QString &key);
+
+public slots:
+ void raiseWindow();
+
+protected:
+ void initSlave();
+};
diff --git a/plugins/styles/styles.pro b/plugins/styles/styles.pro
new file mode 100644
index 0000000..3b4bbb8
--- /dev/null
+++ b/plugins/styles/styles.pro
@@ -0,0 +1,3 @@
+TEMPLATE=subdirs
+SUBDIRS=\
+ qtuitest
diff --git a/qtbindings/README b/qtbindings/README
new file mode 100644
index 0000000..af3cf41
--- /dev/null
+++ b/qtbindings/README
@@ -0,0 +1,13 @@
+==== QT BINDINGS FOR QTSCRIPT =================================================
+
+ QtUiTest requires Qt bindings for QtScript, to allow certain Qt classes
+ (such as QTime) to be used in QtUiTest test scripts.
+
+ The bindings have been generated using the QtScript Bindings Generator,
+ which can be downloaded from:
+
+ http://qt.gitorious.org/qt-labs/qtscriptgenerator
+
+ Some modifications have been made to the generated code, including the addition
+ of license headers, removal of some classes not supported on all platforms,
+ and other minor changes.
diff --git a/qtbindings/com_nokia_qt_core/com_nokia_qt_core.pri b/qtbindings/com_nokia_qt_core/com_nokia_qt_core.pri
new file mode 100644
index 0000000..841352a
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/com_nokia_qt_core.pri
@@ -0,0 +1,136 @@
+HEADERS += \
+ $$PWD/qtscriptshell_QAbstractItemModel.h \
+ $$PWD/qtscriptshell_QAbstractListModel.h \
+ $$PWD/qtscriptshell_QAbstractTableModel.h \
+ $$PWD/qtscriptshell_QBuffer.h \
+ $$PWD/qtscriptshell_QChildEvent.h \
+ $$PWD/qtscriptshell_QCoreApplication.h \
+ $$PWD/qtscriptshell_QDataStream.h \
+ $$PWD/qtscriptshell_QDirIterator.h \
+ $$PWD/qtscriptshell_QEvent.h \
+ $$PWD/qtscriptshell_QEventLoop.h \
+ $$PWD/qtscriptshell_QFile.h \
+ $$PWD/qtscriptshell_QFileSystemWatcher.h \
+ $$PWD/qtscriptshell_QIODevice.h \
+ $$PWD/qtscriptshell_QMimeData.h \
+ $$PWD/qtscriptshell_QObject.h \
+ $$PWD/qtscriptshell_QProcess.h \
+ $$PWD/qtscriptshell_QRunnable.h \
+ $$PWD/qtscriptshell_QSettings.h \
+ $$PWD/qtscriptshell_QSignalMapper.h \
+ $$PWD/qtscriptshell_QSocketNotifier.h \
+ $$PWD/qtscriptshell_QTemporaryFile.h \
+ $$PWD/qtscriptshell_QTextCodec.h \
+ $$PWD/qtscriptshell_QTextCodecPlugin.h \
+ $$PWD/qtscriptshell_QTextStream.h \
+ $$PWD/qtscriptshell_QThreadPool.h \
+ $$PWD/qtscriptshell_QTimeLine.h \
+ $$PWD/qtscriptshell_QTimer.h \
+ $$PWD/qtscriptshell_QTimerEvent.h \
+ $$PWD/qtscriptshell_QTranslator.h \
+ $$PWD/qtscriptshell_QUuid.h \
+ $$PWD/qtscriptshell_QXmlStreamAttributes.h \
+ $$PWD/qtscriptshell_QXmlStreamEntityResolver.h \
+
+SOURCES += \
+ $$PWD/qtscript_QAbstractItemModel.cpp \
+ $$PWD/qtscript_QAbstractListModel.cpp \
+ $$PWD/qtscript_QAbstractTableModel.cpp \
+ $$PWD/qtscript_QBasicTimer.cpp \
+ $$PWD/qtscript_QBitArray.cpp \
+ $$PWD/qtscript_QBuffer.cpp \
+ $$PWD/qtscript_QByteArray.cpp \
+ $$PWD/qtscript_QByteArrayMatcher.cpp \
+ $$PWD/qtscript_QChildEvent.cpp \
+ $$PWD/qtscript_QCoreApplication.cpp \
+ $$PWD/qtscript_QCryptographicHash.cpp \
+ $$PWD/qtscript_QDataStream.cpp \
+ $$PWD/qtscript_QDir.cpp \
+ $$PWD/qtscript_QDirIterator.cpp \
+ $$PWD/qtscript_QDynamicPropertyChangeEvent.cpp \
+ $$PWD/qtscript_QEvent.cpp \
+ $$PWD/qtscript_QEventLoop.cpp \
+ $$PWD/qtscript_QFile.cpp \
+ $$PWD/qtscript_QFileInfo.cpp \
+ $$PWD/qtscript_QFileSystemWatcher.cpp \
+ $$PWD/qtscript_QIODevice.cpp \
+ $$PWD/qtscript_QLibraryInfo.cpp \
+ $$PWD/qtscript_QLocale.cpp \
+ $$PWD/qtscript_QMimeData.cpp \
+ $$PWD/qtscript_QModelIndex.cpp \
+ $$PWD/qtscript_QMutex.cpp \
+ $$PWD/qtscript_QObject.cpp \
+ $$PWD/qtscript_QPersistentModelIndex.cpp \
+ $$PWD/qtscript_QPoint.cpp \
+ $$PWD/qtscript_QPointF.cpp \
+ $$PWD/qtscript_QProcess.cpp \
+ $$PWD/qtscript_QRect.cpp \
+ $$PWD/qtscript_QRectF.cpp \
+ $$PWD/qtscript_QRunnable.cpp \
+ $$PWD/qtscript_QSemaphore.cpp \
+ $$PWD/qtscript_QSettings.cpp \
+ $$PWD/qtscript_QSignalMapper.cpp \
+ $$PWD/qtscript_QSize.cpp \
+ $$PWD/qtscript_QSizeF.cpp \
+ $$PWD/qtscript_QSocketNotifier.cpp \
+ $$PWD/qtscript_QStringMatcher.cpp \
+ $$PWD/qtscript_QSystemSemaphore.cpp \
+ $$PWD/qtscript_QTemporaryFile.cpp \
+ $$PWD/qtscript_QTextBoundaryFinder.cpp \
+ $$PWD/qtscript_QTextCodec.cpp \
+ $$PWD/qtscript_QTextCodecPlugin.cpp \
+ $$PWD/qtscript_QTextDecoder.cpp \
+ $$PWD/qtscript_QTextEncoder.cpp \
+ $$PWD/qtscript_QTextStream.cpp \
+ $$PWD/qtscript_QThreadPool.cpp \
+ $$PWD/qtscript_QTime.cpp \
+ $$PWD/qtscript_QTimeLine.cpp \
+ $$PWD/qtscript_QTimer.cpp \
+ $$PWD/qtscript_QTimerEvent.cpp \
+ $$PWD/qtscript_QTranslator.cpp \
+ $$PWD/qtscript_QUrl.cpp \
+ $$PWD/qtscript_QUuid.cpp \
+ $$PWD/qtscript_QWaitCondition.cpp \
+ $$PWD/qtscript_QXmlStreamAttribute.cpp \
+ $$PWD/qtscript_QXmlStreamAttributes.cpp \
+ $$PWD/qtscript_QXmlStreamEntityDeclaration.cpp \
+ $$PWD/qtscript_QXmlStreamEntityResolver.cpp \
+ $$PWD/qtscript_QXmlStreamNamespaceDeclaration.cpp \
+ $$PWD/qtscript_QXmlStreamNotationDeclaration.cpp \
+ $$PWD/qtscript_QXmlStreamReader.cpp \
+ $$PWD/qtscript_QXmlStreamWriter.cpp \
+ $$PWD/qtscript_Qt.cpp \
+ $$PWD/qtscriptshell_QAbstractItemModel.cpp \
+ $$PWD/qtscriptshell_QAbstractListModel.cpp \
+ $$PWD/qtscriptshell_QAbstractTableModel.cpp \
+ $$PWD/qtscriptshell_QBuffer.cpp \
+ $$PWD/qtscriptshell_QChildEvent.cpp \
+ $$PWD/qtscriptshell_QCoreApplication.cpp \
+ $$PWD/qtscriptshell_QDataStream.cpp \
+ $$PWD/qtscriptshell_QDirIterator.cpp \
+ $$PWD/qtscriptshell_QEvent.cpp \
+ $$PWD/qtscriptshell_QEventLoop.cpp \
+ $$PWD/qtscriptshell_QFile.cpp \
+ $$PWD/qtscriptshell_QFileSystemWatcher.cpp \
+ $$PWD/qtscriptshell_QIODevice.cpp \
+ $$PWD/qtscriptshell_QMimeData.cpp \
+ $$PWD/qtscriptshell_QObject.cpp \
+ $$PWD/qtscriptshell_QProcess.cpp \
+ $$PWD/qtscriptshell_QRunnable.cpp \
+ $$PWD/qtscriptshell_QSettings.cpp \
+ $$PWD/qtscriptshell_QSignalMapper.cpp \
+ $$PWD/qtscriptshell_QSocketNotifier.cpp \
+ $$PWD/qtscriptshell_QTemporaryFile.cpp \
+ $$PWD/qtscriptshell_QTextCodec.cpp \
+ $$PWD/qtscriptshell_QTextCodecPlugin.cpp \
+ $$PWD/qtscriptshell_QTextStream.cpp \
+ $$PWD/qtscriptshell_QThreadPool.cpp \
+ $$PWD/qtscriptshell_QTimeLine.cpp \
+ $$PWD/qtscriptshell_QTimer.cpp \
+ $$PWD/qtscriptshell_QTimerEvent.cpp \
+ $$PWD/qtscriptshell_QTranslator.cpp \
+ $$PWD/qtscriptshell_QUuid.cpp \
+ $$PWD/qtscriptshell_QXmlStreamAttributes.cpp \
+ $$PWD/qtscriptshell_QXmlStreamEntityResolver.cpp \
+
+
diff --git a/qtbindings/com_nokia_qt_core/main.cpp b/qtbindings/com_nokia_qt_core/main.cpp
new file mode 100644
index 0000000..885dac5
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/main.cpp
@@ -0,0 +1,357 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptExtensionPlugin>
+#include <QtScript/QScriptValue>
+#include <QtScript/QScriptEngine>
+#include <QtCore/QDebug>
+
+#include <qtextboundaryfinder.h>
+#include <qxmlstream.h>
+#include <qbytearraymatcher.h>
+#include <qnamespace.h>
+#include <qpoint.h>
+#include <qdatastream.h>
+#include <qrect.h>
+#include <qsize.h>
+#include <qrunnable.h>
+#include <qmutex.h>
+#include <qxmlstream.h>
+#include <qxmlstream.h>
+#include <qlibraryinfo.h>
+#include <qpoint.h>
+#include <qurl.h>
+#include <qtextcodec.h>
+#include <qstringmatcher.h>
+#include <qxmlstream.h>
+#include <qcoreevent.h>
+#include <qdiriterator.h>
+#include <qxmlstream.h>
+#include <qabstractitemmodel.h>
+#include <qobject.h>
+#include <qwaitcondition.h>
+#include <qxmlstream.h>
+#include <qsystemsemaphore.h>
+#include <qdatetime.h>
+#include <qlocale.h>
+#include <qrect.h>
+#include <qxmlstream.h>
+#include <qbasictimer.h>
+#include <qtextcodec.h>
+#include <qcryptographichash.h>
+#include <qabstractitemmodel.h>
+#include <quuid.h>
+#include <qdir.h>
+#include <qbitarray.h>
+#include <qtextcodec.h>
+#include <qsize.h>
+#include <qtextstream.h>
+#include <qbytearray.h>
+#include <qsemaphore.h>
+#include <qfileinfo.h>
+#include <qxmlstream.h>
+#include <qsocketnotifier.h>
+#include <qcoreapplication.h>
+#include <qeventloop.h>
+#include <qcoreevent.h>
+#include <qsettings.h>
+#include <qcoreevent.h>
+#include <qiodevice.h>
+#include <qabstractitemmodel.h>
+#include <qtimer.h>
+#include <qsignalmapper.h>
+#include <qmimedata.h>
+#include <qcoreevent.h>
+#include <qtextcodecplugin.h>
+#include <qthreadpool.h>
+#include <qtranslator.h>
+#include <qfilesystemwatcher.h>
+#include <qtimeline.h>
+#include <qabstractitemmodel.h>
+#include <qprocess.h>
+#include <qbuffer.h>
+#include <qfile.h>
+#include <qabstractitemmodel.h>
+#include <qtemporaryfile.h>
+
+QScriptValue qtscript_create_QTextBoundaryFinder_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QXmlStreamEntityDeclaration_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QByteArrayMatcher_class(QScriptEngine *engine);
+QScriptValue qtscript_create_Qt_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QPointF_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QDataStream_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QRectF_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QSize_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QRunnable_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QMutex_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QXmlStreamReader_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QXmlStreamWriter_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QLibraryInfo_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QPoint_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QUrl_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QTextDecoder_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QStringMatcher_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QXmlStreamNamespaceDeclaration_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QEvent_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QDirIterator_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QXmlStreamEntityResolver_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QPersistentModelIndex_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QObject_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QWaitCondition_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QXmlStreamNotationDeclaration_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QSystemSemaphore_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QTime_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QLocale_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QRect_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QXmlStreamAttribute_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QBasicTimer_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QTextCodec_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QCryptographicHash_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QModelIndex_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QUuid_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QDir_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QBitArray_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QTextEncoder_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QSizeF_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QTextStream_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QByteArray_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QSemaphore_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QFileInfo_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QXmlStreamAttributes_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QSocketNotifier_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QCoreApplication_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QEventLoop_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QChildEvent_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QSettings_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QDynamicPropertyChangeEvent_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QIODevice_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QAbstractItemModel_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QTimer_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QSignalMapper_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QMimeData_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QTimerEvent_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QTextCodecPlugin_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QThreadPool_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QTranslator_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QFileSystemWatcher_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QTimeLine_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QAbstractTableModel_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QProcess_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QBuffer_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QFile_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QAbstractListModel_class(QScriptEngine *engine);
+QScriptValue qtscript_create_QTemporaryFile_class(QScriptEngine *engine);
+
+static const char * const qtscript_com_nokia_qt_core_class_names[] = {
+ "QTextBoundaryFinder"
+ , "QXmlStreamEntityDeclaration"
+ , "QByteArrayMatcher"
+ , "Qt"
+ , "QPointF"
+ , "QDataStream"
+ , "QRectF"
+ , "QSize"
+ , "QRunnable"
+ , "QMutex"
+ , "QXmlStreamReader"
+ , "QXmlStreamWriter"
+ , "QLibraryInfo"
+ , "QPoint"
+ , "QUrl"
+ , "QTextDecoder"
+ , "QStringMatcher"
+ , "QXmlStreamNamespaceDeclaration"
+ , "QEvent"
+ , "QDirIterator"
+ , "QXmlStreamEntityResolver"
+ , "QPersistentModelIndex"
+ , "QObject"
+ , "QWaitCondition"
+ , "QXmlStreamNotationDeclaration"
+ , "QSystemSemaphore"
+ , "QTime"
+ , "QLocale"
+ , "QRect"
+ , "QXmlStreamAttribute"
+ , "QBasicTimer"
+ , "QTextCodec"
+ , "QCryptographicHash"
+ , "QModelIndex"
+ , "QUuid"
+ , "QDir"
+ , "QBitArray"
+ , "QTextEncoder"
+ , "QSizeF"
+ , "QTextStream"
+ , "QByteArray"
+ , "QSemaphore"
+ , "QFileInfo"
+ , "QXmlStreamAttributes"
+ , "QSocketNotifier"
+ , "QCoreApplication"
+ , "QEventLoop"
+ , "QChildEvent"
+ , "QSettings"
+ , "QDynamicPropertyChangeEvent"
+ , "QIODevice"
+ , "QAbstractItemModel"
+ , "QTimer"
+ , "QSignalMapper"
+ , "QMimeData"
+ , "QTimerEvent"
+ , "QTextCodecPlugin"
+ , "QThreadPool"
+ , "QTranslator"
+ , "QFileSystemWatcher"
+ , "QTimeLine"
+ , "QAbstractTableModel"
+ , "QProcess"
+ , "QBuffer"
+ , "QFile"
+ , "QAbstractListModel"
+ , "QTemporaryFile"
+
+};
+
+typedef QScriptValue (*QtBindingCreator)(QScriptEngine *engine);
+static const QtBindingCreator qtscript_com_nokia_qt_core_class_functions[] = {
+ qtscript_create_QTextBoundaryFinder_class
+ , qtscript_create_QXmlStreamEntityDeclaration_class
+ , qtscript_create_QByteArrayMatcher_class
+ , qtscript_create_Qt_class
+ , qtscript_create_QPointF_class
+ , qtscript_create_QDataStream_class
+ , qtscript_create_QRectF_class
+ , qtscript_create_QSize_class
+ , qtscript_create_QRunnable_class
+ , qtscript_create_QMutex_class
+ , qtscript_create_QXmlStreamReader_class
+ , qtscript_create_QXmlStreamWriter_class
+ , qtscript_create_QLibraryInfo_class
+ , qtscript_create_QPoint_class
+ , qtscript_create_QUrl_class
+ , qtscript_create_QTextDecoder_class
+ , qtscript_create_QStringMatcher_class
+ , qtscript_create_QXmlStreamNamespaceDeclaration_class
+ , qtscript_create_QEvent_class
+ , qtscript_create_QDirIterator_class
+ , qtscript_create_QXmlStreamEntityResolver_class
+ , qtscript_create_QPersistentModelIndex_class
+ , qtscript_create_QObject_class
+ , qtscript_create_QWaitCondition_class
+ , qtscript_create_QXmlStreamNotationDeclaration_class
+ , qtscript_create_QSystemSemaphore_class
+ , qtscript_create_QTime_class
+ , qtscript_create_QLocale_class
+ , qtscript_create_QRect_class
+ , qtscript_create_QXmlStreamAttribute_class
+ , qtscript_create_QBasicTimer_class
+ , qtscript_create_QTextCodec_class
+ , qtscript_create_QCryptographicHash_class
+ , qtscript_create_QModelIndex_class
+ , qtscript_create_QUuid_class
+ , qtscript_create_QDir_class
+ , qtscript_create_QBitArray_class
+ , qtscript_create_QTextEncoder_class
+ , qtscript_create_QSizeF_class
+ , qtscript_create_QTextStream_class
+ , qtscript_create_QByteArray_class
+ , qtscript_create_QSemaphore_class
+ , qtscript_create_QFileInfo_class
+ , qtscript_create_QXmlStreamAttributes_class
+ , qtscript_create_QSocketNotifier_class
+ , qtscript_create_QCoreApplication_class
+ , qtscript_create_QEventLoop_class
+ , qtscript_create_QChildEvent_class
+ , qtscript_create_QSettings_class
+ , qtscript_create_QDynamicPropertyChangeEvent_class
+ , qtscript_create_QIODevice_class
+ , qtscript_create_QAbstractItemModel_class
+ , qtscript_create_QTimer_class
+ , qtscript_create_QSignalMapper_class
+ , qtscript_create_QMimeData_class
+ , qtscript_create_QTimerEvent_class
+ , qtscript_create_QTextCodecPlugin_class
+ , qtscript_create_QThreadPool_class
+ , qtscript_create_QTranslator_class
+ , qtscript_create_QFileSystemWatcher_class
+ , qtscript_create_QTimeLine_class
+ , qtscript_create_QAbstractTableModel_class
+ , qtscript_create_QProcess_class
+ , qtscript_create_QBuffer_class
+ , qtscript_create_QFile_class
+ , qtscript_create_QAbstractListModel_class
+ , qtscript_create_QTemporaryFile_class
+};
+
+class com_nokia_qt_core_ScriptPlugin : public QScriptExtensionPlugin
+{
+public:
+ QStringList keys() const;
+ void initialize(const QString &key, QScriptEngine *engine);
+};
+
+QStringList com_nokia_qt_core_ScriptPlugin::keys() const
+{
+ QStringList list;
+ list << QLatin1String("qt");
+ list << QLatin1String("qt.core");
+ return list;
+}
+
+void com_nokia_qt_core_ScriptPlugin::initialize(const QString &key, QScriptEngine *engine)
+{
+ if (key == QLatin1String("qt")) {
+ } else if (key == QLatin1String("qt.core")) {
+ QScriptValue extensionObject = engine->globalObject();
+ for (int i = 0; i < 67; ++i) {
+ extensionObject.setProperty(qtscript_com_nokia_qt_core_class_names[i],
+ qtscript_com_nokia_qt_core_class_functions[i](engine),
+ QScriptValue::SkipInEnumeration);
+ }
+ } else {
+ Q_ASSERT_X(false, "com_nokia_qt_core::initialize", qPrintable(key));
+ }
+}
+Q_EXPORT_STATIC_PLUGIN(com_nokia_qt_core_ScriptPlugin)
+Q_EXPORT_PLUGIN2(qtscript_com_nokia_qt_core, com_nokia_qt_core_ScriptPlugin)
+
diff --git a/qtbindings/com_nokia_qt_core/qtscript_Global.cpp b/qtbindings/com_nokia_qt_core/qtscript_Global.cpp
new file mode 100644
index 0000000..7365dc1
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_Global.cpp
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QAbstractItemModel.cpp b/qtbindings/com_nokia_qt_core/qtscript_QAbstractItemModel.cpp
new file mode 100644
index 0000000..69b500a
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QAbstractItemModel.cpp
@@ -0,0 +1,740 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qabstractitemmodel.h>
+#include <QVariant>
+#include <qabstractitemmodel.h>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qdatastream.h>
+#include <qlist.h>
+#include <qmimedata.h>
+#include <qobject.h>
+#include <qsize.h>
+#include <qstringlist.h>
+
+#include "qtscriptshell_QAbstractItemModel.h"
+
+static const char * const qtscript_QAbstractItemModel_function_names[] = {
+ "QAbstractItemModel"
+ // static
+ // prototype
+ , "buddy"
+ , "canFetchMore"
+ , "columnCount"
+ , "data"
+ , "dropMimeData"
+ , "fetchMore"
+ , "flags"
+ , "hasChildren"
+ , "hasIndex"
+ , "headerData"
+ , "index"
+ , "insertColumn"
+ , "insertColumns"
+ , "insertRow"
+ , "insertRows"
+ , "itemData"
+ , "match"
+ , "mimeData"
+ , "mimeTypes"
+ , "parent"
+ , "removeColumn"
+ , "removeColumns"
+ , "removeRow"
+ , "removeRows"
+ , "rowCount"
+ , "setData"
+ , "setHeaderData"
+ , "setItemData"
+ , "setSupportedDragActions"
+ , "sibling"
+ , "sort"
+ , "span"
+ , "supportedDragActions"
+ , "supportedDropActions"
+ , "toString"
+};
+
+static const char * const qtscript_QAbstractItemModel_function_signatures[] = {
+ "QObject parent"
+ // static
+ // prototype
+ , "QModelIndex index"
+ , "QModelIndex parent"
+ , "QModelIndex parent"
+ , "QModelIndex index, int role"
+ , "QMimeData data, DropAction action, int row, int column, QModelIndex parent"
+ , "QModelIndex parent"
+ , "QModelIndex index"
+ , "QModelIndex parent"
+ , "int row, int column, QModelIndex parent"
+ , "int section, Orientation orientation, int role"
+ , "int row, int column, QModelIndex parent"
+ , "int column, QModelIndex parent"
+ , "int column, int count, QModelIndex parent"
+ , "int row, QModelIndex parent"
+ , "int row, int count, QModelIndex parent"
+ , "QModelIndex index"
+ , "QModelIndex start, int role, Object value, int hits, MatchFlags flags"
+ , "List indexes"
+ , ""
+ , "QModelIndex child"
+ , "int column, QModelIndex parent"
+ , "int column, int count, QModelIndex parent"
+ , "int row, QModelIndex parent"
+ , "int row, int count, QModelIndex parent"
+ , "QModelIndex parent"
+ , "QModelIndex index, Object value, int role"
+ , "int section, Orientation orientation, Object value, int role"
+ , "QModelIndex index, SortedMap roles"
+ , "DropActions arg__1"
+ , "int row, int column, QModelIndex idx"
+ , "int column, SortOrder order"
+ , "QModelIndex index"
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QAbstractItemModel_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QAbstractItemModel::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QAbstractItemModel*)
+Q_DECLARE_METATYPE(QtScriptShell_QAbstractItemModel*)
+Q_DECLARE_METATYPE(QModelIndex)
+Q_DECLARE_METATYPE(QVariant)
+Q_DECLARE_METATYPE(QMimeData*)
+Q_DECLARE_METATYPE(Qt::DropAction)
+Q_DECLARE_METATYPE(QFlags<Qt::ItemFlag>)
+Q_DECLARE_METATYPE(Qt::Orientation)
+template <> \
+struct QMetaTypeId< QMap<int,QVariant> > \
+{ \
+ enum { Defined = 1 }; \
+ static int qt_metatype_id() \
+ { \
+ static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
+ if (!metatype_id) \
+ metatype_id = qRegisterMetaType< QMap<int,QVariant> >("QMap<int,QVariant>"); \
+ return metatype_id; \
+ } \
+};
+Q_DECLARE_METATYPE(QFlags<Qt::MatchFlag>)
+Q_DECLARE_METATYPE(QList<QModelIndex>)
+Q_DECLARE_METATYPE(QFlags<Qt::DropAction>)
+Q_DECLARE_METATYPE(Qt::SortOrder)
+
+//
+// QAbstractItemModel
+//
+
+static QScriptValue qtscript_QAbstractItemModel_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 34;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QAbstractItemModel* _q_self = qscriptvalue_cast<QAbstractItemModel*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QAbstractItemModel.%0(): this object is not a QAbstractItemModel")
+ .arg(qtscript_QAbstractItemModel_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ QModelIndex _q_result = _q_self->buddy(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ bool _q_result = _q_self->canFetchMore(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->columnCount();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ int _q_result = _q_self->columnCount(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ QVariant _q_result = _q_self->data(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ QVariant _q_result = _q_self->data(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 5) {
+ QMimeData* _q_arg0 = qscriptvalue_cast<QMimeData*>(context->argument(0));
+ Qt::DropAction _q_arg1 = qscriptvalue_cast<Qt::DropAction>(context->argument(1));
+ int _q_arg2 = context->argument(2).toInt32();
+ int _q_arg3 = context->argument(3).toInt32();
+ QModelIndex _q_arg4 = qscriptvalue_cast<QModelIndex>(context->argument(4));
+ bool _q_result = _q_self->dropMimeData(_q_arg0, _q_arg1, _q_arg2, _q_arg3, _q_arg4);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 1) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ _q_self->fetchMore(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 1) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ QFlags<Qt::ItemFlag> _q_result = _q_self->flags(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->hasChildren();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ bool _q_result = _q_self->hasChildren(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ bool _q_result = _q_self->hasIndex(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ QModelIndex _q_arg2 = qscriptvalue_cast<QModelIndex>(context->argument(2));
+ bool _q_result = _q_self->hasIndex(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ Qt::Orientation _q_arg1 = qscriptvalue_cast<Qt::Orientation>(context->argument(1));
+ QVariant _q_result = _q_self->headerData(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ int _q_arg0 = context->argument(0).toInt32();
+ Qt::Orientation _q_arg1 = qscriptvalue_cast<Qt::Orientation>(context->argument(1));
+ int _q_arg2 = context->argument(2).toInt32();
+ QVariant _q_result = _q_self->headerData(_q_arg0, _q_arg1, _q_arg2);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ QModelIndex _q_result = _q_self->index(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ QModelIndex _q_arg2 = qscriptvalue_cast<QModelIndex>(context->argument(2));
+ QModelIndex _q_result = _q_self->index(_q_arg0, _q_arg1, _q_arg2);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ bool _q_result = _q_self->insertColumn(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QModelIndex _q_arg1 = qscriptvalue_cast<QModelIndex>(context->argument(1));
+ bool _q_result = _q_self->insertColumn(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ bool _q_result = _q_self->insertColumns(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ QModelIndex _q_arg2 = qscriptvalue_cast<QModelIndex>(context->argument(2));
+ bool _q_result = _q_self->insertColumns(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ bool _q_result = _q_self->insertRow(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QModelIndex _q_arg1 = qscriptvalue_cast<QModelIndex>(context->argument(1));
+ bool _q_result = _q_self->insertRow(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ bool _q_result = _q_self->insertRows(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ QModelIndex _q_arg2 = qscriptvalue_cast<QModelIndex>(context->argument(2));
+ bool _q_result = _q_self->insertRows(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 1) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ QMap<int,QVariant> _q_result = _q_self->itemData(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 3) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ QVariant _q_arg2 = context->argument(2).toVariant();
+ QList<QModelIndex> _q_result = _q_self->match(_q_arg0, _q_arg1, _q_arg2);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 4) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ QVariant _q_arg2 = context->argument(2).toVariant();
+ int _q_arg3 = context->argument(3).toInt32();
+ QList<QModelIndex> _q_result = _q_self->match(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 5) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ QVariant _q_arg2 = context->argument(2).toVariant();
+ int _q_arg3 = context->argument(3).toInt32();
+ QFlags<Qt::MatchFlag> _q_arg4 = qscriptvalue_cast<QFlags<Qt::MatchFlag> >(context->argument(4));
+ QList<QModelIndex> _q_result = _q_self->match(_q_arg0, _q_arg1, _q_arg2, _q_arg3, _q_arg4);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 1) {
+ QList<QModelIndex> _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ QMimeData* _q_result = _q_self->mimeData(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 0) {
+ QStringList _q_result = _q_self->mimeTypes();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 1) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ QModelIndex _q_result = _q_self->parent(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ bool _q_result = _q_self->removeColumn(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QModelIndex _q_arg1 = qscriptvalue_cast<QModelIndex>(context->argument(1));
+ bool _q_result = _q_self->removeColumn(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 21:
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ bool _q_result = _q_self->removeColumns(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ QModelIndex _q_arg2 = qscriptvalue_cast<QModelIndex>(context->argument(2));
+ bool _q_result = _q_self->removeColumns(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 22:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ bool _q_result = _q_self->removeRow(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QModelIndex _q_arg1 = qscriptvalue_cast<QModelIndex>(context->argument(1));
+ bool _q_result = _q_self->removeRow(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 23:
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ bool _q_result = _q_self->removeRows(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ QModelIndex _q_arg2 = qscriptvalue_cast<QModelIndex>(context->argument(2));
+ bool _q_result = _q_self->removeRows(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 24:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->rowCount();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ int _q_result = _q_self->rowCount(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 25:
+ if (context->argumentCount() == 2) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ QVariant _q_arg1 = context->argument(1).toVariant();
+ bool _q_result = _q_self->setData(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ QVariant _q_arg1 = context->argument(1).toVariant();
+ int _q_arg2 = context->argument(2).toInt32();
+ bool _q_result = _q_self->setData(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 26:
+ if (context->argumentCount() == 3) {
+ int _q_arg0 = context->argument(0).toInt32();
+ Qt::Orientation _q_arg1 = qscriptvalue_cast<Qt::Orientation>(context->argument(1));
+ QVariant _q_arg2 = context->argument(2).toVariant();
+ bool _q_result = _q_self->setHeaderData(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 4) {
+ int _q_arg0 = context->argument(0).toInt32();
+ Qt::Orientation _q_arg1 = qscriptvalue_cast<Qt::Orientation>(context->argument(1));
+ QVariant _q_arg2 = context->argument(2).toVariant();
+ int _q_arg3 = context->argument(3).toInt32();
+ bool _q_result = _q_self->setHeaderData(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 27:
+ if (context->argumentCount() == 2) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ QMap<int,QVariant> _q_arg1 = qscriptvalue_cast<QMap<int,QVariant> >(context->argument(1));
+ bool _q_result = _q_self->setItemData(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 28:
+ if (context->argumentCount() == 1) {
+ QFlags<Qt::DropAction> _q_arg0 = qscriptvalue_cast<QFlags<Qt::DropAction> >(context->argument(0));
+ _q_self->setSupportedDragActions(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 29:
+ if (context->argumentCount() == 3) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ QModelIndex _q_arg2 = qscriptvalue_cast<QModelIndex>(context->argument(2));
+ QModelIndex _q_result = _q_self->sibling(_q_arg0, _q_arg1, _q_arg2);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 30:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->sort(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ Qt::SortOrder _q_arg1 = qscriptvalue_cast<Qt::SortOrder>(context->argument(1));
+ _q_self->sort(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 31:
+ if (context->argumentCount() == 1) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ QSize _q_result = _q_self->span(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 32:
+ if (context->argumentCount() == 0) {
+ QFlags<Qt::DropAction> _q_result = _q_self->supportedDragActions();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 33:
+ if (context->argumentCount() == 0) {
+ QFlags<Qt::DropAction> _q_result = _q_self->supportedDropActions();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 34: {
+ QString result = QString::fromLatin1("QAbstractItemModel");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QAbstractItemModel_throw_ambiguity_error_helper(context,
+ qtscript_QAbstractItemModel_function_names[_id+1],
+ qtscript_QAbstractItemModel_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QAbstractItemModel_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QAbstractItemModel(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QAbstractItemModel* _q_cpp_result = new QtScriptShell_QAbstractItemModel();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QAbstractItemModel*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QtScriptShell_QAbstractItemModel* _q_cpp_result = new QtScriptShell_QAbstractItemModel(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QAbstractItemModel*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QAbstractItemModel_throw_ambiguity_error_helper(context,
+ qtscript_QAbstractItemModel_function_names[_id],
+ qtscript_QAbstractItemModel_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QAbstractItemModel_toScriptValue(QScriptEngine *engine, QAbstractItemModel* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QAbstractItemModel_fromScriptValue(const QScriptValue &value, QAbstractItemModel* &out)
+{
+ out = qobject_cast<QAbstractItemModel*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QAbstractItemModel_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 1
+ , 1
+ , 1
+ , 2
+ , 5
+ , 1
+ , 1
+ , 1
+ , 3
+ , 3
+ , 3
+ , 2
+ , 3
+ , 2
+ , 3
+ , 1
+ , 5
+ , 1
+ , 0
+ , 1
+ , 2
+ , 3
+ , 2
+ , 3
+ , 1
+ , 3
+ , 4
+ , 2
+ , 1
+ , 3
+ , 2
+ , 1
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QAbstractItemModel*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QAbstractItemModel*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
+ for (int i = 0; i < 35; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QAbstractItemModel_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QAbstractItemModel_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<QAbstractItemModel*>(engine, qtscript_QAbstractItemModel_toScriptValue,
+ qtscript_QAbstractItemModel_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QAbstractItemModel_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QAbstractListModel.cpp b/qtbindings/com_nokia_qt_core/qtscript_QAbstractListModel.cpp
new file mode 100644
index 0000000..7567563
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QAbstractListModel.cpp
@@ -0,0 +1,195 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qabstractitemmodel.h>
+#include <QSize>
+#include <QStringList>
+#include <QVariant>
+#include <qabstractitemmodel.h>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qdatastream.h>
+#include <qlist.h>
+#include <qmimedata.h>
+#include <qobject.h>
+#include <qsize.h>
+#include <qstringlist.h>
+
+#include "qtscriptshell_QAbstractListModel.h"
+
+static const char * const qtscript_QAbstractListModel_function_names[] = {
+ "QAbstractListModel"
+ // static
+ // prototype
+ , "toString"
+};
+
+static const char * const qtscript_QAbstractListModel_function_signatures[] = {
+ "QObject parent"
+ // static
+ // prototype
+""
+};
+
+static QScriptValue qtscript_QAbstractListModel_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QAbstractListModel::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QAbstractListModel*)
+Q_DECLARE_METATYPE(QtScriptShell_QAbstractListModel*)
+Q_DECLARE_METATYPE(QAbstractItemModel*)
+
+//
+// QAbstractListModel
+//
+
+static QScriptValue qtscript_QAbstractListModel_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 0;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QAbstractListModel* _q_self = qscriptvalue_cast<QAbstractListModel*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QAbstractListModel.%0(): this object is not a QAbstractListModel")
+ .arg(qtscript_QAbstractListModel_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0: {
+ QString result = QString::fromLatin1("QAbstractListModel");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QAbstractListModel_throw_ambiguity_error_helper(context,
+ qtscript_QAbstractListModel_function_names[_id+1],
+ qtscript_QAbstractListModel_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QAbstractListModel_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QAbstractListModel(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QAbstractListModel* _q_cpp_result = new QtScriptShell_QAbstractListModel();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QAbstractListModel*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QtScriptShell_QAbstractListModel* _q_cpp_result = new QtScriptShell_QAbstractListModel(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QAbstractListModel*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QAbstractListModel_throw_ambiguity_error_helper(context,
+ qtscript_QAbstractListModel_function_names[_id],
+ qtscript_QAbstractListModel_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QAbstractListModel_toScriptValue(QScriptEngine *engine, QAbstractListModel* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QAbstractListModel_fromScriptValue(const QScriptValue &value, QAbstractListModel* &out)
+{
+ out = qobject_cast<QAbstractListModel*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QAbstractListModel_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QAbstractListModel*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QAbstractListModel*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QAbstractItemModel*>()));
+
+ qScriptRegisterMetaType<QAbstractListModel*>(engine, qtscript_QAbstractListModel_toScriptValue,
+ qtscript_QAbstractListModel_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QAbstractListModel_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QAbstractTableModel.cpp b/qtbindings/com_nokia_qt_core/qtscript_QAbstractTableModel.cpp
new file mode 100644
index 0000000..9737cfc
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QAbstractTableModel.cpp
@@ -0,0 +1,195 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qabstractitemmodel.h>
+#include <QSize>
+#include <QStringList>
+#include <QVariant>
+#include <qabstractitemmodel.h>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qdatastream.h>
+#include <qlist.h>
+#include <qmimedata.h>
+#include <qobject.h>
+#include <qsize.h>
+#include <qstringlist.h>
+
+#include "qtscriptshell_QAbstractTableModel.h"
+
+static const char * const qtscript_QAbstractTableModel_function_names[] = {
+ "QAbstractTableModel"
+ // static
+ // prototype
+ , "toString"
+};
+
+static const char * const qtscript_QAbstractTableModel_function_signatures[] = {
+ "QObject parent"
+ // static
+ // prototype
+""
+};
+
+static QScriptValue qtscript_QAbstractTableModel_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QAbstractTableModel::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QAbstractTableModel*)
+Q_DECLARE_METATYPE(QtScriptShell_QAbstractTableModel*)
+Q_DECLARE_METATYPE(QAbstractItemModel*)
+
+//
+// QAbstractTableModel
+//
+
+static QScriptValue qtscript_QAbstractTableModel_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 0;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QAbstractTableModel* _q_self = qscriptvalue_cast<QAbstractTableModel*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QAbstractTableModel.%0(): this object is not a QAbstractTableModel")
+ .arg(qtscript_QAbstractTableModel_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0: {
+ QString result = QString::fromLatin1("QAbstractTableModel");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QAbstractTableModel_throw_ambiguity_error_helper(context,
+ qtscript_QAbstractTableModel_function_names[_id+1],
+ qtscript_QAbstractTableModel_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QAbstractTableModel_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QAbstractTableModel(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QAbstractTableModel* _q_cpp_result = new QtScriptShell_QAbstractTableModel();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QAbstractTableModel*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QtScriptShell_QAbstractTableModel* _q_cpp_result = new QtScriptShell_QAbstractTableModel(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QAbstractTableModel*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QAbstractTableModel_throw_ambiguity_error_helper(context,
+ qtscript_QAbstractTableModel_function_names[_id],
+ qtscript_QAbstractTableModel_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QAbstractTableModel_toScriptValue(QScriptEngine *engine, QAbstractTableModel* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QAbstractTableModel_fromScriptValue(const QScriptValue &value, QAbstractTableModel* &out)
+{
+ out = qobject_cast<QAbstractTableModel*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QAbstractTableModel_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QAbstractTableModel*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QAbstractTableModel*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QAbstractItemModel*>()));
+
+ qScriptRegisterMetaType<QAbstractTableModel*>(engine, qtscript_QAbstractTableModel_toScriptValue,
+ qtscript_QAbstractTableModel_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QAbstractTableModel_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QBasicTimer.cpp b/qtbindings/com_nokia_qt_core/qtscript_QBasicTimer.cpp
new file mode 100644
index 0000000..8e97bbc
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QBasicTimer.cpp
@@ -0,0 +1,212 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qbasictimer.h>
+#include <QVariant>
+#include <qobject.h>
+
+static const char * const qtscript_QBasicTimer_function_names[] = {
+ "QBasicTimer"
+ // static
+ // prototype
+ , "isActive"
+ , "start"
+ , "stop"
+ , "timerId"
+ , "toString"
+};
+
+static const char * const qtscript_QBasicTimer_function_signatures[] = {
+ ""
+ // static
+ // prototype
+ , ""
+ , "int msec, QObject obj"
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QBasicTimer_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QBasicTimer::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QBasicTimer)
+Q_DECLARE_METATYPE(QBasicTimer*)
+
+//
+// QBasicTimer
+//
+
+static QScriptValue qtscript_QBasicTimer_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 4;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QBasicTimer* _q_self = qscriptvalue_cast<QBasicTimer*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QBasicTimer.%0(): this object is not a QBasicTimer")
+ .arg(qtscript_QBasicTimer_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isActive();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QObject* _q_arg1 = context->argument(1).toQObject();
+ _q_self->start(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ _q_self->stop();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->timerId();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4: {
+ QString result = QString::fromLatin1("QBasicTimer");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QBasicTimer_throw_ambiguity_error_helper(context,
+ qtscript_QBasicTimer_function_names[_id+1],
+ qtscript_QBasicTimer_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QBasicTimer_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QBasicTimer(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QBasicTimer _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QBasicTimer_throw_ambiguity_error_helper(context,
+ qtscript_QBasicTimer_function_names[_id],
+ qtscript_QBasicTimer_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QBasicTimer_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 0
+ // static
+ // prototype
+ , 0
+ , 2
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QBasicTimer*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QBasicTimer*)0));
+ for (int i = 0; i < 5; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QBasicTimer_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QBasicTimer_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QBasicTimer>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QBasicTimer*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QBasicTimer_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QBitArray.cpp b/qtbindings/com_nokia_qt_core/qtscript_QBitArray.cpp
new file mode 100644
index 0000000..6ca86a6
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QBitArray.cpp
@@ -0,0 +1,480 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qbitarray.h>
+#include <QVariant>
+#include <qbitarray.h>
+#include <qdatastream.h>
+
+static const char * const qtscript_QBitArray_function_names[] = {
+ "QBitArray"
+ // static
+ // prototype
+ , "at"
+ , "clear"
+ , "clearBit"
+ , "count"
+ , "fill"
+ , "isEmpty"
+ , "isNull"
+ , "operator_and_assign"
+ , "operator_assign"
+ , "equals"
+ , "operator_negate"
+ , "operator_or_assign"
+ , "operator_xor_assign"
+ , "readFrom"
+ , "resize"
+ , "setBit"
+ , "size"
+ , "testBit"
+ , "toggleBit"
+ , "truncate"
+ , "writeTo"
+ , "toString"
+};
+
+static const char * const qtscript_QBitArray_function_signatures[] = {
+ "\nQBitArray other\nint size, bool val"
+ // static
+ // prototype
+ , "int i"
+ , ""
+ , "int i"
+ , "\nbool on"
+ , "bool val, int first, int last\nbool val, int size"
+ , ""
+ , ""
+ , "QBitArray arg__1"
+ , "QBitArray other"
+ , "QBitArray a"
+ , ""
+ , "QBitArray arg__1"
+ , "QBitArray arg__1"
+ , "QDataStream arg__1"
+ , "int size"
+ , "int i\nint i, bool val"
+ , ""
+ , "int i"
+ , "int i"
+ , "int pos"
+ , "QDataStream arg__1"
+""
+};
+
+static QScriptValue qtscript_QBitArray_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QBitArray::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QBitArray*)
+Q_DECLARE_METATYPE(QDataStream*)
+
+//
+// QBitArray
+//
+
+static QScriptValue qtscript_QBitArray_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 21;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QBitArray* _q_self = qscriptvalue_cast<QBitArray*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QBitArray.%0(): this object is not a QBitArray")
+ .arg(qtscript_QBitArray_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+
+ // TEMPLATE - core.convert_int_arg_and_check_range - START
+ int _q_arg0 = context->argument(0).toInt32();
+ if ((_q_arg0 < 0) || (_q_self->size() < _q_arg0)) {
+ return context->throwError(QScriptContext::RangeError,
+ QString::fromLatin1("QBitArray::at(): index out of range"));
+ }
+ // TEMPLATE - core.convert_int_arg_and_check_range - END
+ bool _q_result = _q_self->at(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ _q_self->clear();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+
+ // TEMPLATE - core.convert_int_arg_and_check_range - START
+ int _q_arg0 = context->argument(0).toInt32();
+ if ((_q_arg0 < 0) || (_q_self->size() < _q_arg0)) {
+ return context->throwError(QScriptContext::RangeError,
+ QString::fromLatin1("QBitArray::clearBit(): index out of range"));
+ }
+ // TEMPLATE - core.convert_int_arg_and_check_range - END
+ _q_self->clearBit(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->count();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ bool _q_arg0 = context->argument(0).toBoolean();
+ int _q_result = _q_self->count(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ bool _q_arg0 = context->argument(0).toBoolean();
+ bool _q_result = _q_self->fill(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ bool _q_arg0 = context->argument(0).toBoolean();
+ int _q_arg1 = context->argument(1).toInt32();
+ bool _q_result = _q_self->fill(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ bool _q_arg0 = context->argument(0).toBoolean();
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_arg2 = context->argument(2).toInt32();
+ _q_self->fill(_q_arg0, _q_arg1, _q_arg2);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isEmpty();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isNull();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 1) {
+ QBitArray _q_arg0 = qscriptvalue_cast<QBitArray>(context->argument(0));
+ _q_self->operator&=(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 1) {
+ QBitArray _q_arg0 = qscriptvalue_cast<QBitArray>(context->argument(0));
+ _q_self->operator=(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 1) {
+ QBitArray _q_arg0 = qscriptvalue_cast<QBitArray>(context->argument(0));
+ bool _q_result = _q_self->operator==(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 0) {
+ QBitArray _q_result = _q_self->operator~();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 1) {
+ QBitArray _q_arg0 = qscriptvalue_cast<QBitArray>(context->argument(0));
+ _q_self->operator|=(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 1) {
+ QBitArray _q_arg0 = qscriptvalue_cast<QBitArray>(context->argument(0));
+ _q_self->operator^=(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator>>(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->resize(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 1) {
+
+ // TEMPLATE - core.convert_int_arg_and_check_range - START
+ int _q_arg0 = context->argument(0).toInt32();
+ if ((_q_arg0 < 0) || (_q_self->size() < _q_arg0)) {
+ return context->throwError(QScriptContext::RangeError,
+ QString::fromLatin1("QBitArray::setBit(): index out of range"));
+ }
+ // TEMPLATE - core.convert_int_arg_and_check_range - END
+ _q_self->setBit(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+
+ // TEMPLATE - core.convert_int_arg_and_check_range - START
+ int _q_arg0 = context->argument(0).toInt32();
+ if ((_q_arg0 < 0) || (_q_self->size() < _q_arg0)) {
+ return context->throwError(QScriptContext::RangeError,
+ QString::fromLatin1("QBitArray::setBit(): index out of range"));
+ }
+ // TEMPLATE - core.convert_int_arg_and_check_range - END
+ bool _q_arg1 = context->argument(1).toBoolean();
+ _q_self->setBit(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->size();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 1) {
+
+ // TEMPLATE - core.convert_int_arg_and_check_range - START
+ int _q_arg0 = context->argument(0).toInt32();
+ if ((_q_arg0 < 0) || (_q_self->size() < _q_arg0)) {
+ return context->throwError(QScriptContext::RangeError,
+ QString::fromLatin1("QBitArray::testBit(): index out of range"));
+ }
+ // TEMPLATE - core.convert_int_arg_and_check_range - END
+ bool _q_result = _q_self->testBit(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 1) {
+
+ // TEMPLATE - core.convert_int_arg_and_check_range - START
+ int _q_arg0 = context->argument(0).toInt32();
+ if ((_q_arg0 < 0) || (_q_self->size() < _q_arg0)) {
+ return context->throwError(QScriptContext::RangeError,
+ QString::fromLatin1("QBitArray::toggleBit(): index out of range"));
+ }
+ // TEMPLATE - core.convert_int_arg_and_check_range - END
+ bool _q_result = _q_self->toggleBit(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->truncate(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator<<(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 21: {
+ QString result = QString::fromLatin1("QBitArray");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QBitArray_throw_ambiguity_error_helper(context,
+ qtscript_QBitArray_function_names[_id+1],
+ qtscript_QBitArray_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QBitArray_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QBitArray(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QBitArray _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QBitArray>() == context->argument(0).toVariant().userType())) {
+ QBitArray _q_arg0 = qscriptvalue_cast<QBitArray>(context->argument(0));
+ QBitArray _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argument(0).isNumber()) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QBitArray _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ bool _q_arg1 = context->argument(1).toBoolean();
+ QBitArray _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QBitArray_throw_ambiguity_error_helper(context,
+ qtscript_QBitArray_function_names[_id],
+ qtscript_QBitArray_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QBitArray_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 2
+ // static
+ // prototype
+ , 1
+ , 0
+ , 1
+ , 1
+ , 3
+ , 0
+ , 0
+ , 1
+ , 1
+ , 1
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 2
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QBitArray*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QBitArray*)0));
+ for (int i = 0; i < 22; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QBitArray_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QBitArray_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QBitArray>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QBitArray*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QBitArray_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QBuffer.cpp b/qtbindings/com_nokia_qt_core/qtscript_QBuffer.cpp
new file mode 100644
index 0000000..b125680
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QBuffer.cpp
@@ -0,0 +1,233 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qbuffer.h>
+#include <QVariant>
+#include <qbuffer.h>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+
+#include "qtscriptshell_QBuffer.h"
+
+static const char * const qtscript_QBuffer_function_names[] = {
+ "QBuffer"
+ // static
+ // prototype
+ , "setBuffer"
+ , "setData"
+ , "toString"
+};
+
+static const char * const qtscript_QBuffer_function_signatures[] = {
+ "QByteArray buf, QObject parent\nQObject parent"
+ // static
+ // prototype
+ , "QByteArray a"
+ , "QByteArray data"
+""
+};
+
+static QScriptValue qtscript_QBuffer_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QBuffer::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QBuffer*)
+Q_DECLARE_METATYPE(QtScriptShell_QBuffer*)
+Q_DECLARE_METATYPE(QByteArray*)
+Q_DECLARE_METATYPE(QIODevice*)
+
+//
+// QBuffer
+//
+
+static QScriptValue qtscript_QBuffer_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 2;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QBuffer* _q_self = qscriptvalue_cast<QBuffer*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QBuffer.%0(): this object is not a QBuffer")
+ .arg(qtscript_QBuffer_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ QByteArray* _q_arg0 = qscriptvalue_cast<QByteArray*>(context->argument(0));
+ _q_self->setBuffer(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ _q_self->setData(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 2: {
+ QString result = QString::fromLatin1("QBuffer");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QBuffer_throw_ambiguity_error_helper(context,
+ qtscript_QBuffer_function_names[_id+1],
+ qtscript_QBuffer_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QBuffer_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QBuffer(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QBuffer* _q_cpp_result = new QtScriptShell_QBuffer();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QBuffer*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ if (qscriptvalue_cast<QByteArray*>(context->argument(0))) {
+ QByteArray* _q_arg0 = qscriptvalue_cast<QByteArray*>(context->argument(0));
+ QtScriptShell_QBuffer* _q_cpp_result = new QtScriptShell_QBuffer(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QBuffer*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argument(0).isQObject()) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QtScriptShell_QBuffer* _q_cpp_result = new QtScriptShell_QBuffer(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QBuffer*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 2) {
+ QByteArray* _q_arg0 = qscriptvalue_cast<QByteArray*>(context->argument(0));
+ QObject* _q_arg1 = context->argument(1).toQObject();
+ QtScriptShell_QBuffer* _q_cpp_result = new QtScriptShell_QBuffer(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QBuffer*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QBuffer_throw_ambiguity_error_helper(context,
+ qtscript_QBuffer_function_names[_id],
+ qtscript_QBuffer_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QBuffer_toScriptValue(QScriptEngine *engine, QBuffer* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QBuffer_fromScriptValue(const QScriptValue &value, QBuffer* &out)
+{
+ out = qobject_cast<QBuffer*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QBuffer_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 2
+ // static
+ // prototype
+ , 1
+ , 1
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QBuffer*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QBuffer*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QIODevice*>()));
+ for (int i = 0; i < 3; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QBuffer_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QBuffer_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<QBuffer*>(engine, qtscript_QBuffer_toScriptValue,
+ qtscript_QBuffer_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QBuffer_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QByteArray.cpp b/qtbindings/com_nokia_qt_core/qtscript_QByteArray.cpp
new file mode 100644
index 0000000..8134144
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QByteArray.cpp
@@ -0,0 +1,1248 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qbytearray.h>
+#include <QNoImplicitBoolCast>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qdatastream.h>
+#include <qlist.h>
+
+static const char * const qtscript_QByteArray_function_names[] = {
+ "QByteArray"
+ // static
+ , "fromBase64"
+ , "fromHex"
+ , "fromInt"
+ , "fromLongLong"
+ , "fromPercentEncoding"
+ , "number"
+ // prototype
+ , "append"
+ , "appendByte"
+ , "at"
+ , "capacity"
+ , "chop"
+ , "clear"
+ , "count"
+ , "endsWith"
+ , "fill"
+ , "indexOf"
+ , "indexOfByte"
+ , "insert"
+ , "insertByte"
+ , "isEmpty"
+ , "isNull"
+ , "lastIndexOf"
+ , "lastIndexOfByte"
+ , "left"
+ , "leftJustified"
+ , "length"
+ , "mid"
+ , "operator_assign"
+ , "equals"
+ , "operator_less"
+ , "prepend"
+ , "prependByte"
+ , "readFrom"
+ , "remove"
+ , "repeated"
+ , "replace"
+ , "reserve"
+ , "resize"
+ , "right"
+ , "rightJustified"
+ , "setDouble"
+ , "setFloat"
+ , "setInt"
+ , "setLongLong"
+ , "setShort"
+ , "simplified"
+ , "size"
+ , "split"
+ , "squeeze"
+ , "startsWith"
+ , "toBase64"
+ , "toDouble"
+ , "toFloat"
+ , "toHex"
+ , "toInt"
+ , "toLower"
+ , "toPercentEncoding"
+ , "toUShort"
+ , "toUpper"
+ , "trimmed"
+ , "truncate"
+ , "writeTo"
+ , "toString"
+};
+
+static const char * const qtscript_QByteArray_function_signatures[] = {
+ "\nQByteArray arg__1\nchar arg__1\nint size, char c"
+ // static
+ , "QByteArray base64"
+ , "QByteArray hexEncoded"
+ , "int arg__1, int base"
+ , "qlonglong arg__1, int base"
+ , "QByteArray pctEncoded, char percent"
+ , "double arg__1, char f, int prec"
+ // prototype
+ , "QByteArray a\nString s\nchar s, int len"
+ , "char c"
+ , "int i"
+ , ""
+ , "int n"
+ , ""
+ , "char c\nQByteArray a"
+ , "char c\nQByteArray a"
+ , "char c, int size"
+ , "QByteArray a, int from\nString s, int from"
+ , "char c, int from"
+ , "int i, QByteArray a\nint i, String s"
+ , "int i, char c"
+ , ""
+ , ""
+ , "QByteArray a, int from\nString s, int from"
+ , "char c, int from"
+ , "int len"
+ , "int width, char fill, bool truncate"
+ , ""
+ , "int index, int len"
+ , "QByteArray arg__1"
+ , "QByteArray a2\nString s2"
+ , "QByteArray a2\nString s2"
+ , "QByteArray a"
+ , "char c"
+ , "QDataStream arg__1"
+ , "int index, int len"
+ , "int times"
+ , "char before, char after\nchar before, QByteArray after\nchar c, String after\nQByteArray before, QByteArray after\nString before, QByteArray after\nchar before, int bsize, char after, int asize\nint index, int len, QByteArray s"
+ , "int size"
+ , "int size"
+ , "int len"
+ , "int width, char fill, bool truncate"
+ , "double arg__1, char f, int prec"
+ , "float arg__1, char f, int prec"
+ , "int arg__1, int base"
+ , "qlonglong arg__1, int base"
+ , "short arg__1, int base"
+ , ""
+ , ""
+ , "char sep"
+ , ""
+ , "char c\nQByteArray a"
+ , ""
+ , ""
+ , ""
+ , ""
+ , "int base"
+ , ""
+ , "QByteArray exclude, QByteArray include, char percent"
+ , "int base"
+ , ""
+ , ""
+ , "int pos"
+ , "QDataStream arg__1"
+""
+};
+
+static QScriptValue qtscript_QByteArray_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QByteArray::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QByteArray*)
+Q_DECLARE_METATYPE(char*)
+Q_DECLARE_METATYPE(QDataStream*)
+Q_DECLARE_METATYPE(QList<QByteArray>)
+
+
+ Q_DECLARE_METATYPE(QScriptValue)
+
+//
+// QByteArray
+//
+
+static QScriptValue qtscript_QByteArray_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 56;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QByteArray* _q_self = qscriptvalue_cast<QByteArray*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QByteArray.%0(): this object is not a QByteArray")
+ .arg(qtscript_QByteArray_function_names[_id+7]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ _q_self->append(_q_arg0);
+ return context->thisObject();
+ } else if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+// _q_self->append(_q_arg0);
+ return context->thisObject();
+ }
+ }
+ if (context->argumentCount() == 2) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ QByteArray _q_result = _q_self->append(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ char _q_arg0 = qscriptvalue_cast<char>(context->argument(0));
+ _q_self->append(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+
+ // TEMPLATE - core.convert_int_arg_and_check_range - START
+ int _q_arg0 = context->argument(0).toInt32();
+ if ((_q_arg0 < 0) || (_q_self->size() < _q_arg0)) {
+ return context->throwError(QScriptContext::RangeError,
+ QString::fromLatin1("QByteArray::at(): index out of range"));
+ }
+ // TEMPLATE - core.convert_int_arg_and_check_range - END
+ char _q_result = _q_self->at(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->capacity();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->chop(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ _q_self->clear();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<char>() == context->argument(0).toVariant().userType())) {
+ char _q_arg0 = qscriptvalue_cast<char>(context->argument(0));
+ int _q_result = _q_self->count(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ int _q_result = _q_self->count(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<char>() == context->argument(0).toVariant().userType())) {
+ char _q_arg0 = qscriptvalue_cast<char>(context->argument(0));
+ bool _q_result = _q_self->endsWith(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ bool _q_result = _q_self->endsWith(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 1) {
+ char _q_arg0 = qscriptvalue_cast<char>(context->argument(0));
+ _q_self->fill(_q_arg0);
+ return context->thisObject();
+ }
+ if (context->argumentCount() == 2) {
+ char _q_arg0 = qscriptvalue_cast<char>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ _q_self->fill(_q_arg0, _q_arg1);
+ return context->thisObject();
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ int _q_result = _q_self->indexOf(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isString()) {
+// QString _q_arg0 = context->argument(0).toString();
+// int _q_result = _q_self->indexOf(_q_arg0);
+// return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 2) {
+ if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())
+ && context->argument(1).isNumber()) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_result = _q_self->indexOf(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isString()
+ && context->argument(1).isNumber()) {
+// QString _q_arg0 = context->argument(0).toString();
+// int _q_arg1 = context->argument(1).toInt32();
+// int _q_result = _q_self->indexOf(_q_arg0, _q_arg1);
+// return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 1) {
+ char _q_arg0 = qscriptvalue_cast<char>(context->argument(0));
+ int _q_result = _q_self->indexOf(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ char _q_arg0 = qscriptvalue_cast<char>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_result = _q_self->indexOf(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 2) {
+ if (context->argument(0).isNumber()
+ && (qMetaTypeId<QByteArray>() == context->argument(1).toVariant().userType())) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QByteArray _q_arg1 = qscriptvalue_cast<QByteArray>(context->argument(1));
+ _q_self->insert(_q_arg0, _q_arg1);
+ return context->thisObject();
+ } else if (context->argument(0).isNumber()
+ && context->argument(1).isString()) {
+ // int _q_arg0 = context->argument(0).toInt32();
+ // QString _q_arg1 = context->argument(1).toString();
+ // _q_self->insert(_q_arg0, _q_arg1);
+ // return context->thisObject();
+ }
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ char _q_arg1 = qscriptvalue_cast<char>(context->argument(1));
+ _q_self->insert(_q_arg0, _q_arg1);
+ return context->thisObject();
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isEmpty();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isNull();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ int _q_result = _q_self->lastIndexOf(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isString()) {
+ // QString _q_arg0 = context->argument(0).toString();
+ // int _q_result = _q_self->lastIndexOf(_q_arg0);
+ // return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 2) {
+ if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())
+ && context->argument(1).isNumber()) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_result = _q_self->lastIndexOf(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isString()
+ && context->argument(1).isNumber()) {
+// QString _q_arg0 = context->argument(0).toString();
+// int _q_arg1 = context->argument(1).toInt32();
+// int _q_result = _q_self->lastIndexOf(_q_arg0, _q_arg1);
+// return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 1) {
+ char _q_arg0 = qscriptvalue_cast<char>(context->argument(0));
+ int _q_result = _q_self->lastIndexOf(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ char _q_arg0 = qscriptvalue_cast<char>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_result = _q_self->lastIndexOf(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QByteArray _q_result = _q_self->left(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QByteArray _q_result = _q_self->leftJustified(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ char _q_arg1 = qscriptvalue_cast<char>(context->argument(1));
+ QByteArray _q_result = _q_self->leftJustified(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ int _q_arg0 = context->argument(0).toInt32();
+ char _q_arg1 = qscriptvalue_cast<char>(context->argument(1));
+ bool _q_arg2 = context->argument(2).toBoolean();
+ QByteArray _q_result = _q_self->leftJustified(_q_arg0, _q_arg1, _q_arg2);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->length();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QByteArray _q_result = _q_self->mid(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ QByteArray _q_result = _q_self->mid(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 21:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QByteArray _q_result = _q_self->operator=(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 22:
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ bool _q_result = _q_self->operator==(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->operator==(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 23:
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ bool _q_result = _q_self->operator<(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->operator<(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 24:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ _q_self->prepend(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 25:
+ if (context->argumentCount() == 1) {
+ char _q_arg0 = qscriptvalue_cast<char>(context->argument(0));
+ _q_self->prepend(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 26:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator>>(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 27:
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ _q_self->remove(_q_arg0, _q_arg1);
+ return context->thisObject();
+ }
+ break;
+
+ case 28:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QByteArray _q_result = _q_self->repeated(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 29:
+ if (context->argumentCount() == 2) {
+ if ((qMetaTypeId<char>() == context->argument(0).toVariant().userType())
+ && (qMetaTypeId<char>() == context->argument(1).toVariant().userType())) {
+ char _q_arg0 = qscriptvalue_cast<char>(context->argument(0));
+ char _q_arg1 = qscriptvalue_cast<char>(context->argument(1));
+ _q_self->replace(_q_arg0, _q_arg1);
+ return context->thisObject();
+ } else if ((qMetaTypeId<char>() == context->argument(0).toVariant().userType())
+ && (qMetaTypeId<QByteArray>() == context->argument(1).toVariant().userType())) {
+ char _q_arg0 = qscriptvalue_cast<char>(context->argument(0));
+ QByteArray _q_arg1 = qscriptvalue_cast<QByteArray>(context->argument(1));
+ _q_self->replace(_q_arg0, _q_arg1);
+ return context->thisObject();
+ } else if ((qMetaTypeId<char>() == context->argument(0).toVariant().userType())
+ && context->argument(1).isString()) {
+// char _q_arg0 = qscriptvalue_cast<char>(context->argument(0));
+// QString _q_arg1 = context->argument(1).toString();
+// _q_self->replace(_q_arg0, _q_arg1);
+// return context->thisObject();
+ } else if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())
+ && (qMetaTypeId<QByteArray>() == context->argument(1).toVariant().userType())) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QByteArray _q_arg1 = qscriptvalue_cast<QByteArray>(context->argument(1));
+ _q_self->replace(_q_arg0, _q_arg1);
+ return context->thisObject();
+ } else if (context->argument(0).isString()
+ && (qMetaTypeId<QByteArray>() == context->argument(1).toVariant().userType())) {
+// QString _q_arg0 = context->argument(0).toString();
+// QByteArray _q_arg1 = qscriptvalue_cast<QByteArray>(context->argument(1));
+// _q_self->replace(_q_arg0, _q_arg1);
+// return context->thisObject();
+ }
+ }
+ if (context->argumentCount() == 3) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ QByteArray _q_arg2 = qscriptvalue_cast<QByteArray>(context->argument(2));
+ _q_self->replace(_q_arg0, _q_arg1, _q_arg2);
+ return context->thisObject();
+ }
+ if (context->argumentCount() == 4) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ char* _q_arg2 = qscriptvalue_cast<char*>(context->argument(2));
+ int _q_arg3 = context->argument(3).toInt32();
+ QByteArray _q_result = _q_self->replace(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 30:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->reserve(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 31:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->resize(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 32:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QByteArray _q_result = _q_self->right(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 33:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QByteArray _q_result = _q_self->rightJustified(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ char _q_arg1 = qscriptvalue_cast<char>(context->argument(1));
+ QByteArray _q_result = _q_self->rightJustified(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ int _q_arg0 = context->argument(0).toInt32();
+ char _q_arg1 = qscriptvalue_cast<char>(context->argument(1));
+ bool _q_arg2 = context->argument(2).toBoolean();
+ QByteArray _q_result = _q_self->rightJustified(_q_arg0, _q_arg1, _q_arg2);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 34:
+ if (context->argumentCount() == 1) {
+ double _q_arg0 = context->argument(0).toNumber();
+ _q_self->setNum(_q_arg0);
+ return context->thisObject();
+ }
+ if (context->argumentCount() == 2) {
+ double _q_arg0 = context->argument(0).toNumber();
+ char _q_arg1 = qscriptvalue_cast<char>(context->argument(1));
+ _q_self->setNum(_q_arg0, _q_arg1);
+ return context->thisObject();
+ }
+ if (context->argumentCount() == 3) {
+ double _q_arg0 = context->argument(0).toNumber();
+ char _q_arg1 = qscriptvalue_cast<char>(context->argument(1));
+ int _q_arg2 = context->argument(2).toInt32();
+ _q_self->setNum(_q_arg0, _q_arg1, _q_arg2);
+ return context->thisObject();
+ }
+ break;
+
+ case 35:
+ if (context->argumentCount() == 1) {
+ float _q_arg0 = qscriptvalue_cast<float>(context->argument(0));
+ _q_self->setNum(_q_arg0);
+ return context->thisObject();
+ }
+ if (context->argumentCount() == 2) {
+ float _q_arg0 = qscriptvalue_cast<float>(context->argument(0));
+ char _q_arg1 = qscriptvalue_cast<char>(context->argument(1));
+ _q_self->setNum(_q_arg0, _q_arg1);
+ return context->thisObject();
+ }
+ if (context->argumentCount() == 3) {
+ float _q_arg0 = qscriptvalue_cast<float>(context->argument(0));
+ char _q_arg1 = qscriptvalue_cast<char>(context->argument(1));
+ int _q_arg2 = context->argument(2).toInt32();
+ _q_self->setNum(_q_arg0, _q_arg1, _q_arg2);
+ return context->thisObject();
+ }
+ break;
+
+ case 36:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setNum(_q_arg0);
+ return context->thisObject();
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ _q_self->setNum(_q_arg0, _q_arg1);
+ return context->thisObject();
+ }
+ break;
+
+ case 37:
+ if (context->argumentCount() == 1) {
+ qlonglong _q_arg0 = qscriptvalue_cast<qlonglong>(context->argument(0));
+ _q_self->setNum(_q_arg0);
+ return context->thisObject();
+ }
+ if (context->argumentCount() == 2) {
+ qlonglong _q_arg0 = qscriptvalue_cast<qlonglong>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ _q_self->setNum(_q_arg0, _q_arg1);
+ return context->thisObject();
+ }
+ break;
+
+ case 38:
+ if (context->argumentCount() == 1) {
+ short _q_arg0 = qscriptvalue_cast<short>(context->argument(0));
+ _q_self->setNum(_q_arg0);
+ return context->thisObject();
+ }
+ if (context->argumentCount() == 2) {
+ short _q_arg0 = qscriptvalue_cast<short>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ _q_self->setNum(_q_arg0, _q_arg1);
+ return context->thisObject();
+ }
+ break;
+
+ case 39:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->simplified();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 40:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->size();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 41:
+ if (context->argumentCount() == 1) {
+ char _q_arg0 = qscriptvalue_cast<char>(context->argument(0));
+ QList<QByteArray> _q_result = _q_self->split(_q_arg0);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 42:
+ if (context->argumentCount() == 0) {
+ _q_self->squeeze();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 43:
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<char>() == context->argument(0).toVariant().userType())) {
+ char _q_arg0 = qscriptvalue_cast<char>(context->argument(0));
+ bool _q_result = _q_self->startsWith(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ bool _q_result = _q_self->startsWith(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 44:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->toBase64();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 45:
+ if (context->argumentCount() == 0) {
+
+ // TEMPLATE - core.prepare_removed_bool*_argument - START
+ bool __ok;
+ bool *_q_arg0 = &__ok;
+ // TEMPLATE - core.prepare_removed_bool*_argument - END
+ double _q_result = _q_self->toDouble(_q_arg0);
+
+ // TEMPLATE - core.convert_to_null_or_primitive - START
+ QScriptValue _q_convertedResult;
+ if (!__ok)
+ _q_convertedResult = context->engine()->nullValue();
+ else
+ _q_convertedResult = QScriptValue(context->engine(), _q_result);
+ // TEMPLATE - core.convert_to_null_or_primitive - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 46:
+ if (context->argumentCount() == 0) {
+
+ // TEMPLATE - core.prepare_removed_bool*_argument - START
+ bool __ok;
+ bool *_q_arg0 = &__ok;
+ // TEMPLATE - core.prepare_removed_bool*_argument - END
+ float _q_result = _q_self->toFloat(_q_arg0);
+
+ // TEMPLATE - core.convert_to_null_or_primitive - START
+ QScriptValue _q_convertedResult;
+ if (!__ok)
+ _q_convertedResult = context->engine()->nullValue();
+ else
+ _q_convertedResult = QScriptValue(context->engine(), _q_result);
+ // TEMPLATE - core.convert_to_null_or_primitive - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 47:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->toHex();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 48:
+ if (context->argumentCount() == 0) {
+
+ // TEMPLATE - core.prepare_removed_bool*_argument - START
+ bool __ok;
+ bool *_q_arg0 = &__ok;
+ // TEMPLATE - core.prepare_removed_bool*_argument - END
+ int _q_result = _q_self->toInt(_q_arg0);
+
+ // TEMPLATE - core.convert_to_null_or_primitive - START
+ QScriptValue _q_convertedResult;
+ if (!__ok)
+ _q_convertedResult = context->engine()->nullValue();
+ else
+ _q_convertedResult = QScriptValue(context->engine(), _q_result);
+ // TEMPLATE - core.convert_to_null_or_primitive - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ if (context->argumentCount() == 1) {
+
+ // TEMPLATE - core.prepare_removed_bool*_argument - START
+ bool __ok;
+ bool *_q_arg0 = &__ok;
+ // TEMPLATE - core.prepare_removed_bool*_argument - END
+ int _q_arg1 = context->argument(0).toInt32();
+ int _q_result = _q_self->toInt(_q_arg0, _q_arg1);
+
+ // TEMPLATE - core.convert_to_null_or_primitive - START
+ QScriptValue _q_convertedResult;
+ if (!__ok)
+ _q_convertedResult = context->engine()->nullValue();
+ else
+ _q_convertedResult = QScriptValue(context->engine(), _q_result);
+ // TEMPLATE - core.convert_to_null_or_primitive - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 49:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->toLower();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 50:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->toPercentEncoding();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QByteArray _q_result = _q_self->toPercentEncoding(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QByteArray _q_arg1 = qscriptvalue_cast<QByteArray>(context->argument(1));
+ QByteArray _q_result = _q_self->toPercentEncoding(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QByteArray _q_arg1 = qscriptvalue_cast<QByteArray>(context->argument(1));
+ char _q_arg2 = qscriptvalue_cast<char>(context->argument(2));
+ QByteArray _q_result = _q_self->toPercentEncoding(_q_arg0, _q_arg1, _q_arg2);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 51:
+ if (context->argumentCount() == 0) {
+
+ // TEMPLATE - core.prepare_removed_bool*_argument - START
+ bool __ok;
+ bool *_q_arg0 = &__ok;
+ // TEMPLATE - core.prepare_removed_bool*_argument - END
+ ushort _q_result = _q_self->toUShort(_q_arg0);
+
+ // TEMPLATE - core.convert_to_null_or_primitive - START
+ QScriptValue _q_convertedResult;
+ if (!__ok)
+ _q_convertedResult = context->engine()->nullValue();
+ else
+ _q_convertedResult = QScriptValue(context->engine(), _q_result);
+ // TEMPLATE - core.convert_to_null_or_primitive - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ if (context->argumentCount() == 1) {
+
+ // TEMPLATE - core.prepare_removed_bool*_argument - START
+ bool __ok;
+ bool *_q_arg0 = &__ok;
+ // TEMPLATE - core.prepare_removed_bool*_argument - END
+ int _q_arg1 = context->argument(0).toInt32();
+ ushort _q_result = _q_self->toUShort(_q_arg0, _q_arg1);
+
+ // TEMPLATE - core.convert_to_null_or_primitive - START
+ QScriptValue _q_convertedResult;
+ if (!__ok)
+ _q_convertedResult = context->engine()->nullValue();
+ else
+ _q_convertedResult = QScriptValue(context->engine(), _q_result);
+ // TEMPLATE - core.convert_to_null_or_primitive - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 52:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->toUpper();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 53:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->trimmed();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 54:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->truncate(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 55:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator<<(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 56: {
+ QString result = QString::fromLatin1("QByteArray");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QByteArray_throw_ambiguity_error_helper(context,
+ qtscript_QByteArray_function_names[_id+7],
+ qtscript_QByteArray_function_signatures[_id+7]);
+}
+
+static QScriptValue qtscript_QByteArray_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QByteArray(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QByteArray _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QByteArray _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argument(0).isString()) {
+
+ // TEMPLATE - core.convert_string_arg_to_char* - START
+ QByteArray tmp__q_arg0 = context->argument(0).toString().toLatin1();
+ const char * _q_arg0 = tmp__q_arg0.constData();
+ // TEMPLATE - core.convert_string_arg_to_char* - END
+ QByteArray _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ char _q_arg1 = qscriptvalue_cast<char>(context->argument(1));
+ QByteArray _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QByteArray _q_result = QByteArray::fromBase64(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QByteArray _q_result = QByteArray::fromHex(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QByteArray _q_result = QByteArray::number(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ QByteArray _q_result = QByteArray::number(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ qlonglong _q_arg0 = qscriptvalue_cast<qlonglong>(context->argument(0));
+ QByteArray _q_result = QByteArray::number(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ qlonglong _q_arg0 = qscriptvalue_cast<qlonglong>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ QByteArray _q_result = QByteArray::number(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QByteArray _q_result = QByteArray::fromPercentEncoding(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ char _q_arg1 = qscriptvalue_cast<char>(context->argument(1));
+ QByteArray _q_result = QByteArray::fromPercentEncoding(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 1) {
+ double _q_arg0 = context->argument(0).toNumber();
+ QByteArray _q_result = QByteArray::number(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ double _q_arg0 = context->argument(0).toNumber();
+ char _q_arg1 = qscriptvalue_cast<char>(context->argument(1));
+ QByteArray _q_result = QByteArray::number(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ double _q_arg0 = context->argument(0).toNumber();
+ char _q_arg1 = qscriptvalue_cast<char>(context->argument(1));
+ int _q_arg2 = context->argument(2).toInt32();
+ QByteArray _q_result = QByteArray::number(_q_arg0, _q_arg1, _q_arg2);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QByteArray_throw_ambiguity_error_helper(context,
+ qtscript_QByteArray_function_names[_id],
+ qtscript_QByteArray_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QByteArray_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 2
+ // static
+ , 1
+ , 1
+ , 2
+ , 2
+ , 2
+ , 3
+ // prototype
+ , 2
+ , 1
+ , 1
+ , 0
+ , 1
+ , 0
+ , 1
+ , 1
+ , 2
+ , 2
+ , 2
+ , 2
+ , 2
+ , 0
+ , 0
+ , 2
+ , 2
+ , 1
+ , 3
+ , 0
+ , 2
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 2
+ , 1
+ , 4
+ , 1
+ , 1
+ , 1
+ , 3
+ , 3
+ , 3
+ , 2
+ , 2
+ , 2
+ , 0
+ , 0
+ , 1
+ , 0
+ , 1
+ , 0
+ , 1
+ , 1
+ , 0
+ , 2
+ , 0
+ , 3
+ , 2
+ , 0
+ , 0
+ , 1
+ , 1
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QByteArray*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QByteArray*)0));
+ for (int i = 0; i < 57; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QByteArray_prototype_call, function_lengths[i+7]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QByteArray_function_names[i+7]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QByteArray>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QByteArray*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QByteArray_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 6; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QByteArray_static_call,
+ function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_QByteArray_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QByteArrayMatcher.cpp b/qtbindings/com_nokia_qt_core/qtscript_QByteArrayMatcher.cpp
new file mode 100644
index 0000000..cabc28e
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QByteArrayMatcher.cpp
@@ -0,0 +1,244 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qbytearraymatcher.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qbytearraymatcher.h>
+
+static const char * const qtscript_QByteArrayMatcher_function_names[] = {
+ "QByteArrayMatcher"
+ // static
+ // prototype
+ , "indexIn"
+ , "pattern"
+ , "setPattern"
+ , "toString"
+};
+
+static const char * const qtscript_QByteArrayMatcher_function_signatures[] = {
+ "\nQByteArray pattern\nQByteArrayMatcher other\nchar pattern, int length"
+ // static
+ // prototype
+ , "QByteArray ba, int from\nchar str, int len, int from"
+ , ""
+ , "QByteArray pattern"
+""
+};
+
+static QScriptValue qtscript_QByteArrayMatcher_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QByteArrayMatcher::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QByteArrayMatcher)
+Q_DECLARE_METATYPE(QByteArrayMatcher*)
+Q_DECLARE_METATYPE(char*)
+
+//
+// QByteArrayMatcher
+//
+
+static QScriptValue qtscript_QByteArrayMatcher_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 3;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QByteArrayMatcher* _q_self = qscriptvalue_cast<QByteArrayMatcher*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QByteArrayMatcher.%0(): this object is not a QByteArrayMatcher")
+ .arg(qtscript_QByteArrayMatcher_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ int _q_result = _q_self->indexIn(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())
+ && context->argument(1).isNumber()) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_result = _q_self->indexIn(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (qscriptvalue_cast<char*>(context->argument(0))
+ && context->argument(1).isNumber()) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_result = _q_self->indexIn(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 3) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_arg2 = context->argument(2).toInt32();
+ int _q_result = _q_self->indexIn(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->pattern();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ _q_self->setPattern(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 3: {
+ QString result = QString::fromLatin1("QByteArrayMatcher");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QByteArrayMatcher_throw_ambiguity_error_helper(context,
+ qtscript_QByteArrayMatcher_function_names[_id+1],
+ qtscript_QByteArrayMatcher_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QByteArrayMatcher_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QByteArrayMatcher(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QByteArrayMatcher _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QByteArrayMatcher _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if ((qMetaTypeId<QByteArrayMatcher>() == context->argument(0).toVariant().userType())) {
+ QByteArrayMatcher _q_arg0 = qscriptvalue_cast<QByteArrayMatcher>(context->argument(0));
+ QByteArrayMatcher _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 2) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ QByteArrayMatcher _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QByteArrayMatcher_throw_ambiguity_error_helper(context,
+ qtscript_QByteArrayMatcher_function_names[_id],
+ qtscript_QByteArrayMatcher_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QByteArrayMatcher_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 2
+ // static
+ // prototype
+ , 3
+ , 0
+ , 1
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QByteArrayMatcher*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QByteArrayMatcher*)0));
+ for (int i = 0; i < 4; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QByteArrayMatcher_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QByteArrayMatcher_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QByteArrayMatcher>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QByteArrayMatcher*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QByteArrayMatcher_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QChildEvent.cpp b/qtbindings/com_nokia_qt_core/qtscript_QChildEvent.cpp
new file mode 100644
index 0000000..4cf6c18
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QChildEvent.cpp
@@ -0,0 +1,217 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qcoreevent.h>
+#include <QVariant>
+#include <qobject.h>
+
+#include "qtscriptshell_QChildEvent.h"
+
+static const char * const qtscript_QChildEvent_function_names[] = {
+ "QChildEvent"
+ // static
+ // prototype
+ , "added"
+ , "child"
+ , "polished"
+ , "removed"
+ , "toString"
+};
+
+static const char * const qtscript_QChildEvent_function_signatures[] = {
+ "Type type, QObject child"
+ // static
+ // prototype
+ , ""
+ , ""
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QChildEvent_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QChildEvent::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QtScriptShell_QChildEvent*)
+Q_DECLARE_METATYPE(QEvent::Type)
+Q_DECLARE_METATYPE(QEvent*)
+
+//
+// QChildEvent
+//
+
+static QScriptValue qtscript_QChildEvent_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 4;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QChildEvent* _q_self = qscriptvalue_cast<QChildEvent*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QChildEvent.%0(): this object is not a QChildEvent")
+ .arg(qtscript_QChildEvent_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->added();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QObject* _q_result = _q_self->child();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->polished();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->removed();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4: {
+ QString result = QString::fromLatin1("QChildEvent");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QChildEvent_throw_ambiguity_error_helper(context,
+ qtscript_QChildEvent_function_names[_id+1],
+ qtscript_QChildEvent_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QChildEvent_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QChildEvent(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 2) {
+ QEvent::Type _q_arg0 = qscriptvalue_cast<QEvent::Type>(context->argument(0));
+ QObject* _q_arg1 = context->argument(1).toQObject();
+ QtScriptShell_QChildEvent* _q_cpp_result = new QtScriptShell_QChildEvent(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QChildEvent*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QChildEvent_throw_ambiguity_error_helper(context,
+ qtscript_QChildEvent_function_names[_id],
+ qtscript_QChildEvent_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QChildEvent_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 2
+ // static
+ // prototype
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QChildEvent*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QChildEvent*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QEvent*>()));
+ for (int i = 0; i < 5; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QChildEvent_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QChildEvent_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QChildEvent*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QChildEvent_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QCoreApplication.cpp b/qtbindings/com_nokia_qt_core/qtscript_QCoreApplication.cpp
new file mode 100644
index 0000000..4368b1f
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QCoreApplication.cpp
@@ -0,0 +1,655 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qcoreapplication.h>
+#include <QStringList>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreapplication.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qstringlist.h>
+#include <qtranslator.h>
+
+#include "qtscriptshell_QCoreApplication.h"
+
+static const char * const qtscript_QCoreApplication_function_names[] = {
+ "QCoreApplication"
+ // static
+ , "addLibraryPath"
+ , "applicationDirPath"
+ , "applicationFilePath"
+ , "applicationPid"
+ , "closingDown"
+ , "exec"
+ , "exit"
+ , "flush"
+ , "hasPendingEvents"
+ , "installTranslator"
+ , "instance"
+ , "libraryPaths"
+ , "postEvent"
+ , "processEvents"
+ , "removeLibraryPath"
+ , "removePostedEvents"
+ , "removeTranslator"
+ , "sendEvent"
+ , "sendPostedEvents"
+ , "setAttribute"
+ , "setLibraryPaths"
+ , "startingUp"
+ , "testAttribute"
+ , "translate"
+ // prototype
+ , "notify"
+ , "toString"
+};
+
+static const char * const qtscript_QCoreApplication_function_signatures[] = {
+ ""
+ // static
+ , "String arg__1"
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "int retcode"
+ , ""
+ , ""
+ , "QTranslator messageFile"
+ , ""
+ , ""
+ , "QObject receiver, QEvent event\nQObject receiver, QEvent event, int priority"
+ , "ProcessEventsFlags flags\nProcessEventsFlags flags, int maxtime"
+ , "String arg__1"
+ , "QObject receiver\nQObject receiver, int eventType"
+ , "QTranslator messageFile"
+ , "QObject receiver, QEvent event"
+ , "\nQObject receiver, int event_type"
+ , "ApplicationAttribute attribute, bool on"
+ , "List arg__1"
+ , ""
+ , "ApplicationAttribute attribute"
+ , "char context, char key, char disambiguation, Encoding encoding\nchar context, char key, char disambiguation, Encoding encoding, int n"
+ // prototype
+ , "QObject arg__1, QEvent arg__2"
+""
+};
+
+static QScriptValue qtscript_QCoreApplication_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QCoreApplication::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QCoreApplication*)
+Q_DECLARE_METATYPE(QtScriptShell_QCoreApplication*)
+Q_DECLARE_METATYPE(QCoreApplication::Encoding)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QTranslator*)
+Q_DECLARE_METATYPE(QFlags<QEventLoop::ProcessEventsFlag>)
+Q_DECLARE_METATYPE(Qt::ApplicationAttribute)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// QCoreApplication::Encoding
+//
+
+static const QCoreApplication::Encoding qtscript_QCoreApplication_Encoding_values[] = {
+ QCoreApplication::CodecForTr
+ , QCoreApplication::UnicodeUTF8
+};
+
+static const char * const qtscript_QCoreApplication_Encoding_keys[] = {
+ "CodecForTr"
+ , "UnicodeUTF8"
+};
+
+static QString qtscript_QCoreApplication_Encoding_toStringHelper(QCoreApplication::Encoding value)
+{
+ if ((value >= QCoreApplication::CodecForTr) && (value <= QCoreApplication::UnicodeUTF8))
+ return qtscript_QCoreApplication_Encoding_keys[static_cast<int>(value)-static_cast<int>(QCoreApplication::CodecForTr)];
+ return QString();
+}
+
+static QScriptValue qtscript_QCoreApplication_Encoding_toScriptValue(QScriptEngine *engine, const QCoreApplication::Encoding &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QCoreApplication"));
+ return clazz.property(qtscript_QCoreApplication_Encoding_toStringHelper(value));
+}
+
+static void qtscript_QCoreApplication_Encoding_fromScriptValue(const QScriptValue &value, QCoreApplication::Encoding &out)
+{
+ out = qvariant_cast<QCoreApplication::Encoding>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QCoreApplication_Encoding(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QCoreApplication::CodecForTr) && (arg <= QCoreApplication::UnicodeUTF8))
+ return qScriptValueFromValue(engine, static_cast<QCoreApplication::Encoding>(arg));
+ return context->throwError(QString::fromLatin1("Encoding(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QCoreApplication_Encoding_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QCoreApplication::Encoding value = qscriptvalue_cast<QCoreApplication::Encoding>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QCoreApplication_Encoding_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QCoreApplication::Encoding value = qscriptvalue_cast<QCoreApplication::Encoding>(context->thisObject());
+ return QScriptValue(engine, qtscript_QCoreApplication_Encoding_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QCoreApplication_Encoding_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QCoreApplication_Encoding,
+ qtscript_QCoreApplication_Encoding_valueOf, qtscript_QCoreApplication_Encoding_toString);
+ qScriptRegisterMetaType<QCoreApplication::Encoding>(engine, qtscript_QCoreApplication_Encoding_toScriptValue,
+ qtscript_QCoreApplication_Encoding_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QCoreApplication_Encoding_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QCoreApplication_Encoding_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QCoreApplication
+//
+
+static QScriptValue qtscript_QCoreApplication_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 1;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QCoreApplication* _q_self = qscriptvalue_cast<QCoreApplication*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QCoreApplication.%0(): this object is not a QCoreApplication")
+ .arg(qtscript_QCoreApplication_function_names[_id+25]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 2) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QEvent* _q_arg1 = qscriptvalue_cast<QEvent*>(context->argument(1));
+ bool _q_result = _q_self->notify(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1: {
+ QString result = QString::fromLatin1("QCoreApplication");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QCoreApplication_throw_ambiguity_error_helper(context,
+ qtscript_QCoreApplication_function_names[_id+25],
+ qtscript_QCoreApplication_function_signatures[_id+25]);
+}
+
+static QScriptValue qtscript_QCoreApplication_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QCoreApplication cannot be constructed"));
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QCoreApplication::addLibraryPath(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QString _q_result = QCoreApplication::applicationDirPath();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QString _q_result = QCoreApplication::applicationFilePath();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ qint64 _q_result = QCoreApplication::applicationPid();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ bool _q_result = QCoreApplication::closingDown();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ int _q_result = QCoreApplication::exec();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ QCoreApplication::exit();
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QCoreApplication::exit(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 0) {
+ QCoreApplication::flush();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 0) {
+ bool _q_result = QCoreApplication::hasPendingEvents();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 1) {
+ QTranslator* _q_arg0 = qscriptvalue_cast<QTranslator*>(context->argument(0));
+ QCoreApplication::installTranslator(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 0) {
+ QCoreApplication* _q_result = QCoreApplication::instance();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 0) {
+ QStringList _q_result = QCoreApplication::libraryPaths();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 2) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QEvent* _q_arg1 = qscriptvalue_cast<QEvent*>(context->argument(1));
+ QCoreApplication::postEvent(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 3) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QEvent* _q_arg1 = qscriptvalue_cast<QEvent*>(context->argument(1));
+ int _q_arg2 = context->argument(2).toInt32();
+ QCoreApplication::postEvent(_q_arg0, _q_arg1, _q_arg2);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 0) {
+ QCoreApplication::processEvents();
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 1) {
+ QFlags<QEventLoop::ProcessEventsFlag> _q_arg0 = qscriptvalue_cast<QFlags<QEventLoop::ProcessEventsFlag> >(context->argument(0));
+ QCoreApplication::processEvents(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ QFlags<QEventLoop::ProcessEventsFlag> _q_arg0 = qscriptvalue_cast<QFlags<QEventLoop::ProcessEventsFlag> >(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ QCoreApplication::processEvents(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QCoreApplication::removeLibraryPath(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 1) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QCoreApplication::removePostedEvents(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ int _q_arg1 = context->argument(1).toInt32();
+ QCoreApplication::removePostedEvents(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 1) {
+ QTranslator* _q_arg0 = qscriptvalue_cast<QTranslator*>(context->argument(0));
+ QCoreApplication::removeTranslator(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 2) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QEvent* _q_arg1 = qscriptvalue_cast<QEvent*>(context->argument(1));
+ bool _q_result = QCoreApplication::sendEvent(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 0) {
+ QCoreApplication::sendPostedEvents();
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ int _q_arg1 = context->argument(1).toInt32();
+ QCoreApplication::sendPostedEvents(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 1) {
+ Qt::ApplicationAttribute _q_arg0 = qscriptvalue_cast<Qt::ApplicationAttribute>(context->argument(0));
+ QCoreApplication::setAttribute(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ Qt::ApplicationAttribute _q_arg0 = qscriptvalue_cast<Qt::ApplicationAttribute>(context->argument(0));
+ bool _q_arg1 = context->argument(1).toBoolean();
+ QCoreApplication::setAttribute(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 21:
+ if (context->argumentCount() == 1) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ QCoreApplication::setLibraryPaths(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 22:
+ if (context->argumentCount() == 0) {
+ bool _q_result = QCoreApplication::startingUp();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 23:
+ if (context->argumentCount() == 1) {
+ Qt::ApplicationAttribute _q_arg0 = qscriptvalue_cast<Qt::ApplicationAttribute>(context->argument(0));
+ bool _q_result = QCoreApplication::testAttribute(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 24:
+ if (context->argumentCount() == 2) {
+
+ // TEMPLATE - core.convert_string_arg_to_char* - START
+ QByteArray tmp__q_arg0 = context->argument(0).toString().toLatin1();
+ const char * _q_arg0 = tmp__q_arg0.constData();
+ // TEMPLATE - core.convert_string_arg_to_char* - END
+
+ // TEMPLATE - core.convert_string_arg_to_char* - START
+ QByteArray tmp__q_arg1 = context->argument(1).toString().toLatin1();
+ const char * _q_arg1 = tmp__q_arg1.constData();
+ // TEMPLATE - core.convert_string_arg_to_char* - END
+ QString _q_result = QCoreApplication::translate(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+
+ // TEMPLATE - core.convert_string_arg_to_char* - START
+ QByteArray tmp__q_arg0 = context->argument(0).toString().toLatin1();
+ const char * _q_arg0 = tmp__q_arg0.constData();
+ // TEMPLATE - core.convert_string_arg_to_char* - END
+
+ // TEMPLATE - core.convert_string_arg_to_char* - START
+ QByteArray tmp__q_arg1 = context->argument(1).toString().toLatin1();
+ const char * _q_arg1 = tmp__q_arg1.constData();
+ // TEMPLATE - core.convert_string_arg_to_char* - END
+
+ // TEMPLATE - core.convert_string_arg_to_char* - START
+ QByteArray tmp__q_arg2 = context->argument(2).toString().toLatin1();
+ const char * _q_arg2 = tmp__q_arg2.constData();
+ // TEMPLATE - core.convert_string_arg_to_char* - END
+ QString _q_result = QCoreApplication::translate(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 4) {
+
+ // TEMPLATE - core.convert_string_arg_to_char* - START
+ QByteArray tmp__q_arg0 = context->argument(0).toString().toLatin1();
+ const char * _q_arg0 = tmp__q_arg0.constData();
+ // TEMPLATE - core.convert_string_arg_to_char* - END
+
+ // TEMPLATE - core.convert_string_arg_to_char* - START
+ QByteArray tmp__q_arg1 = context->argument(1).toString().toLatin1();
+ const char * _q_arg1 = tmp__q_arg1.constData();
+ // TEMPLATE - core.convert_string_arg_to_char* - END
+
+ // TEMPLATE - core.convert_string_arg_to_char* - START
+ QByteArray tmp__q_arg2 = context->argument(2).toString().toLatin1();
+ const char * _q_arg2 = tmp__q_arg2.constData();
+ // TEMPLATE - core.convert_string_arg_to_char* - END
+ QCoreApplication::Encoding _q_arg3 = qscriptvalue_cast<QCoreApplication::Encoding>(context->argument(3));
+ QString _q_result = QCoreApplication::translate(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 5) {
+
+ // TEMPLATE - core.convert_string_arg_to_char* - START
+ QByteArray tmp__q_arg0 = context->argument(0).toString().toLatin1();
+ const char * _q_arg0 = tmp__q_arg0.constData();
+ // TEMPLATE - core.convert_string_arg_to_char* - END
+
+ // TEMPLATE - core.convert_string_arg_to_char* - START
+ QByteArray tmp__q_arg1 = context->argument(1).toString().toLatin1();
+ const char * _q_arg1 = tmp__q_arg1.constData();
+ // TEMPLATE - core.convert_string_arg_to_char* - END
+
+ // TEMPLATE - core.convert_string_arg_to_char* - START
+ QByteArray tmp__q_arg2 = context->argument(2).toString().toLatin1();
+ const char * _q_arg2 = tmp__q_arg2.constData();
+ // TEMPLATE - core.convert_string_arg_to_char* - END
+ QCoreApplication::Encoding _q_arg3 = qscriptvalue_cast<QCoreApplication::Encoding>(context->argument(3));
+ int _q_arg4 = context->argument(4).toInt32();
+ QString _q_result = QCoreApplication::translate(_q_arg0, _q_arg1, _q_arg2, _q_arg3, _q_arg4);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QCoreApplication_throw_ambiguity_error_helper(context,
+ qtscript_QCoreApplication_function_names[_id],
+ qtscript_QCoreApplication_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QCoreApplication_toScriptValue(QScriptEngine *engine, QCoreApplication* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QCoreApplication_fromScriptValue(const QScriptValue &value, QCoreApplication* &out)
+{
+ out = qobject_cast<QCoreApplication*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QCoreApplication_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 0
+ // static
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 3
+ , 2
+ , 1
+ , 2
+ , 1
+ , 2
+ , 2
+ , 2
+ , 1
+ , 0
+ , 1
+ , 5
+ // prototype
+ , 2
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QCoreApplication*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QCoreApplication*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
+ for (int i = 0; i < 2; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QCoreApplication_prototype_call, function_lengths[i+25]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QCoreApplication_function_names[i+25]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<QCoreApplication*>(engine, qtscript_QCoreApplication_toScriptValue,
+ qtscript_QCoreApplication_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QCoreApplication_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 24; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QCoreApplication_static_call,
+ function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_QCoreApplication_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ ctor.setProperty(QString::fromLatin1("Encoding"),
+ qtscript_create_QCoreApplication_Encoding_class(engine, ctor));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QCryptographicHash.cpp b/qtbindings/com_nokia_qt_core/qtscript_QCryptographicHash.cpp
new file mode 100644
index 0000000..7c435ac
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QCryptographicHash.cpp
@@ -0,0 +1,306 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qcryptographichash.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcryptographichash.h>
+
+static const char * const qtscript_QCryptographicHash_function_names[] = {
+ "QCryptographicHash"
+ // static
+ , "hash"
+ // prototype
+ , "addData"
+ , "reset"
+ , "result"
+ , "toString"
+};
+
+static const char * const qtscript_QCryptographicHash_function_signatures[] = {
+ "Algorithm method"
+ // static
+ , "QByteArray data, Algorithm method"
+ // prototype
+ , "QByteArray data"
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QCryptographicHash_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QCryptographicHash::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QCryptographicHash*)
+Q_DECLARE_METATYPE(QCryptographicHash::Algorithm)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// QCryptographicHash::Algorithm
+//
+
+static const QCryptographicHash::Algorithm qtscript_QCryptographicHash_Algorithm_values[] = {
+ QCryptographicHash::Md4
+ , QCryptographicHash::Md5
+ , QCryptographicHash::Sha1
+};
+
+static const char * const qtscript_QCryptographicHash_Algorithm_keys[] = {
+ "Md4"
+ , "Md5"
+ , "Sha1"
+};
+
+static QString qtscript_QCryptographicHash_Algorithm_toStringHelper(QCryptographicHash::Algorithm value)
+{
+ if ((value >= QCryptographicHash::Md4) && (value <= QCryptographicHash::Sha1))
+ return qtscript_QCryptographicHash_Algorithm_keys[static_cast<int>(value)-static_cast<int>(QCryptographicHash::Md4)];
+ return QString();
+}
+
+static QScriptValue qtscript_QCryptographicHash_Algorithm_toScriptValue(QScriptEngine *engine, const QCryptographicHash::Algorithm &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QCryptographicHash"));
+ return clazz.property(qtscript_QCryptographicHash_Algorithm_toStringHelper(value));
+}
+
+static void qtscript_QCryptographicHash_Algorithm_fromScriptValue(const QScriptValue &value, QCryptographicHash::Algorithm &out)
+{
+ out = qvariant_cast<QCryptographicHash::Algorithm>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QCryptographicHash_Algorithm(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QCryptographicHash::Md4) && (arg <= QCryptographicHash::Sha1))
+ return qScriptValueFromValue(engine, static_cast<QCryptographicHash::Algorithm>(arg));
+ return context->throwError(QString::fromLatin1("Algorithm(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QCryptographicHash_Algorithm_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QCryptographicHash::Algorithm value = qscriptvalue_cast<QCryptographicHash::Algorithm>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QCryptographicHash_Algorithm_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QCryptographicHash::Algorithm value = qscriptvalue_cast<QCryptographicHash::Algorithm>(context->thisObject());
+ return QScriptValue(engine, qtscript_QCryptographicHash_Algorithm_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QCryptographicHash_Algorithm_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QCryptographicHash_Algorithm,
+ qtscript_QCryptographicHash_Algorithm_valueOf, qtscript_QCryptographicHash_Algorithm_toString);
+ qScriptRegisterMetaType<QCryptographicHash::Algorithm>(engine, qtscript_QCryptographicHash_Algorithm_toScriptValue,
+ qtscript_QCryptographicHash_Algorithm_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QCryptographicHash_Algorithm_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QCryptographicHash_Algorithm_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QCryptographicHash
+//
+
+static QScriptValue qtscript_QCryptographicHash_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 3;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QCryptographicHash* _q_self = qscriptvalue_cast<QCryptographicHash*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QCryptographicHash.%0(): this object is not a QCryptographicHash")
+ .arg(qtscript_QCryptographicHash_function_names[_id+2]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ _q_self->addData(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ _q_self->reset();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->result();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3: {
+ QString result = QString::fromLatin1("QCryptographicHash");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QCryptographicHash_throw_ambiguity_error_helper(context,
+ qtscript_QCryptographicHash_function_names[_id+2],
+ qtscript_QCryptographicHash_function_signatures[_id+2]);
+}
+
+static QScriptValue qtscript_QCryptographicHash_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QCryptographicHash(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 1) {
+ QCryptographicHash::Algorithm _q_arg0 = qscriptvalue_cast<QCryptographicHash::Algorithm>(context->argument(0));
+ QCryptographicHash* _q_cpp_result = new QCryptographicHash(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 2) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QCryptographicHash::Algorithm _q_arg1 = qscriptvalue_cast<QCryptographicHash::Algorithm>(context->argument(1));
+ QByteArray _q_result = QCryptographicHash::hash(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QCryptographicHash_throw_ambiguity_error_helper(context,
+ qtscript_QCryptographicHash_function_names[_id],
+ qtscript_QCryptographicHash_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QCryptographicHash_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ , 2
+ // prototype
+ , 1
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QCryptographicHash*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QCryptographicHash*)0));
+ for (int i = 0; i < 4; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QCryptographicHash_prototype_call, function_lengths[i+2]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QCryptographicHash_function_names[i+2]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QCryptographicHash*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QCryptographicHash_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 1; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QCryptographicHash_static_call,
+ function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_QCryptographicHash_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ ctor.setProperty(QString::fromLatin1("Algorithm"),
+ qtscript_create_QCryptographicHash_Algorithm_class(engine, ctor));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QDataStream.cpp b/qtbindings/com_nokia_qt_core/qtscript_QDataStream.cpp
new file mode 100644
index 0000000..ab313d9
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QDataStream.cpp
@@ -0,0 +1,703 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qdatastream.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qdatastream.h>
+#include <qiodevice.h>
+
+#include "qtscriptshell_QDataStream.h"
+
+static const char * const qtscript_QDataStream_function_names[] = {
+ "QDataStream"
+ // static
+ // prototype
+ , "atEnd"
+ , "device"
+ , "readBoolean"
+ , "readByte"
+ , "readDouble"
+ , "readFloat"
+ , "readInt"
+ , "readLongLong"
+ , "readShort"
+ , "readUInt"
+ , "readULongLong"
+ , "readUShort"
+ , "resetStatus"
+ , "setDevice"
+ , "setStatus"
+ , "setVersion"
+ , "skipRawData"
+ , "status"
+ , "unsetDevice"
+ , "version"
+ , "writeBoolean"
+ , "writeByte"
+ , "writeDouble"
+ , "writeFloat"
+ , "writeInt"
+ , "writeLongLong"
+ , "writeShort"
+ , "toString"
+};
+
+static const char * const qtscript_QDataStream_function_signatures[] = {
+ "\nQByteArray arg__1, OpenMode flags\nQIODevice arg__1\nQByteArray arg__1"
+ // static
+ // prototype
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "QIODevice arg__1"
+ , "Status status"
+ , "int arg__1"
+ , "int len"
+ , ""
+ , ""
+ , ""
+ , "bool i"
+ , "unsigned char i"
+ , "double f"
+ , "float f"
+ , "int i"
+ , "qint64 i"
+ , "short i"
+""
+};
+
+static QScriptValue qtscript_QDataStream_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QDataStream::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QDataStream*)
+Q_DECLARE_METATYPE(QtScriptShell_QDataStream*)
+Q_DECLARE_METATYPE(QDataStream::Version)
+Q_DECLARE_METATYPE(QDataStream::Status)
+Q_DECLARE_METATYPE(QIODevice*)
+Q_DECLARE_METATYPE(QByteArray*)
+Q_DECLARE_METATYPE(QFlags<QIODevice::OpenModeFlag>)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// QDataStream::Version
+//
+
+static const QDataStream::Version qtscript_QDataStream_Version_values[] = {
+ QDataStream::Qt_1_0
+ , QDataStream::Qt_2_0
+ , QDataStream::Qt_2_1
+ , QDataStream::Qt_3_0
+ , QDataStream::Qt_3_1
+ , QDataStream::Qt_3_3
+ , QDataStream::Qt_4_0
+ , QDataStream::Qt_4_2
+ , QDataStream::Qt_4_3
+ , QDataStream::Qt_4_4
+ , QDataStream::Qt_4_5
+};
+
+static const char * const qtscript_QDataStream_Version_keys[] = {
+ "Qt_1_0"
+ , "Qt_2_0"
+ , "Qt_2_1"
+ , "Qt_3_0"
+ , "Qt_3_1"
+ , "Qt_3_3"
+ , "Qt_4_0"
+ , "Qt_4_2"
+ , "Qt_4_3"
+ , "Qt_4_4"
+ , "Qt_4_5"
+};
+
+static QString qtscript_QDataStream_Version_toStringHelper(QDataStream::Version value)
+{
+ if ((value >= QDataStream::Qt_1_0) && (value <= QDataStream::Qt_4_5))
+ return qtscript_QDataStream_Version_keys[static_cast<int>(value)-static_cast<int>(QDataStream::Qt_1_0)];
+ return QString();
+}
+
+static QScriptValue qtscript_QDataStream_Version_toScriptValue(QScriptEngine *engine, const QDataStream::Version &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QDataStream"));
+ return clazz.property(qtscript_QDataStream_Version_toStringHelper(value));
+}
+
+static void qtscript_QDataStream_Version_fromScriptValue(const QScriptValue &value, QDataStream::Version &out)
+{
+ out = qvariant_cast<QDataStream::Version>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QDataStream_Version(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QDataStream::Qt_1_0) && (arg <= QDataStream::Qt_4_5))
+ return qScriptValueFromValue(engine, static_cast<QDataStream::Version>(arg));
+ return context->throwError(QString::fromLatin1("Version(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QDataStream_Version_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QDataStream::Version value = qscriptvalue_cast<QDataStream::Version>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QDataStream_Version_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QDataStream::Version value = qscriptvalue_cast<QDataStream::Version>(context->thisObject());
+ return QScriptValue(engine, qtscript_QDataStream_Version_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QDataStream_Version_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QDataStream_Version,
+ qtscript_QDataStream_Version_valueOf, qtscript_QDataStream_Version_toString);
+ qScriptRegisterMetaType<QDataStream::Version>(engine, qtscript_QDataStream_Version_toScriptValue,
+ qtscript_QDataStream_Version_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 11; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QDataStream_Version_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QDataStream_Version_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QDataStream::Status
+//
+
+static const QDataStream::Status qtscript_QDataStream_Status_values[] = {
+ QDataStream::Ok
+ , QDataStream::ReadPastEnd
+ , QDataStream::ReadCorruptData
+};
+
+static const char * const qtscript_QDataStream_Status_keys[] = {
+ "Ok"
+ , "ReadPastEnd"
+ , "ReadCorruptData"
+};
+
+static QString qtscript_QDataStream_Status_toStringHelper(QDataStream::Status value)
+{
+ if ((value >= QDataStream::Ok) && (value <= QDataStream::ReadCorruptData))
+ return qtscript_QDataStream_Status_keys[static_cast<int>(value)-static_cast<int>(QDataStream::Ok)];
+ return QString();
+}
+
+static QScriptValue qtscript_QDataStream_Status_toScriptValue(QScriptEngine *engine, const QDataStream::Status &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QDataStream"));
+ return clazz.property(qtscript_QDataStream_Status_toStringHelper(value));
+}
+
+static void qtscript_QDataStream_Status_fromScriptValue(const QScriptValue &value, QDataStream::Status &out)
+{
+ out = qvariant_cast<QDataStream::Status>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QDataStream_Status(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QDataStream::Ok) && (arg <= QDataStream::ReadCorruptData))
+ return qScriptValueFromValue(engine, static_cast<QDataStream::Status>(arg));
+ return context->throwError(QString::fromLatin1("Status(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QDataStream_Status_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QDataStream::Status value = qscriptvalue_cast<QDataStream::Status>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QDataStream_Status_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QDataStream::Status value = qscriptvalue_cast<QDataStream::Status>(context->thisObject());
+ return QScriptValue(engine, qtscript_QDataStream_Status_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QDataStream_Status_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QDataStream_Status,
+ qtscript_QDataStream_Status_valueOf, qtscript_QDataStream_Status_toString);
+ qScriptRegisterMetaType<QDataStream::Status>(engine, qtscript_QDataStream_Status_toScriptValue,
+ qtscript_QDataStream_Status_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QDataStream_Status_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QDataStream_Status_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QDataStream
+//
+
+static QScriptValue qtscript_QDataStream_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 27;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QDataStream* _q_self = qscriptvalue_cast<QDataStream*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QDataStream.%0(): this object is not a QDataStream")
+ .arg(qtscript_QDataStream_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->atEnd();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QIODevice* _q_result = _q_self->device();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+
+ bool __result;
+ bool & _q_arg0 = __result;
+ _q_self->operator>>(_q_arg0);
+
+ bool _q_convertedResult = __result;
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+
+ unsigned char __result;
+ unsigned char & _q_arg0 = __result;
+ _q_self->operator>>(_q_arg0);
+
+ int _q_convertedResult = __result;
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+
+ double __result;
+ double & _q_arg0 = __result;
+ _q_self->operator>>(_q_arg0);
+
+ double _q_convertedResult = __result;
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+
+ float __result;
+ float & _q_arg0 = __result;
+ _q_self->operator>>(_q_arg0);
+
+ float _q_convertedResult = __result;
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+
+ int __result;
+ int & _q_arg0 = __result;
+ _q_self->operator>>(_q_arg0);
+
+ int _q_convertedResult = __result;
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+
+ qint64 __result;
+ qint64 & _q_arg0 = __result;
+ _q_self->operator>>(_q_arg0);
+
+ qint64 _q_convertedResult = __result;
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 0) {
+
+ short __result;
+ short & _q_arg0 = __result;
+ _q_self->operator>>(_q_arg0);
+
+ short _q_convertedResult = __result;
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 0) {
+
+ uint __result;
+ uint & _q_arg0 = __result;
+ _q_self->operator>>(_q_arg0);
+
+ uint _q_convertedResult = __result;
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 0) {
+
+ unsigned long long __result;
+ unsigned long long & _q_arg0 = __result;
+ _q_self->operator>>(_q_arg0);
+
+ unsigned long long _q_convertedResult = __result;
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 0) {
+
+ unsigned short __result;
+ unsigned short & _q_arg0 = __result;
+ _q_self->operator>>(_q_arg0);
+
+ unsigned short _q_convertedResult = __result;
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 0) {
+ _q_self->resetStatus();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 1) {
+ QIODevice* _q_arg0 = qscriptvalue_cast<QIODevice*>(context->argument(0));
+ _q_self->setDevice(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 1) {
+ QDataStream::Status _q_arg0 = qscriptvalue_cast<QDataStream::Status>(context->argument(0));
+ _q_self->setStatus(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setVersion(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_result = _q_self->skipRawData(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 0) {
+ QDataStream::Status _q_result = _q_self->status();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 0) {
+ _q_self->unsetDevice();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->version();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 1) {
+ bool _q_arg0 = context->argument(0).toBoolean();
+ _q_self->operator<<(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 21:
+ if (context->argumentCount() == 1) {
+ unsigned char _q_arg0 = qscriptvalue_cast<unsigned char>(context->argument(0));
+ _q_self->operator<<(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 22:
+ if (context->argumentCount() == 1) {
+ double _q_arg0 = context->argument(0).toNumber();
+ _q_self->operator<<(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 23:
+ if (context->argumentCount() == 1) {
+ float _q_arg0 = qscriptvalue_cast<float>(context->argument(0));
+ _q_self->operator<<(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 24:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->operator<<(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 25:
+ if (context->argumentCount() == 1) {
+ qint64 _q_arg0 = qscriptvalue_cast<qint64>(context->argument(0));
+ _q_self->operator<<(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 26:
+ if (context->argumentCount() == 1) {
+ short _q_arg0 = qscriptvalue_cast<short>(context->argument(0));
+ _q_self->operator<<(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 27: {
+ QString result = QString::fromLatin1("QDataStream");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QDataStream_throw_ambiguity_error_helper(context,
+ qtscript_QDataStream_function_names[_id+1],
+ qtscript_QDataStream_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QDataStream_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QDataStream(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QDataStream* _q_cpp_result = new QtScriptShell_QDataStream();
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QDataStream*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ if (qscriptvalue_cast<QIODevice*>(context->argument(0))) {
+ QIODevice* _q_arg0 = qscriptvalue_cast<QIODevice*>(context->argument(0));
+ QtScriptShell_QDataStream* _q_cpp_result = new QtScriptShell_QDataStream(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QDataStream*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QtScriptShell_QDataStream* _q_cpp_result = new QtScriptShell_QDataStream(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QDataStream*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 2) {
+ QByteArray* _q_arg0 = qscriptvalue_cast<QByteArray*>(context->argument(0));
+ QFlags<QIODevice::OpenModeFlag> _q_arg1 = qscriptvalue_cast<QFlags<QIODevice::OpenModeFlag> >(context->argument(1));
+ QtScriptShell_QDataStream* _q_cpp_result = new QtScriptShell_QDataStream(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QDataStream*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QDataStream_throw_ambiguity_error_helper(context,
+ qtscript_QDataStream_function_names[_id],
+ qtscript_QDataStream_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QDataStream_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 2
+ // static
+ // prototype
+ , 0
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QDataStream*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QDataStream*)0));
+ for (int i = 0; i < 28; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QDataStream_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QDataStream_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QDataStream*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QDataStream_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ ctor.setProperty(QString::fromLatin1("Version"),
+ qtscript_create_QDataStream_Version_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("Status"),
+ qtscript_create_QDataStream_Status_class(engine, ctor));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QDir.cpp b/qtbindings/com_nokia_qt_core/qtscript_QDir.cpp
new file mode 100644
index 0000000..daefeca
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QDir.cpp
@@ -0,0 +1,1285 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qdir.h>
+#include <QVariant>
+#include <qdir.h>
+#include <qfileinfo.h>
+#include <qlist.h>
+#include <qstringlist.h>
+
+static const char * const qtscript_QDir_function_names[] = {
+ "QDir"
+ // static
+ , "addSearchPath"
+ , "cleanPath"
+ , "convertSeparators"
+ , "current"
+ , "currentPath"
+ , "drives"
+ , "fromNativeSeparators"
+ , "home"
+ , "homePath"
+ , "isAbsolutePath"
+ , "isRelativePath"
+ , "match"
+ , "nameFiltersFromString"
+ , "root"
+ , "rootPath"
+ , "searchPaths"
+ , "separator"
+ , "setCurrent"
+ , "setSearchPaths"
+ , "temp"
+ , "tempPath"
+ , "toNativeSeparators"
+ // prototype
+ , "absoluteFilePath"
+ , "absolutePath"
+ , "canonicalPath"
+ , "cd"
+ , "cdUp"
+ , "count"
+ , "dirName"
+ , "entryInfoList"
+ , "entryList"
+ , "exists"
+ , "filePath"
+ , "filter"
+ , "isAbsolute"
+ , "isReadable"
+ , "isRelative"
+ , "isRoot"
+ , "makeAbsolute"
+ , "mkdir"
+ , "mkpath"
+ , "nameFilters"
+ , "equals"
+ , "operator_subscript"
+ , "path"
+ , "refresh"
+ , "relativeFilePath"
+ , "remove"
+ , "rename"
+ , "rmdir"
+ , "rmpath"
+ , "setFilter"
+ , "setNameFilters"
+ , "setPath"
+ , "setSorting"
+ , "sorting"
+ , "toString"
+};
+
+static const char * const qtscript_QDir_function_signatures[] = {
+ "QDir arg__1\nString path\nString path, String nameFilter, SortFlags sort, Filters filter"
+ // static
+ , "String prefix, String path"
+ , "String path"
+ , "String pathName"
+ , ""
+ , ""
+ , ""
+ , "String pathName"
+ , ""
+ , ""
+ , "String path"
+ , "String path"
+ , "String filter, String fileName\nList filters, String fileName"
+ , "String nameFilter"
+ , ""
+ , ""
+ , "String prefix"
+ , ""
+ , "String path"
+ , "String prefix, List searchPaths"
+ , ""
+ , ""
+ , "String pathName"
+ // prototype
+ , "String fileName"
+ , ""
+ , ""
+ , "String dirName"
+ , ""
+ , ""
+ , ""
+ , "Filters filters, SortFlags sort\nList nameFilters, Filters filters, SortFlags sort"
+ , "Filters filters, SortFlags sort\nList nameFilters, Filters filters, SortFlags sort"
+ , "\nString name"
+ , "String fileName"
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "String dirName"
+ , "String dirPath"
+ , ""
+ , "QDir dir"
+ , "int arg__1"
+ , ""
+ , ""
+ , "String fileName"
+ , "String fileName"
+ , "String oldName, String newName"
+ , "String dirName"
+ , "String dirPath"
+ , "Filters filter"
+ , "List nameFilters"
+ , "String path"
+ , "SortFlags sort"
+ , ""
+""
+};
+
+static QScriptValue qtscript_QDir_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QDir::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QDir)
+Q_DECLARE_METATYPE(QDir*)
+Q_DECLARE_METATYPE(QDir::Filter)
+Q_DECLARE_METATYPE(QFlags<QDir::Filter>)
+Q_DECLARE_METATYPE(QDir::SortFlag)
+Q_DECLARE_METATYPE(QFlags<QDir::SortFlag>)
+Q_DECLARE_METATYPE(QFileInfo)
+Q_DECLARE_METATYPE(QList<QFileInfo>)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+static QScriptValue qtscript_create_flags_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString,
+ QScriptEngine::FunctionSignature equals)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("equals"),
+ engine->newFunction(equals), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto);
+}
+
+//
+// QDir::Filter
+//
+
+static const QDir::Filter qtscript_QDir_Filter_values[] = {
+ QDir::NoFilter
+ , QDir::Dirs
+ , QDir::Files
+ , QDir::Drives
+ , QDir::AllEntries
+ , QDir::NoSymLinks
+ , QDir::TypeMask
+ , QDir::Readable
+ , QDir::Writable
+ , QDir::Executable
+ , QDir::PermissionMask
+ , QDir::Modified
+ , QDir::Hidden
+ , QDir::System
+ , QDir::AccessMask
+ , QDir::AllDirs
+ , QDir::CaseSensitive
+ , QDir::NoDotAndDotDot
+};
+
+static const char * const qtscript_QDir_Filter_keys[] = {
+ "NoFilter"
+ , "Dirs"
+ , "Files"
+ , "Drives"
+ , "AllEntries"
+ , "NoSymLinks"
+ , "TypeMask"
+ , "Readable"
+ , "Writable"
+ , "Executable"
+ , "PermissionMask"
+ , "Modified"
+ , "Hidden"
+ , "System"
+ , "AccessMask"
+ , "AllDirs"
+ , "CaseSensitive"
+ , "NoDotAndDotDot"
+};
+
+static QString qtscript_QDir_Filter_toStringHelper(QDir::Filter value)
+{
+ for (int i = 0; i < 18; ++i) {
+ if (qtscript_QDir_Filter_values[i] == value)
+ return QString::fromLatin1(qtscript_QDir_Filter_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_QDir_Filter_toScriptValue(QScriptEngine *engine, const QDir::Filter &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QDir"));
+ return clazz.property(qtscript_QDir_Filter_toStringHelper(value));
+}
+
+static void qtscript_QDir_Filter_fromScriptValue(const QScriptValue &value, QDir::Filter &out)
+{
+ out = qvariant_cast<QDir::Filter>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QDir_Filter(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 18; ++i) {
+ if (qtscript_QDir_Filter_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<QDir::Filter>(arg));
+ }
+ return context->throwError(QString::fromLatin1("Filter(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QDir_Filter_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QDir::Filter value = qscriptvalue_cast<QDir::Filter>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QDir_Filter_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QDir::Filter value = qscriptvalue_cast<QDir::Filter>(context->thisObject());
+ return QScriptValue(engine, qtscript_QDir_Filter_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QDir_Filter_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QDir_Filter,
+ qtscript_QDir_Filter_valueOf, qtscript_QDir_Filter_toString);
+ qScriptRegisterMetaType<QDir::Filter>(engine, qtscript_QDir_Filter_toScriptValue,
+ qtscript_QDir_Filter_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 18; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QDir_Filter_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QDir_Filter_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QDir::Filters
+//
+
+static QScriptValue qtscript_QDir_Filters_toScriptValue(QScriptEngine *engine, const QDir::Filters &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_QDir_Filters_fromScriptValue(const QScriptValue &value, QDir::Filters &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<QDir::Filters>())
+ out = qvariant_cast<QDir::Filters>(var);
+ else if (var.userType() == qMetaTypeId<QDir::Filter>())
+ out = qvariant_cast<QDir::Filter>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_QDir_Filters(QScriptContext *context, QScriptEngine *engine)
+{
+ QDir::Filters result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<QDir::Filters>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<QDir::Filter>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("Filters(): argument %0 is not of type Filter").arg(i));
+ }
+ result |= qvariant_cast<QDir::Filter>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_QDir_Filters_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QDir::Filters value = qscriptvalue_cast<QDir::Filters>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QDir_Filters_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QDir::Filters value = qscriptvalue_cast<QDir::Filters>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 18; ++i) {
+ if ((value & qtscript_QDir_Filter_values[i]) == qtscript_QDir_Filter_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_QDir_Filter_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_QDir_Filters_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<QDir::Filters>() == otherObj.value<QDir::Filters>())));
+}
+
+static QScriptValue qtscript_create_QDir_Filters_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_QDir_Filters, qtscript_QDir_Filters_valueOf,
+ qtscript_QDir_Filters_toString, qtscript_QDir_Filters_equals);
+ qScriptRegisterMetaType<QDir::Filters>(engine, qtscript_QDir_Filters_toScriptValue,
+ qtscript_QDir_Filters_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// QDir::SortFlag
+//
+
+static const QDir::SortFlag qtscript_QDir_SortFlag_values[] = {
+ QDir::NoSort
+ , QDir::Name
+ , QDir::Time
+ , QDir::Size
+ , QDir::Unsorted
+ , QDir::DirsFirst
+ , QDir::Reversed
+ , QDir::IgnoreCase
+ , QDir::DirsLast
+ , QDir::LocaleAware
+ , QDir::Type
+};
+
+static const char * const qtscript_QDir_SortFlag_keys[] = {
+ "NoSort"
+ , "Name"
+ , "Time"
+ , "Size"
+ , "Unsorted"
+ , "DirsFirst"
+ , "Reversed"
+ , "IgnoreCase"
+ , "DirsLast"
+ , "LocaleAware"
+ , "Type"
+};
+
+static QString qtscript_QDir_SortFlag_toStringHelper(QDir::SortFlag value)
+{
+ for (int i = 0; i < 11; ++i) {
+ if (qtscript_QDir_SortFlag_values[i] == value)
+ return QString::fromLatin1(qtscript_QDir_SortFlag_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_QDir_SortFlag_toScriptValue(QScriptEngine *engine, const QDir::SortFlag &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QDir"));
+ return clazz.property(qtscript_QDir_SortFlag_toStringHelper(value));
+}
+
+static void qtscript_QDir_SortFlag_fromScriptValue(const QScriptValue &value, QDir::SortFlag &out)
+{
+ out = qvariant_cast<QDir::SortFlag>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QDir_SortFlag(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 11; ++i) {
+ if (qtscript_QDir_SortFlag_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<QDir::SortFlag>(arg));
+ }
+ return context->throwError(QString::fromLatin1("SortFlag(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QDir_SortFlag_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QDir::SortFlag value = qscriptvalue_cast<QDir::SortFlag>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QDir_SortFlag_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QDir::SortFlag value = qscriptvalue_cast<QDir::SortFlag>(context->thisObject());
+ return QScriptValue(engine, qtscript_QDir_SortFlag_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QDir_SortFlag_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QDir_SortFlag,
+ qtscript_QDir_SortFlag_valueOf, qtscript_QDir_SortFlag_toString);
+ qScriptRegisterMetaType<QDir::SortFlag>(engine, qtscript_QDir_SortFlag_toScriptValue,
+ qtscript_QDir_SortFlag_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 11; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QDir_SortFlag_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QDir_SortFlag_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QDir::SortFlags
+//
+
+static QScriptValue qtscript_QDir_SortFlags_toScriptValue(QScriptEngine *engine, const QDir::SortFlags &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_QDir_SortFlags_fromScriptValue(const QScriptValue &value, QDir::SortFlags &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<QDir::SortFlags>())
+ out = qvariant_cast<QDir::SortFlags>(var);
+ else if (var.userType() == qMetaTypeId<QDir::SortFlag>())
+ out = qvariant_cast<QDir::SortFlag>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_QDir_SortFlags(QScriptContext *context, QScriptEngine *engine)
+{
+ QDir::SortFlags result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<QDir::SortFlags>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<QDir::SortFlag>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("SortFlags(): argument %0 is not of type SortFlag").arg(i));
+ }
+ result |= qvariant_cast<QDir::SortFlag>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_QDir_SortFlags_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QDir::SortFlags value = qscriptvalue_cast<QDir::SortFlags>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QDir_SortFlags_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QDir::SortFlags value = qscriptvalue_cast<QDir::SortFlags>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 11; ++i) {
+ if ((value & qtscript_QDir_SortFlag_values[i]) == qtscript_QDir_SortFlag_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_QDir_SortFlag_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_QDir_SortFlags_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<QDir::SortFlags>() == otherObj.value<QDir::SortFlags>())));
+}
+
+static QScriptValue qtscript_create_QDir_SortFlags_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_QDir_SortFlags, qtscript_QDir_SortFlags_valueOf,
+ qtscript_QDir_SortFlags_toString, qtscript_QDir_SortFlags_equals);
+ qScriptRegisterMetaType<QDir::SortFlags>(engine, qtscript_QDir_SortFlags_toScriptValue,
+ qtscript_QDir_SortFlags_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// QDir
+//
+
+static QScriptValue qtscript_QDir_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 34;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QDir* _q_self = qscriptvalue_cast<QDir*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QDir.%0(): this object is not a QDir")
+ .arg(qtscript_QDir_function_names[_id+23]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_result = _q_self->absoluteFilePath(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->absolutePath();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->canonicalPath();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->cd(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->cdUp();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ uint _q_result = _q_self->count();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->dirName();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ QList<QFileInfo> _q_result = _q_self->entryInfoList();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QFlags<QDir::Filter> >() == context->argument(0).toVariant().userType())) {
+ QFlags<QDir::Filter> _q_arg0 = qscriptvalue_cast<QFlags<QDir::Filter> >(context->argument(0));
+ QList<QFileInfo> _q_result = _q_self->entryInfoList(_q_arg0);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ } else if (context->argument(0).isArray()) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ QList<QFileInfo> _q_result = _q_self->entryInfoList(_q_arg0);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 2) {
+ if ((qMetaTypeId<QFlags<QDir::Filter> >() == context->argument(0).toVariant().userType())
+ && (qMetaTypeId<QFlags<QDir::SortFlag> >() == context->argument(1).toVariant().userType())) {
+ QFlags<QDir::Filter> _q_arg0 = qscriptvalue_cast<QFlags<QDir::Filter> >(context->argument(0));
+ QFlags<QDir::SortFlag> _q_arg1 = qscriptvalue_cast<QFlags<QDir::SortFlag> >(context->argument(1));
+ QList<QFileInfo> _q_result = _q_self->entryInfoList(_q_arg0, _q_arg1);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ } else if (context->argument(0).isArray()
+ && (qMetaTypeId<QFlags<QDir::Filter> >() == context->argument(1).toVariant().userType())) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ QFlags<QDir::Filter> _q_arg1 = qscriptvalue_cast<QFlags<QDir::Filter> >(context->argument(1));
+ QList<QFileInfo> _q_result = _q_self->entryInfoList(_q_arg0, _q_arg1);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 3) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ QFlags<QDir::Filter> _q_arg1 = qscriptvalue_cast<QFlags<QDir::Filter> >(context->argument(1));
+ QFlags<QDir::SortFlag> _q_arg2 = qscriptvalue_cast<QFlags<QDir::SortFlag> >(context->argument(2));
+ QList<QFileInfo> _q_result = _q_self->entryInfoList(_q_arg0, _q_arg1, _q_arg2);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 0) {
+ QStringList _q_result = _q_self->entryList();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QFlags<QDir::Filter> >() == context->argument(0).toVariant().userType())) {
+ QFlags<QDir::Filter> _q_arg0 = qscriptvalue_cast<QFlags<QDir::Filter> >(context->argument(0));
+ QStringList _q_result = _q_self->entryList(_q_arg0);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ } else if (context->argument(0).isArray()) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ QStringList _q_result = _q_self->entryList(_q_arg0);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 2) {
+ if ((qMetaTypeId<QFlags<QDir::Filter> >() == context->argument(0).toVariant().userType())
+ && (qMetaTypeId<QFlags<QDir::SortFlag> >() == context->argument(1).toVariant().userType())) {
+ QFlags<QDir::Filter> _q_arg0 = qscriptvalue_cast<QFlags<QDir::Filter> >(context->argument(0));
+ QFlags<QDir::SortFlag> _q_arg1 = qscriptvalue_cast<QFlags<QDir::SortFlag> >(context->argument(1));
+ QStringList _q_result = _q_self->entryList(_q_arg0, _q_arg1);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ } else if (context->argument(0).isArray()
+ && (qMetaTypeId<QFlags<QDir::Filter> >() == context->argument(1).toVariant().userType())) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ QFlags<QDir::Filter> _q_arg1 = qscriptvalue_cast<QFlags<QDir::Filter> >(context->argument(1));
+ QStringList _q_result = _q_self->entryList(_q_arg0, _q_arg1);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 3) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ QFlags<QDir::Filter> _q_arg1 = qscriptvalue_cast<QFlags<QDir::Filter> >(context->argument(1));
+ QFlags<QDir::SortFlag> _q_arg2 = qscriptvalue_cast<QFlags<QDir::SortFlag> >(context->argument(2));
+ QStringList _q_result = _q_self->entryList(_q_arg0, _q_arg1, _q_arg2);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->exists();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->exists(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_result = _q_self->filePath(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 0) {
+ QFlags<QDir::Filter> _q_result = _q_self->filter();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isAbsolute();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isReadable();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isRelative();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isRoot();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->makeAbsolute();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->mkdir(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->mkpath(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 0) {
+ QStringList _q_result = _q_self->nameFilters();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 1) {
+ QDir _q_arg0 = qscriptvalue_cast<QDir>(context->argument(0));
+ bool _q_result = _q_self->operator==(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 21:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QString _q_result = _q_self->operator[](_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 22:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->path();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 23:
+ if (context->argumentCount() == 0) {
+ _q_self->refresh();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 24:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_result = _q_self->relativeFilePath(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 25:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->remove(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 26:
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ bool _q_result = _q_self->rename(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 27:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->rmdir(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 28:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->rmpath(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 29:
+ if (context->argumentCount() == 1) {
+ QFlags<QDir::Filter> _q_arg0 = qscriptvalue_cast<QFlags<QDir::Filter> >(context->argument(0));
+ _q_self->setFilter(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 30:
+ if (context->argumentCount() == 1) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ _q_self->setNameFilters(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 31:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setPath(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 32:
+ if (context->argumentCount() == 1) {
+ QFlags<QDir::SortFlag> _q_arg0 = qscriptvalue_cast<QFlags<QDir::SortFlag> >(context->argument(0));
+ _q_self->setSorting(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 33:
+ if (context->argumentCount() == 0) {
+ QFlags<QDir::SortFlag> _q_result = _q_self->sorting();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 34: {
+ QString result;
+ QDebug d(&result);
+ d << *_q_self;
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QDir_throw_ambiguity_error_helper(context,
+ qtscript_QDir_function_names[_id+23],
+ qtscript_QDir_function_signatures[_id+23]);
+}
+
+static QScriptValue qtscript_QDir_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QDir(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QDir _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QDir>() == context->argument(0).toVariant().userType())) {
+ QDir _q_arg0 = qscriptvalue_cast<QDir>(context->argument(0));
+ QDir _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QDir _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QDir _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 3) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QFlags<QDir::SortFlag> _q_arg2 = qscriptvalue_cast<QFlags<QDir::SortFlag> >(context->argument(2));
+ QDir _q_cpp_result(_q_arg0, _q_arg1, _q_arg2);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 4) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QFlags<QDir::SortFlag> _q_arg2 = qscriptvalue_cast<QFlags<QDir::SortFlag> >(context->argument(2));
+ QFlags<QDir::Filter> _q_arg3 = qscriptvalue_cast<QFlags<QDir::Filter> >(context->argument(3));
+ QDir _q_cpp_result(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QDir::addSearchPath(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_result = QDir::cleanPath(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_result = QDir::convertSeparators(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ QDir _q_result = QDir::current();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QString _q_result = QDir::currentPath();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ QList<QFileInfo> _q_result = QDir::drives();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_result = QDir::fromNativeSeparators(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 0) {
+ QDir _q_result = QDir::home();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 0) {
+ QString _q_result = QDir::homePath();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = QDir::isAbsolutePath(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = QDir::isRelativePath(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 2) {
+ if (context->argument(0).isString()
+ && context->argument(1).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ bool _q_result = QDir::match(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isArray()
+ && context->argument(1).isString()) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ QString _q_arg1 = context->argument(1).toString();
+ bool _q_result = QDir::match(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QStringList _q_result = QDir::nameFiltersFromString(_q_arg0);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 0) {
+ QDir _q_result = QDir::root();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 0) {
+ QString _q_result = QDir::rootPath();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QStringList _q_result = QDir::searchPaths(_q_arg0);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 0) {
+ QChar _q_result = QDir::separator();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = QDir::setCurrent(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QStringList _q_arg1;
+ qScriptValueToSequence(context->argument(1), _q_arg1);
+ QDir::setSearchPaths(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 0) {
+ QDir _q_result = QDir::temp();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 21:
+ if (context->argumentCount() == 0) {
+ QString _q_result = QDir::tempPath();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 22:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_result = QDir::toNativeSeparators(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QDir_throw_ambiguity_error_helper(context,
+ qtscript_QDir_function_names[_id],
+ qtscript_QDir_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QDir_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 4
+ // static
+ , 2
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 1
+ , 1
+ , 2
+ , 1
+ , 0
+ , 0
+ , 1
+ , 0
+ , 1
+ , 2
+ , 0
+ , 0
+ , 1
+ // prototype
+ , 1
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 0
+ , 3
+ , 3
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 1
+ , 0
+ , 1
+ , 1
+ , 0
+ , 0
+ , 1
+ , 1
+ , 2
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QDir*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QDir*)0));
+ for (int i = 0; i < 35; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QDir_prototype_call, function_lengths[i+23]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QDir_function_names[i+23]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QDir>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QDir*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QDir_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 22; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QDir_static_call,
+ function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_QDir_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ ctor.setProperty(QString::fromLatin1("Filter"),
+ qtscript_create_QDir_Filter_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("Filters"),
+ qtscript_create_QDir_Filters_class(engine));
+ ctor.setProperty(QString::fromLatin1("SortFlag"),
+ qtscript_create_QDir_SortFlag_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("SortFlags"),
+ qtscript_create_QDir_SortFlags_class(engine));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QDirIterator.cpp b/qtbindings/com_nokia_qt_core/qtscript_QDirIterator.cpp
new file mode 100644
index 0000000..5add1e4
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QDirIterator.cpp
@@ -0,0 +1,497 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qdiriterator.h>
+#include <QVariant>
+#include <qdir.h>
+#include <qdiriterator.h>
+#include <qfileinfo.h>
+#include <qstringlist.h>
+
+#include "qtscriptshell_QDirIterator.h"
+
+static const char * const qtscript_QDirIterator_function_names[] = {
+ "QDirIterator"
+ // static
+ // prototype
+ , "fileInfo"
+ , "fileName"
+ , "filePath"
+ , "hasNext"
+ , "next"
+ , "path"
+ , "toString"
+};
+
+static const char * const qtscript_QDirIterator_function_signatures[] = {
+ "QDir dir, IteratorFlags flags\nString path, Filters filter, IteratorFlags flags\nString path, IteratorFlags flags\nString path, List nameFilters, Filters filters, IteratorFlags flags"
+ // static
+ // prototype
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QDirIterator_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QDirIterator::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QDirIterator*)
+Q_DECLARE_METATYPE(QtScriptShell_QDirIterator*)
+Q_DECLARE_METATYPE(QDirIterator::IteratorFlag)
+Q_DECLARE_METATYPE(QFlags<QDirIterator::IteratorFlag>)
+Q_DECLARE_METATYPE(QFileInfo)
+Q_DECLARE_METATYPE(QDir)
+Q_DECLARE_METATYPE(QFlags<QDir::Filter>)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+static QScriptValue qtscript_create_flags_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString,
+ QScriptEngine::FunctionSignature equals)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("equals"),
+ engine->newFunction(equals), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto);
+}
+
+//
+// QDirIterator::IteratorFlag
+//
+
+static const QDirIterator::IteratorFlag qtscript_QDirIterator_IteratorFlag_values[] = {
+ QDirIterator::NoIteratorFlags
+ , QDirIterator::FollowSymlinks
+ , QDirIterator::Subdirectories
+};
+
+static const char * const qtscript_QDirIterator_IteratorFlag_keys[] = {
+ "NoIteratorFlags"
+ , "FollowSymlinks"
+ , "Subdirectories"
+};
+
+static QString qtscript_QDirIterator_IteratorFlag_toStringHelper(QDirIterator::IteratorFlag value)
+{
+ if ((value >= QDirIterator::NoIteratorFlags) && (value <= QDirIterator::Subdirectories))
+ return qtscript_QDirIterator_IteratorFlag_keys[static_cast<int>(value)-static_cast<int>(QDirIterator::NoIteratorFlags)];
+ return QString();
+}
+
+static QScriptValue qtscript_QDirIterator_IteratorFlag_toScriptValue(QScriptEngine *engine, const QDirIterator::IteratorFlag &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QDirIterator"));
+ return clazz.property(qtscript_QDirIterator_IteratorFlag_toStringHelper(value));
+}
+
+static void qtscript_QDirIterator_IteratorFlag_fromScriptValue(const QScriptValue &value, QDirIterator::IteratorFlag &out)
+{
+ out = qvariant_cast<QDirIterator::IteratorFlag>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QDirIterator_IteratorFlag(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QDirIterator::NoIteratorFlags) && (arg <= QDirIterator::Subdirectories))
+ return qScriptValueFromValue(engine, static_cast<QDirIterator::IteratorFlag>(arg));
+ return context->throwError(QString::fromLatin1("IteratorFlag(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QDirIterator_IteratorFlag_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QDirIterator::IteratorFlag value = qscriptvalue_cast<QDirIterator::IteratorFlag>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QDirIterator_IteratorFlag_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QDirIterator::IteratorFlag value = qscriptvalue_cast<QDirIterator::IteratorFlag>(context->thisObject());
+ return QScriptValue(engine, qtscript_QDirIterator_IteratorFlag_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QDirIterator_IteratorFlag_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QDirIterator_IteratorFlag,
+ qtscript_QDirIterator_IteratorFlag_valueOf, qtscript_QDirIterator_IteratorFlag_toString);
+ qScriptRegisterMetaType<QDirIterator::IteratorFlag>(engine, qtscript_QDirIterator_IteratorFlag_toScriptValue,
+ qtscript_QDirIterator_IteratorFlag_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QDirIterator_IteratorFlag_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QDirIterator_IteratorFlag_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QDirIterator::IteratorFlags
+//
+
+static QScriptValue qtscript_QDirIterator_IteratorFlags_toScriptValue(QScriptEngine *engine, const QDirIterator::IteratorFlags &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_QDirIterator_IteratorFlags_fromScriptValue(const QScriptValue &value, QDirIterator::IteratorFlags &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<QDirIterator::IteratorFlags>())
+ out = qvariant_cast<QDirIterator::IteratorFlags>(var);
+ else if (var.userType() == qMetaTypeId<QDirIterator::IteratorFlag>())
+ out = qvariant_cast<QDirIterator::IteratorFlag>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_QDirIterator_IteratorFlags(QScriptContext *context, QScriptEngine *engine)
+{
+ QDirIterator::IteratorFlags result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<QDirIterator::IteratorFlags>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<QDirIterator::IteratorFlag>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("IteratorFlags(): argument %0 is not of type IteratorFlag").arg(i));
+ }
+ result |= qvariant_cast<QDirIterator::IteratorFlag>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_QDirIterator_IteratorFlags_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QDirIterator::IteratorFlags value = qscriptvalue_cast<QDirIterator::IteratorFlags>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QDirIterator_IteratorFlags_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QDirIterator::IteratorFlags value = qscriptvalue_cast<QDirIterator::IteratorFlags>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 3; ++i) {
+ if ((value & qtscript_QDirIterator_IteratorFlag_values[i]) == qtscript_QDirIterator_IteratorFlag_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_QDirIterator_IteratorFlag_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_QDirIterator_IteratorFlags_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<QDirIterator::IteratorFlags>() == otherObj.value<QDirIterator::IteratorFlags>())));
+}
+
+static QScriptValue qtscript_create_QDirIterator_IteratorFlags_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_QDirIterator_IteratorFlags, qtscript_QDirIterator_IteratorFlags_valueOf,
+ qtscript_QDirIterator_IteratorFlags_toString, qtscript_QDirIterator_IteratorFlags_equals);
+ qScriptRegisterMetaType<QDirIterator::IteratorFlags>(engine, qtscript_QDirIterator_IteratorFlags_toScriptValue,
+ qtscript_QDirIterator_IteratorFlags_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// QDirIterator
+//
+
+static QScriptValue qtscript_QDirIterator_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 6;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QDirIterator* _q_self = qscriptvalue_cast<QDirIterator*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QDirIterator.%0(): this object is not a QDirIterator")
+ .arg(qtscript_QDirIterator_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ QFileInfo _q_result = _q_self->fileInfo();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->fileName();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->filePath();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->hasNext();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->next();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->path();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6: {
+ QString result = QString::fromLatin1("QDirIterator");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QDirIterator_throw_ambiguity_error_helper(context,
+ qtscript_QDirIterator_function_names[_id+1],
+ qtscript_QDirIterator_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QDirIterator_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QDirIterator(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QDir>() == context->argument(0).toVariant().userType())) {
+ QDir _q_arg0 = qscriptvalue_cast<QDir>(context->argument(0));
+ QtScriptShell_QDirIterator* _q_cpp_result = new QtScriptShell_QDirIterator(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QDirIterator*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QtScriptShell_QDirIterator* _q_cpp_result = new QtScriptShell_QDirIterator(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QDirIterator*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 2) {
+ if ((qMetaTypeId<QDir>() == context->argument(0).toVariant().userType())
+ && (qMetaTypeId<QFlags<QDirIterator::IteratorFlag> >() == context->argument(1).toVariant().userType())) {
+ QDir _q_arg0 = qscriptvalue_cast<QDir>(context->argument(0));
+ QFlags<QDirIterator::IteratorFlag> _q_arg1 = qscriptvalue_cast<QFlags<QDirIterator::IteratorFlag> >(context->argument(1));
+ QtScriptShell_QDirIterator* _q_cpp_result = new QtScriptShell_QDirIterator(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QDirIterator*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argument(0).isString()
+ && (qMetaTypeId<QFlags<QDir::Filter> >() == context->argument(1).toVariant().userType())) {
+ QString _q_arg0 = context->argument(0).toString();
+ QFlags<QDir::Filter> _q_arg1 = qscriptvalue_cast<QFlags<QDir::Filter> >(context->argument(1));
+ QtScriptShell_QDirIterator* _q_cpp_result = new QtScriptShell_QDirIterator(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QDirIterator*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argument(0).isString()
+ && (qMetaTypeId<QFlags<QDirIterator::IteratorFlag> >() == context->argument(1).toVariant().userType())) {
+ QString _q_arg0 = context->argument(0).toString();
+ QFlags<QDirIterator::IteratorFlag> _q_arg1 = qscriptvalue_cast<QFlags<QDirIterator::IteratorFlag> >(context->argument(1));
+ QtScriptShell_QDirIterator* _q_cpp_result = new QtScriptShell_QDirIterator(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QDirIterator*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argument(0).isString()
+ && context->argument(1).isArray()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QStringList _q_arg1;
+ qScriptValueToSequence(context->argument(1), _q_arg1);
+ QtScriptShell_QDirIterator* _q_cpp_result = new QtScriptShell_QDirIterator(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QDirIterator*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 3) {
+ if (context->argument(0).isString()
+ && (qMetaTypeId<QFlags<QDir::Filter> >() == context->argument(1).toVariant().userType())
+ && (qMetaTypeId<QFlags<QDirIterator::IteratorFlag> >() == context->argument(2).toVariant().userType())) {
+ QString _q_arg0 = context->argument(0).toString();
+ QFlags<QDir::Filter> _q_arg1 = qscriptvalue_cast<QFlags<QDir::Filter> >(context->argument(1));
+ QFlags<QDirIterator::IteratorFlag> _q_arg2 = qscriptvalue_cast<QFlags<QDirIterator::IteratorFlag> >(context->argument(2));
+ QtScriptShell_QDirIterator* _q_cpp_result = new QtScriptShell_QDirIterator(_q_arg0, _q_arg1, _q_arg2);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QDirIterator*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argument(0).isString()
+ && context->argument(1).isArray()
+ && (qMetaTypeId<QFlags<QDir::Filter> >() == context->argument(2).toVariant().userType())) {
+ QString _q_arg0 = context->argument(0).toString();
+ QStringList _q_arg1;
+ qScriptValueToSequence(context->argument(1), _q_arg1);
+ QFlags<QDir::Filter> _q_arg2 = qscriptvalue_cast<QFlags<QDir::Filter> >(context->argument(2));
+ QtScriptShell_QDirIterator* _q_cpp_result = new QtScriptShell_QDirIterator(_q_arg0, _q_arg1, _q_arg2);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QDirIterator*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 4) {
+ QString _q_arg0 = context->argument(0).toString();
+ QStringList _q_arg1;
+ qScriptValueToSequence(context->argument(1), _q_arg1);
+ QFlags<QDir::Filter> _q_arg2 = qscriptvalue_cast<QFlags<QDir::Filter> >(context->argument(2));
+ QFlags<QDirIterator::IteratorFlag> _q_arg3 = qscriptvalue_cast<QFlags<QDirIterator::IteratorFlag> >(context->argument(3));
+ QtScriptShell_QDirIterator* _q_cpp_result = new QtScriptShell_QDirIterator(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QDirIterator*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QDirIterator_throw_ambiguity_error_helper(context,
+ qtscript_QDirIterator_function_names[_id],
+ qtscript_QDirIterator_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QDirIterator_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 4
+ // static
+ // prototype
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QDirIterator*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QDirIterator*)0));
+ for (int i = 0; i < 7; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QDirIterator_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QDirIterator_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QDirIterator*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QDirIterator_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ ctor.setProperty(QString::fromLatin1("IteratorFlag"),
+ qtscript_create_QDirIterator_IteratorFlag_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("IteratorFlags"),
+ qtscript_create_QDirIterator_IteratorFlags_class(engine));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QDynamicPropertyChangeEvent.cpp b/qtbindings/com_nokia_qt_core/qtscript_QDynamicPropertyChangeEvent.cpp
new file mode 100644
index 0000000..0ed19fa
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QDynamicPropertyChangeEvent.cpp
@@ -0,0 +1,181 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qcoreevent.h>
+#include <QVariant>
+#include <qbytearray.h>
+
+static const char * const qtscript_QDynamicPropertyChangeEvent_function_names[] = {
+ "QDynamicPropertyChangeEvent"
+ // static
+ // prototype
+ , "propertyName"
+ , "toString"
+};
+
+static const char * const qtscript_QDynamicPropertyChangeEvent_function_signatures[] = {
+ "QByteArray name"
+ // static
+ // prototype
+ , ""
+""
+};
+
+static QScriptValue qtscript_QDynamicPropertyChangeEvent_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QDynamicPropertyChangeEvent::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QDynamicPropertyChangeEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+
+//
+// QDynamicPropertyChangeEvent
+//
+
+static QScriptValue qtscript_QDynamicPropertyChangeEvent_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 1;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QDynamicPropertyChangeEvent* _q_self = qscriptvalue_cast<QDynamicPropertyChangeEvent*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QDynamicPropertyChangeEvent.%0(): this object is not a QDynamicPropertyChangeEvent")
+ .arg(qtscript_QDynamicPropertyChangeEvent_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->propertyName();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1: {
+ QString result = QString::fromLatin1("QDynamicPropertyChangeEvent");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QDynamicPropertyChangeEvent_throw_ambiguity_error_helper(context,
+ qtscript_QDynamicPropertyChangeEvent_function_names[_id+1],
+ qtscript_QDynamicPropertyChangeEvent_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QDynamicPropertyChangeEvent_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QDynamicPropertyChangeEvent(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QDynamicPropertyChangeEvent* _q_cpp_result = new QDynamicPropertyChangeEvent(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QDynamicPropertyChangeEvent_throw_ambiguity_error_helper(context,
+ qtscript_QDynamicPropertyChangeEvent_function_names[_id],
+ qtscript_QDynamicPropertyChangeEvent_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QDynamicPropertyChangeEvent_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QDynamicPropertyChangeEvent*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QDynamicPropertyChangeEvent*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QEvent*>()));
+ for (int i = 0; i < 2; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QDynamicPropertyChangeEvent_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QDynamicPropertyChangeEvent_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QDynamicPropertyChangeEvent*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QDynamicPropertyChangeEvent_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QEvent.cpp b/qtbindings/com_nokia_qt_core/qtscript_QEvent.cpp
new file mode 100644
index 0000000..6d2030a
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QEvent.cpp
@@ -0,0 +1,631 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qcoreevent.h>
+#include <QVariant>
+
+#include "qtscriptshell_QEvent.h"
+
+static const char * const qtscript_QEvent_function_names[] = {
+ "QEvent"
+ // static
+ , "registerEventType"
+ // prototype
+ , "accept"
+ , "ignore"
+ , "isAccepted"
+ , "setAccepted"
+ , "spontaneous"
+ , "type"
+ , "toString"
+};
+
+static const char * const qtscript_QEvent_function_signatures[] = {
+ "Type type"
+ // static
+ , "int hint"
+ // prototype
+ , ""
+ , ""
+ , ""
+ , "bool accepted"
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QEvent_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QEvent::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QtScriptShell_QEvent*)
+Q_DECLARE_METATYPE(QEvent::Type)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// QEvent::Type
+//
+
+static const QEvent::Type qtscript_QEvent_Type_values[] = {
+ QEvent::None
+ , QEvent::Timer
+ , QEvent::MouseButtonPress
+ , QEvent::MouseButtonRelease
+ , QEvent::MouseButtonDblClick
+ , QEvent::MouseMove
+ , QEvent::KeyPress
+ , QEvent::KeyRelease
+ , QEvent::FocusIn
+ , QEvent::FocusOut
+ , QEvent::Enter
+ , QEvent::Leave
+ , QEvent::Paint
+ , QEvent::Move
+ , QEvent::Resize
+ , QEvent::Create
+ , QEvent::Destroy
+ , QEvent::Show
+ , QEvent::Hide
+ , QEvent::Close
+ , QEvent::Quit
+ , QEvent::ParentChange
+ , QEvent::ThreadChange
+ , QEvent::WindowActivate
+ , QEvent::WindowDeactivate
+ , QEvent::ShowToParent
+ , QEvent::HideToParent
+ , QEvent::Wheel
+ , QEvent::WindowTitleChange
+ , QEvent::WindowIconChange
+ , QEvent::ApplicationWindowIconChange
+ , QEvent::ApplicationFontChange
+ , QEvent::ApplicationLayoutDirectionChange
+ , QEvent::ApplicationPaletteChange
+ , QEvent::PaletteChange
+ , QEvent::Clipboard
+ , QEvent::Speech
+ , QEvent::MetaCall
+ , QEvent::SockAct
+ , QEvent::ShortcutOverride
+ , QEvent::DeferredDelete
+ , QEvent::DragEnter
+ , QEvent::DragMove
+ , QEvent::DragLeave
+ , QEvent::Drop
+ , QEvent::DragResponse
+ , QEvent::ChildAdded
+ , QEvent::ChildPolished
+ , QEvent::ChildRemoved
+ , QEvent::ShowWindowRequest
+ , QEvent::PolishRequest
+ , QEvent::Polish
+ , QEvent::LayoutRequest
+ , QEvent::UpdateRequest
+ , QEvent::UpdateLater
+ , QEvent::EmbeddingControl
+ , QEvent::ActivateControl
+ , QEvent::DeactivateControl
+ , QEvent::ContextMenu
+ , QEvent::InputMethod
+ , QEvent::AccessibilityPrepare
+ , QEvent::TabletMove
+ , QEvent::LocaleChange
+ , QEvent::LanguageChange
+ , QEvent::LayoutDirectionChange
+ , QEvent::Style
+ , QEvent::TabletPress
+ , QEvent::TabletRelease
+ , QEvent::OkRequest
+ , QEvent::HelpRequest
+ , QEvent::IconDrag
+ , QEvent::FontChange
+ , QEvent::EnabledChange
+ , QEvent::ActivationChange
+ , QEvent::StyleChange
+ , QEvent::IconTextChange
+ , QEvent::ModifiedChange
+ , QEvent::WindowBlocked
+ , QEvent::WindowUnblocked
+ , QEvent::WindowStateChange
+ , QEvent::MouseTrackingChange
+ , QEvent::ToolTip
+ , QEvent::WhatsThis
+ , QEvent::StatusTip
+ , QEvent::ActionChanged
+ , QEvent::ActionAdded
+ , QEvent::ActionRemoved
+ , QEvent::FileOpen
+ , QEvent::Shortcut
+ , QEvent::WhatsThisClicked
+ , QEvent::AccessibilityHelp
+ , QEvent::ToolBarChange
+ , QEvent::ApplicationActivate
+ , QEvent::ApplicationDeactivate
+ , QEvent::QueryWhatsThis
+ , QEvent::EnterWhatsThisMode
+ , QEvent::LeaveWhatsThisMode
+ , QEvent::ZOrderChange
+ , QEvent::HoverEnter
+ , QEvent::HoverLeave
+ , QEvent::HoverMove
+ , QEvent::AccessibilityDescription
+ , QEvent::ParentAboutToChange
+ , QEvent::WinEventAct
+ , QEvent::AcceptDropsChange
+ , QEvent::MenubarUpdated
+ , QEvent::ZeroTimerEvent
+ , QEvent::GraphicsSceneMouseMove
+ , QEvent::GraphicsSceneMousePress
+ , QEvent::GraphicsSceneMouseRelease
+ , QEvent::GraphicsSceneMouseDoubleClick
+ , QEvent::GraphicsSceneContextMenu
+ , QEvent::GraphicsSceneHoverEnter
+ , QEvent::GraphicsSceneHoverMove
+ , QEvent::GraphicsSceneHoverLeave
+ , QEvent::GraphicsSceneHelp
+ , QEvent::GraphicsSceneDragEnter
+ , QEvent::GraphicsSceneDragMove
+ , QEvent::GraphicsSceneDragLeave
+ , QEvent::GraphicsSceneDrop
+ , QEvent::GraphicsSceneWheel
+ , QEvent::KeyboardLayoutChange
+ , QEvent::DynamicPropertyChange
+ , QEvent::TabletEnterProximity
+ , QEvent::TabletLeaveProximity
+ , QEvent::NonClientAreaMouseMove
+ , QEvent::NonClientAreaMouseButtonPress
+ , QEvent::NonClientAreaMouseButtonRelease
+ , QEvent::NonClientAreaMouseButtonDblClick
+ , QEvent::MacSizeChange
+ , QEvent::ContentsRectChange
+ , QEvent::MacGLWindowChange
+ , QEvent::FutureCallOut
+ , QEvent::GraphicsSceneResize
+ , QEvent::GraphicsSceneMove
+ , QEvent::CursorChange
+ , QEvent::ToolTipChange
+ , QEvent::NetworkReplyUpdated
+ , QEvent::GrabMouse
+ , QEvent::UngrabMouse
+ , QEvent::GrabKeyboard
+ , QEvent::UngrabKeyboard
+// , QEvent::CocoaRequestModal
+ , QEvent::User
+ , QEvent::MaxUser
+};
+
+static const char * const qtscript_QEvent_Type_keys[] = {
+ "None"
+ , "Timer"
+ , "MouseButtonPress"
+ , "MouseButtonRelease"
+ , "MouseButtonDblClick"
+ , "MouseMove"
+ , "KeyPress"
+ , "KeyRelease"
+ , "FocusIn"
+ , "FocusOut"
+ , "Enter"
+ , "Leave"
+ , "Paint"
+ , "Move"
+ , "Resize"
+ , "Create"
+ , "Destroy"
+ , "Show"
+ , "Hide"
+ , "Close"
+ , "Quit"
+ , "ParentChange"
+ , "ThreadChange"
+ , "WindowActivate"
+ , "WindowDeactivate"
+ , "ShowToParent"
+ , "HideToParent"
+ , "Wheel"
+ , "WindowTitleChange"
+ , "WindowIconChange"
+ , "ApplicationWindowIconChange"
+ , "ApplicationFontChange"
+ , "ApplicationLayoutDirectionChange"
+ , "ApplicationPaletteChange"
+ , "PaletteChange"
+ , "Clipboard"
+ , "Speech"
+ , "MetaCall"
+ , "SockAct"
+ , "ShortcutOverride"
+ , "DeferredDelete"
+ , "DragEnter"
+ , "DragMove"
+ , "DragLeave"
+ , "Drop"
+ , "DragResponse"
+ , "ChildAdded"
+ , "ChildPolished"
+ , "ChildRemoved"
+ , "ShowWindowRequest"
+ , "PolishRequest"
+ , "Polish"
+ , "LayoutRequest"
+ , "UpdateRequest"
+ , "UpdateLater"
+ , "EmbeddingControl"
+ , "ActivateControl"
+ , "DeactivateControl"
+ , "ContextMenu"
+ , "InputMethod"
+ , "AccessibilityPrepare"
+ , "TabletMove"
+ , "LocaleChange"
+ , "LanguageChange"
+ , "LayoutDirectionChange"
+ , "Style"
+ , "TabletPress"
+ , "TabletRelease"
+ , "OkRequest"
+ , "HelpRequest"
+ , "IconDrag"
+ , "FontChange"
+ , "EnabledChange"
+ , "ActivationChange"
+ , "StyleChange"
+ , "IconTextChange"
+ , "ModifiedChange"
+ , "WindowBlocked"
+ , "WindowUnblocked"
+ , "WindowStateChange"
+ , "MouseTrackingChange"
+ , "ToolTip"
+ , "WhatsThis"
+ , "StatusTip"
+ , "ActionChanged"
+ , "ActionAdded"
+ , "ActionRemoved"
+ , "FileOpen"
+ , "Shortcut"
+ , "WhatsThisClicked"
+ , "AccessibilityHelp"
+ , "ToolBarChange"
+ , "ApplicationActivate"
+ , "ApplicationDeactivate"
+ , "QueryWhatsThis"
+ , "EnterWhatsThisMode"
+ , "LeaveWhatsThisMode"
+ , "ZOrderChange"
+ , "HoverEnter"
+ , "HoverLeave"
+ , "HoverMove"
+ , "AccessibilityDescription"
+ , "ParentAboutToChange"
+ , "WinEventAct"
+ , "AcceptDropsChange"
+ , "MenubarUpdated"
+ , "ZeroTimerEvent"
+ , "GraphicsSceneMouseMove"
+ , "GraphicsSceneMousePress"
+ , "GraphicsSceneMouseRelease"
+ , "GraphicsSceneMouseDoubleClick"
+ , "GraphicsSceneContextMenu"
+ , "GraphicsSceneHoverEnter"
+ , "GraphicsSceneHoverMove"
+ , "GraphicsSceneHoverLeave"
+ , "GraphicsSceneHelp"
+ , "GraphicsSceneDragEnter"
+ , "GraphicsSceneDragMove"
+ , "GraphicsSceneDragLeave"
+ , "GraphicsSceneDrop"
+ , "GraphicsSceneWheel"
+ , "KeyboardLayoutChange"
+ , "DynamicPropertyChange"
+ , "TabletEnterProximity"
+ , "TabletLeaveProximity"
+ , "NonClientAreaMouseMove"
+ , "NonClientAreaMouseButtonPress"
+ , "NonClientAreaMouseButtonRelease"
+ , "NonClientAreaMouseButtonDblClick"
+ , "MacSizeChange"
+ , "ContentsRectChange"
+ , "MacGLWindowChange"
+ , "FutureCallOut"
+ , "GraphicsSceneResize"
+ , "GraphicsSceneMove"
+ , "CursorChange"
+ , "ToolTipChange"
+ , "NetworkReplyUpdated"
+ , "GrabMouse"
+ , "UngrabMouse"
+ , "GrabKeyboard"
+ , "UngrabKeyboard"
+// , "CocoaRequestModal"
+ , "User"
+ , "MaxUser"
+};
+
+static QString qtscript_QEvent_Type_toStringHelper(QEvent::Type value)
+{
+ for (int i = 0; i < 144; ++i) {
+ if (qtscript_QEvent_Type_values[i] == value)
+ return QString::fromLatin1(qtscript_QEvent_Type_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_QEvent_Type_toScriptValue(QScriptEngine *engine, const QEvent::Type &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QEvent"));
+ return clazz.property(qtscript_QEvent_Type_toStringHelper(value));
+}
+
+static void qtscript_QEvent_Type_fromScriptValue(const QScriptValue &value, QEvent::Type &out)
+{
+ out = qvariant_cast<QEvent::Type>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QEvent_Type(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 144; ++i) {
+ if (qtscript_QEvent_Type_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<QEvent::Type>(arg));
+ }
+ return context->throwError(QString::fromLatin1("Type(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QEvent_Type_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QEvent::Type value = qscriptvalue_cast<QEvent::Type>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QEvent_Type_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QEvent::Type value = qscriptvalue_cast<QEvent::Type>(context->thisObject());
+ return QScriptValue(engine, qtscript_QEvent_Type_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QEvent_Type_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QEvent_Type,
+ qtscript_QEvent_Type_valueOf, qtscript_QEvent_Type_toString);
+ qScriptRegisterMetaType<QEvent::Type>(engine, qtscript_QEvent_Type_toScriptValue,
+ qtscript_QEvent_Type_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 144; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QEvent_Type_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QEvent_Type_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QEvent
+//
+
+static QScriptValue qtscript_QEvent_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 6;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QEvent* _q_self = qscriptvalue_cast<QEvent*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QEvent.%0(): this object is not a QEvent")
+ .arg(qtscript_QEvent_function_names[_id+2]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ _q_self->accept();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ _q_self->ignore();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isAccepted();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ bool _q_arg0 = context->argument(0).toBoolean();
+ _q_self->setAccepted(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->spontaneous();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QEvent::Type _q_result = _q_self->type();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6: {
+ QString result;
+ QDebug d(&result);
+ d << _q_self;
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QEvent_throw_ambiguity_error_helper(context,
+ qtscript_QEvent_function_names[_id+2],
+ qtscript_QEvent_function_signatures[_id+2]);
+}
+
+static QScriptValue qtscript_QEvent_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QEvent(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 1) {
+ QEvent::Type _q_arg0 = qscriptvalue_cast<QEvent::Type>(context->argument(0));
+ QtScriptShell_QEvent* _q_cpp_result = new QtScriptShell_QEvent(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QEvent*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ int _q_result = QEvent::registerEventType();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_result = QEvent::registerEventType(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QEvent_throw_ambiguity_error_helper(context,
+ qtscript_QEvent_function_names[_id],
+ qtscript_QEvent_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QEvent_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ , 1
+ // prototype
+ , 0
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QEvent*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QEvent*)0));
+ for (int i = 0; i < 7; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QEvent_prototype_call, function_lengths[i+2]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QEvent_function_names[i+2]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QEvent*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QEvent_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 1; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QEvent_static_call,
+ function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_QEvent_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ ctor.setProperty(QString::fromLatin1("Type"),
+ qtscript_create_QEvent_Type_class(engine, ctor));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QEventLoop.cpp b/qtbindings/com_nokia_qt_core/qtscript_QEventLoop.cpp
new file mode 100644
index 0000000..ecdf0a0
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QEventLoop.cpp
@@ -0,0 +1,460 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qeventloop.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+
+#include "qtscriptshell_QEventLoop.h"
+
+static const char * const qtscript_QEventLoop_function_names[] = {
+ "QEventLoop"
+ // static
+ // prototype
+ , "exec"
+ , "exit"
+ , "isRunning"
+ , "processEvents"
+ , "wakeUp"
+ , "toString"
+};
+
+static const char * const qtscript_QEventLoop_function_signatures[] = {
+ "QObject parent"
+ // static
+ // prototype
+ , "ProcessEventsFlags flags"
+ , "int returnCode"
+ , ""
+ , "ProcessEventsFlags flags\nProcessEventsFlags flags, int maximumTime"
+ , ""
+""
+};
+
+static QScriptValue qtscript_QEventLoop_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QEventLoop::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QEventLoop*)
+Q_DECLARE_METATYPE(QtScriptShell_QEventLoop*)
+Q_DECLARE_METATYPE(QEventLoop::ProcessEventsFlag)
+Q_DECLARE_METATYPE(QFlags<QEventLoop::ProcessEventsFlag>)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+static QScriptValue qtscript_create_flags_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString,
+ QScriptEngine::FunctionSignature equals)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("equals"),
+ engine->newFunction(equals), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto);
+}
+
+//
+// QEventLoop::ProcessEventsFlag
+//
+
+static const QEventLoop::ProcessEventsFlag qtscript_QEventLoop_ProcessEventsFlag_values[] = {
+ QEventLoop::AllEvents
+ , QEventLoop::ExcludeUserInputEvents
+ , QEventLoop::ExcludeSocketNotifiers
+ , QEventLoop::WaitForMoreEvents
+ , QEventLoop::X11ExcludeTimers
+ , QEventLoop::DeferredDeletion
+ , QEventLoop::EventLoopExec
+ , QEventLoop::DialogExec
+};
+
+static const char * const qtscript_QEventLoop_ProcessEventsFlag_keys[] = {
+ "AllEvents"
+ , "ExcludeUserInputEvents"
+ , "ExcludeSocketNotifiers"
+ , "WaitForMoreEvents"
+ , "X11ExcludeTimers"
+ , "DeferredDeletion"
+ , "EventLoopExec"
+ , "DialogExec"
+};
+
+static QString qtscript_QEventLoop_ProcessEventsFlag_toStringHelper(QEventLoop::ProcessEventsFlag value)
+{
+ for (int i = 0; i < 8; ++i) {
+ if (qtscript_QEventLoop_ProcessEventsFlag_values[i] == value)
+ return QString::fromLatin1(qtscript_QEventLoop_ProcessEventsFlag_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_QEventLoop_ProcessEventsFlag_toScriptValue(QScriptEngine *engine, const QEventLoop::ProcessEventsFlag &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QEventLoop"));
+ return clazz.property(qtscript_QEventLoop_ProcessEventsFlag_toStringHelper(value));
+}
+
+static void qtscript_QEventLoop_ProcessEventsFlag_fromScriptValue(const QScriptValue &value, QEventLoop::ProcessEventsFlag &out)
+{
+ out = qvariant_cast<QEventLoop::ProcessEventsFlag>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QEventLoop_ProcessEventsFlag(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 8; ++i) {
+ if (qtscript_QEventLoop_ProcessEventsFlag_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<QEventLoop::ProcessEventsFlag>(arg));
+ }
+ return context->throwError(QString::fromLatin1("ProcessEventsFlag(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QEventLoop_ProcessEventsFlag_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QEventLoop::ProcessEventsFlag value = qscriptvalue_cast<QEventLoop::ProcessEventsFlag>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QEventLoop_ProcessEventsFlag_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QEventLoop::ProcessEventsFlag value = qscriptvalue_cast<QEventLoop::ProcessEventsFlag>(context->thisObject());
+ return QScriptValue(engine, qtscript_QEventLoop_ProcessEventsFlag_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QEventLoop_ProcessEventsFlag_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QEventLoop_ProcessEventsFlag,
+ qtscript_QEventLoop_ProcessEventsFlag_valueOf, qtscript_QEventLoop_ProcessEventsFlag_toString);
+ qScriptRegisterMetaType<QEventLoop::ProcessEventsFlag>(engine, qtscript_QEventLoop_ProcessEventsFlag_toScriptValue,
+ qtscript_QEventLoop_ProcessEventsFlag_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 8; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QEventLoop_ProcessEventsFlag_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QEventLoop_ProcessEventsFlag_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QEventLoop::ProcessEventsFlags
+//
+
+static QScriptValue qtscript_QEventLoop_ProcessEventsFlags_toScriptValue(QScriptEngine *engine, const QEventLoop::ProcessEventsFlags &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_QEventLoop_ProcessEventsFlags_fromScriptValue(const QScriptValue &value, QEventLoop::ProcessEventsFlags &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<QEventLoop::ProcessEventsFlags>())
+ out = qvariant_cast<QEventLoop::ProcessEventsFlags>(var);
+ else if (var.userType() == qMetaTypeId<QEventLoop::ProcessEventsFlag>())
+ out = qvariant_cast<QEventLoop::ProcessEventsFlag>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_QEventLoop_ProcessEventsFlags(QScriptContext *context, QScriptEngine *engine)
+{
+ QEventLoop::ProcessEventsFlags result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<QEventLoop::ProcessEventsFlags>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<QEventLoop::ProcessEventsFlag>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("ProcessEventsFlags(): argument %0 is not of type ProcessEventsFlag").arg(i));
+ }
+ result |= qvariant_cast<QEventLoop::ProcessEventsFlag>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_QEventLoop_ProcessEventsFlags_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QEventLoop::ProcessEventsFlags value = qscriptvalue_cast<QEventLoop::ProcessEventsFlags>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QEventLoop_ProcessEventsFlags_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QEventLoop::ProcessEventsFlags value = qscriptvalue_cast<QEventLoop::ProcessEventsFlags>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 8; ++i) {
+ if ((value & qtscript_QEventLoop_ProcessEventsFlag_values[i]) == qtscript_QEventLoop_ProcessEventsFlag_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_QEventLoop_ProcessEventsFlag_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_QEventLoop_ProcessEventsFlags_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<QEventLoop::ProcessEventsFlags>() == otherObj.value<QEventLoop::ProcessEventsFlags>())));
+}
+
+static QScriptValue qtscript_create_QEventLoop_ProcessEventsFlags_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_QEventLoop_ProcessEventsFlags, qtscript_QEventLoop_ProcessEventsFlags_valueOf,
+ qtscript_QEventLoop_ProcessEventsFlags_toString, qtscript_QEventLoop_ProcessEventsFlags_equals);
+ qScriptRegisterMetaType<QEventLoop::ProcessEventsFlags>(engine, qtscript_QEventLoop_ProcessEventsFlags_toScriptValue,
+ qtscript_QEventLoop_ProcessEventsFlags_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// QEventLoop
+//
+
+static QScriptValue qtscript_QEventLoop_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 5;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QEventLoop* _q_self = qscriptvalue_cast<QEventLoop*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QEventLoop.%0(): this object is not a QEventLoop")
+ .arg(qtscript_QEventLoop_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->exec();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QFlags<QEventLoop::ProcessEventsFlag> _q_arg0 = qscriptvalue_cast<QFlags<QEventLoop::ProcessEventsFlag> >(context->argument(0));
+ int _q_result = _q_self->exec(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ _q_self->exit();
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->exit(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isRunning();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->processEvents();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QFlags<QEventLoop::ProcessEventsFlag> _q_arg0 = qscriptvalue_cast<QFlags<QEventLoop::ProcessEventsFlag> >(context->argument(0));
+ bool _q_result = _q_self->processEvents(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ QFlags<QEventLoop::ProcessEventsFlag> _q_arg0 = qscriptvalue_cast<QFlags<QEventLoop::ProcessEventsFlag> >(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ _q_self->processEvents(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ _q_self->wakeUp();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 5: {
+ QString result = QString::fromLatin1("QEventLoop");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QEventLoop_throw_ambiguity_error_helper(context,
+ qtscript_QEventLoop_function_names[_id+1],
+ qtscript_QEventLoop_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QEventLoop_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QEventLoop(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QEventLoop* _q_cpp_result = new QtScriptShell_QEventLoop();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QEventLoop*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QtScriptShell_QEventLoop* _q_cpp_result = new QtScriptShell_QEventLoop(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QEventLoop*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QEventLoop_throw_ambiguity_error_helper(context,
+ qtscript_QEventLoop_function_names[_id],
+ qtscript_QEventLoop_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QEventLoop_toScriptValue(QScriptEngine *engine, QEventLoop* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QEventLoop_fromScriptValue(const QScriptValue &value, QEventLoop* &out)
+{
+ out = qobject_cast<QEventLoop*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QEventLoop_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 1
+ , 1
+ , 0
+ , 2
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QEventLoop*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QEventLoop*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
+ for (int i = 0; i < 6; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QEventLoop_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QEventLoop_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<QEventLoop*>(engine, qtscript_QEventLoop_toScriptValue,
+ qtscript_QEventLoop_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QEventLoop_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ ctor.setProperty(QString::fromLatin1("ProcessEventsFlag"),
+ qtscript_create_QEventLoop_ProcessEventsFlag_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ProcessEventsFlags"),
+ qtscript_create_QEventLoop_ProcessEventsFlags_class(engine));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QFile.cpp b/qtbindings/com_nokia_qt_core/qtscript_QFile.cpp
new file mode 100644
index 0000000..16204c2
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QFile.cpp
@@ -0,0 +1,878 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qfile.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qfile.h>
+#include <qlist.h>
+#include <qobject.h>
+
+#include "qtscriptshell_QFile.h"
+
+static const char * const qtscript_QFile_function_names[] = {
+ "QFile"
+ // static
+ , "copy"
+ , "decodeName"
+ , "encodeName"
+ , "exists"
+ , "link"
+ , "permissions"
+ , "remove"
+ , "rename"
+ , "resize"
+ , "setPermissions"
+ , "symLinkTarget"
+ // prototype
+ , "copy"
+ , "error"
+ , "exists"
+ , "fileEngine"
+ , "fileName"
+ , "flush"
+ , "handle"
+ , "link"
+ , "permissions"
+ , "remove"
+ , "rename"
+ , "resize"
+ , "setFileName"
+ , "setPermissions"
+ , "symLinkTarget"
+ , "unsetError"
+ , "toString"
+};
+
+static const char * const qtscript_QFile_function_signatures[] = {
+ "\nQObject parent\nString name\nString name, QObject parent"
+ // static
+ , "String fileName, String newName"
+ , "QByteArray localFileName"
+ , "String fileName"
+ , "String fileName"
+ , "String oldname, String newName"
+ , "String filename"
+ , "String fileName"
+ , "String oldName, String newName"
+ , "String filename, qint64 sz"
+ , "String filename, Permissions permissionSpec"
+ , "String fileName"
+ // prototype
+ , "String newName"
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "String newName"
+ , ""
+ , ""
+ , "String newName"
+ , "qint64 sz"
+ , "String name"
+ , "Permissions permissionSpec"
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QFile_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QFile::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QFile*)
+Q_DECLARE_METATYPE(QtScriptShell_QFile*)
+Q_DECLARE_METATYPE(QFile::FileError)
+Q_DECLARE_METATYPE(QFile::MemoryMapFlags)
+Q_DECLARE_METATYPE(QFile::Permission)
+Q_DECLARE_METATYPE(QFlags<QFile::Permission>)
+Q_DECLARE_METATYPE(QAbstractFileEngine*)
+Q_DECLARE_METATYPE(QIODevice*)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+static QScriptValue qtscript_create_flags_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString,
+ QScriptEngine::FunctionSignature equals)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("equals"),
+ engine->newFunction(equals), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto);
+}
+
+//
+// QFile::FileError
+//
+
+static const QFile::FileError qtscript_QFile_FileError_values[] = {
+ QFile::NoError
+ , QFile::ReadError
+ , QFile::WriteError
+ , QFile::FatalError
+ , QFile::ResourceError
+ , QFile::OpenError
+ , QFile::AbortError
+ , QFile::TimeOutError
+ , QFile::UnspecifiedError
+ , QFile::RemoveError
+ , QFile::RenameError
+ , QFile::PositionError
+ , QFile::ResizeError
+ , QFile::PermissionsError
+ , QFile::CopyError
+};
+
+static const char * const qtscript_QFile_FileError_keys[] = {
+ "NoError"
+ , "ReadError"
+ , "WriteError"
+ , "FatalError"
+ , "ResourceError"
+ , "OpenError"
+ , "AbortError"
+ , "TimeOutError"
+ , "UnspecifiedError"
+ , "RemoveError"
+ , "RenameError"
+ , "PositionError"
+ , "ResizeError"
+ , "PermissionsError"
+ , "CopyError"
+};
+
+static QString qtscript_QFile_FileError_toStringHelper(QFile::FileError value)
+{
+ if ((value >= QFile::NoError) && (value <= QFile::CopyError))
+ return qtscript_QFile_FileError_keys[static_cast<int>(value)-static_cast<int>(QFile::NoError)];
+ return QString();
+}
+
+static QScriptValue qtscript_QFile_FileError_toScriptValue(QScriptEngine *engine, const QFile::FileError &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QFile"));
+ return clazz.property(qtscript_QFile_FileError_toStringHelper(value));
+}
+
+static void qtscript_QFile_FileError_fromScriptValue(const QScriptValue &value, QFile::FileError &out)
+{
+ out = qvariant_cast<QFile::FileError>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QFile_FileError(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QFile::NoError) && (arg <= QFile::CopyError))
+ return qScriptValueFromValue(engine, static_cast<QFile::FileError>(arg));
+ return context->throwError(QString::fromLatin1("FileError(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QFile_FileError_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QFile::FileError value = qscriptvalue_cast<QFile::FileError>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QFile_FileError_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QFile::FileError value = qscriptvalue_cast<QFile::FileError>(context->thisObject());
+ return QScriptValue(engine, qtscript_QFile_FileError_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QFile_FileError_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QFile_FileError,
+ qtscript_QFile_FileError_valueOf, qtscript_QFile_FileError_toString);
+ qScriptRegisterMetaType<QFile::FileError>(engine, qtscript_QFile_FileError_toScriptValue,
+ qtscript_QFile_FileError_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 15; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QFile_FileError_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QFile_FileError_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QFile::MemoryMapFlags
+//
+
+static const QFile::MemoryMapFlags qtscript_QFile_MemoryMapFlags_values[] = {
+ QFile::NoOptions
+};
+
+static const char * const qtscript_QFile_MemoryMapFlags_keys[] = {
+ "NoOptions"
+};
+
+static QString qtscript_QFile_MemoryMapFlags_toStringHelper(QFile::MemoryMapFlags value)
+{
+ if ((value >= QFile::NoOptions) && (value <= QFile::NoOptions))
+ return qtscript_QFile_MemoryMapFlags_keys[static_cast<int>(value)-static_cast<int>(QFile::NoOptions)];
+ return QString();
+}
+
+static QScriptValue qtscript_QFile_MemoryMapFlags_toScriptValue(QScriptEngine *engine, const QFile::MemoryMapFlags &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QFile"));
+ return clazz.property(qtscript_QFile_MemoryMapFlags_toStringHelper(value));
+}
+
+static void qtscript_QFile_MemoryMapFlags_fromScriptValue(const QScriptValue &value, QFile::MemoryMapFlags &out)
+{
+ out = qvariant_cast<QFile::MemoryMapFlags>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QFile_MemoryMapFlags(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QFile::NoOptions) && (arg <= QFile::NoOptions))
+ return qScriptValueFromValue(engine, static_cast<QFile::MemoryMapFlags>(arg));
+ return context->throwError(QString::fromLatin1("MemoryMapFlags(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QFile_MemoryMapFlags_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QFile::MemoryMapFlags value = qscriptvalue_cast<QFile::MemoryMapFlags>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QFile_MemoryMapFlags_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QFile::MemoryMapFlags value = qscriptvalue_cast<QFile::MemoryMapFlags>(context->thisObject());
+ return QScriptValue(engine, qtscript_QFile_MemoryMapFlags_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QFile_MemoryMapFlags_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QFile_MemoryMapFlags,
+ qtscript_QFile_MemoryMapFlags_valueOf, qtscript_QFile_MemoryMapFlags_toString);
+ qScriptRegisterMetaType<QFile::MemoryMapFlags>(engine, qtscript_QFile_MemoryMapFlags_toScriptValue,
+ qtscript_QFile_MemoryMapFlags_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 1; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QFile_MemoryMapFlags_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QFile_MemoryMapFlags_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QFile::Permission
+//
+
+static const QFile::Permission qtscript_QFile_Permission_values[] = {
+ QFile::ExeOther
+ , QFile::WriteOther
+ , QFile::ReadOther
+ , QFile::ExeGroup
+ , QFile::WriteGroup
+ , QFile::ReadGroup
+ , QFile::ExeUser
+ , QFile::WriteUser
+ , QFile::ReadUser
+ , QFile::ExeOwner
+ , QFile::WriteOwner
+ , QFile::ReadOwner
+};
+
+static const char * const qtscript_QFile_Permission_keys[] = {
+ "ExeOther"
+ , "WriteOther"
+ , "ReadOther"
+ , "ExeGroup"
+ , "WriteGroup"
+ , "ReadGroup"
+ , "ExeUser"
+ , "WriteUser"
+ , "ReadUser"
+ , "ExeOwner"
+ , "WriteOwner"
+ , "ReadOwner"
+};
+
+static QString qtscript_QFile_Permission_toStringHelper(QFile::Permission value)
+{
+ for (int i = 0; i < 12; ++i) {
+ if (qtscript_QFile_Permission_values[i] == value)
+ return QString::fromLatin1(qtscript_QFile_Permission_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_QFile_Permission_toScriptValue(QScriptEngine *engine, const QFile::Permission &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QFile"));
+ return clazz.property(qtscript_QFile_Permission_toStringHelper(value));
+}
+
+static void qtscript_QFile_Permission_fromScriptValue(const QScriptValue &value, QFile::Permission &out)
+{
+ out = qvariant_cast<QFile::Permission>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QFile_Permission(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 12; ++i) {
+ if (qtscript_QFile_Permission_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<QFile::Permission>(arg));
+ }
+ return context->throwError(QString::fromLatin1("Permission(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QFile_Permission_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QFile::Permission value = qscriptvalue_cast<QFile::Permission>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QFile_Permission_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QFile::Permission value = qscriptvalue_cast<QFile::Permission>(context->thisObject());
+ return QScriptValue(engine, qtscript_QFile_Permission_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QFile_Permission_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QFile_Permission,
+ qtscript_QFile_Permission_valueOf, qtscript_QFile_Permission_toString);
+ qScriptRegisterMetaType<QFile::Permission>(engine, qtscript_QFile_Permission_toScriptValue,
+ qtscript_QFile_Permission_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 12; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QFile_Permission_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QFile_Permission_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QFile::Permissions
+//
+
+static QScriptValue qtscript_QFile_Permissions_toScriptValue(QScriptEngine *engine, const QFile::Permissions &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_QFile_Permissions_fromScriptValue(const QScriptValue &value, QFile::Permissions &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<QFile::Permissions>())
+ out = qvariant_cast<QFile::Permissions>(var);
+ else if (var.userType() == qMetaTypeId<QFile::Permission>())
+ out = qvariant_cast<QFile::Permission>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_QFile_Permissions(QScriptContext *context, QScriptEngine *engine)
+{
+ QFile::Permissions result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<QFile::Permissions>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<QFile::Permission>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("Permissions(): argument %0 is not of type Permission").arg(i));
+ }
+ result |= qvariant_cast<QFile::Permission>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_QFile_Permissions_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QFile::Permissions value = qscriptvalue_cast<QFile::Permissions>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QFile_Permissions_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QFile::Permissions value = qscriptvalue_cast<QFile::Permissions>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 12; ++i) {
+ if ((value & qtscript_QFile_Permission_values[i]) == qtscript_QFile_Permission_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_QFile_Permission_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_QFile_Permissions_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<QFile::Permissions>() == otherObj.value<QFile::Permissions>())));
+}
+
+static QScriptValue qtscript_create_QFile_Permissions_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_QFile_Permissions, qtscript_QFile_Permissions_valueOf,
+ qtscript_QFile_Permissions_toString, qtscript_QFile_Permissions_equals);
+ qScriptRegisterMetaType<QFile::Permissions>(engine, qtscript_QFile_Permissions_toScriptValue,
+ qtscript_QFile_Permissions_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// QFile
+//
+
+static QScriptValue qtscript_QFile_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 16;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QFile* _q_self = qscriptvalue_cast<QFile*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QFile.%0(): this object is not a QFile")
+ .arg(qtscript_QFile_function_names[_id+12]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->copy(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QFile::FileError _q_result = _q_self->error();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->exists();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QAbstractFileEngine* _q_result = _q_self->fileEngine();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->fileName();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->flush();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->handle();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->link(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 0) {
+ QFlags<QFile::Permission> _q_result = _q_self->permissions();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->remove();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->rename(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 1) {
+ qint64 _q_arg0 = qscriptvalue_cast<qint64>(context->argument(0));
+ bool _q_result = _q_self->resize(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setFileName(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 1) {
+ QFlags<QFile::Permission> _q_arg0 = qscriptvalue_cast<QFlags<QFile::Permission> >(context->argument(0));
+ bool _q_result = _q_self->setPermissions(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->symLinkTarget();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 0) {
+ _q_self->unsetError();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 16: {
+ QString result = QString::fromLatin1("QFile");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QFile_throw_ambiguity_error_helper(context,
+ qtscript_QFile_function_names[_id+12],
+ qtscript_QFile_function_signatures[_id+12]);
+}
+
+static QScriptValue qtscript_QFile_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QFile(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QFile* _q_cpp_result = new QtScriptShell_QFile();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QFile*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ if (context->argument(0).isQObject()) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QtScriptShell_QFile* _q_cpp_result = new QtScriptShell_QFile(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QFile*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QtScriptShell_QFile* _q_cpp_result = new QtScriptShell_QFile(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QFile*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QObject* _q_arg1 = context->argument(1).toQObject();
+ QtScriptShell_QFile* _q_cpp_result = new QtScriptShell_QFile(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QFile*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ bool _q_result = QFile::copy(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QString _q_result = QFile::decodeName(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QByteArray _q_result = QFile::encodeName(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = QFile::exists(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ bool _q_result = QFile::link(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QFlags<QFile::Permission> _q_result = QFile::permissions(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = QFile::remove(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ bool _q_result = QFile::rename(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ qint64 _q_arg1 = qscriptvalue_cast<qint64>(context->argument(1));
+ bool _q_result = QFile::resize(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QFlags<QFile::Permission> _q_arg1 = qscriptvalue_cast<QFlags<QFile::Permission> >(context->argument(1));
+ bool _q_result = QFile::setPermissions(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_result = QFile::symLinkTarget(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QFile_throw_ambiguity_error_helper(context,
+ qtscript_QFile_function_names[_id],
+ qtscript_QFile_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QFile_toScriptValue(QScriptEngine *engine, QFile* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QFile_fromScriptValue(const QScriptValue &value, QFile* &out)
+{
+ out = qobject_cast<QFile*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QFile_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 2
+ // static
+ , 2
+ , 1
+ , 1
+ , 1
+ , 2
+ , 1
+ , 1
+ , 2
+ , 2
+ , 2
+ , 1
+ // prototype
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QFile*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QFile*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QIODevice*>()));
+ for (int i = 0; i < 17; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QFile_prototype_call, function_lengths[i+12]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QFile_function_names[i+12]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<QFile*>(engine, qtscript_QFile_toScriptValue,
+ qtscript_QFile_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QFile_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 11; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QFile_static_call,
+ function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_QFile_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ ctor.setProperty(QString::fromLatin1("FileError"),
+ qtscript_create_QFile_FileError_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("MemoryMapFlags"),
+ qtscript_create_QFile_MemoryMapFlags_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("Permission"),
+ qtscript_create_QFile_Permission_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("Permissions"),
+ qtscript_create_QFile_Permissions_class(engine));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QFileInfo.cpp b/qtbindings/com_nokia_qt_core/qtscript_QFileInfo.cpp
new file mode 100644
index 0000000..eda1d48
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QFileInfo.cpp
@@ -0,0 +1,648 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qfileinfo.h>
+#include <QDateTime>
+#include <QDir>
+#include <QVariant>
+#include <qdir.h>
+#include <qfile.h>
+#include <qfileinfo.h>
+
+static const char * const qtscript_QFileInfo_function_names[] = {
+ "QFileInfo"
+ // static
+ // prototype
+ , "absoluteDir"
+ , "absoluteFilePath"
+ , "absolutePath"
+ , "baseName"
+ , "bundleName"
+ , "caching"
+ , "canonicalFilePath"
+ , "canonicalPath"
+ , "completeBaseName"
+ , "completeSuffix"
+ , "created"
+ , "dir"
+ , "exists"
+ , "fileName"
+ , "filePath"
+ , "group"
+ , "groupId"
+ , "isAbsolute"
+ , "isBundle"
+ , "isDir"
+ , "isExecutable"
+ , "isFile"
+ , "isHidden"
+ , "isReadable"
+ , "isRelative"
+ , "isRoot"
+ , "isSymLink"
+ , "isWritable"
+ , "lastModified"
+ , "lastRead"
+ , "makeAbsolute"
+ , "equals"
+ , "owner"
+ , "ownerId"
+ , "path"
+ , "permission"
+ , "permissions"
+ , "refresh"
+ , "setCaching"
+ , "setFile"
+ , "size"
+ , "suffix"
+ , "symLinkTarget"
+ , "toString"
+};
+
+static const char * const qtscript_QFileInfo_function_signatures[] = {
+ "\nQDir dir, String file\nQFile file\nQFileInfo fileinfo\nString file"
+ // static
+ // prototype
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "QFileInfo fileinfo"
+ , ""
+ , ""
+ , ""
+ , "Permissions permissions"
+ , ""
+ , ""
+ , "bool on"
+ , "QDir dir, String file\nQFile file\nString file"
+ , ""
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QFileInfo_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QFileInfo::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QFileInfo)
+Q_DECLARE_METATYPE(QFileInfo*)
+Q_DECLARE_METATYPE(QDir)
+Q_DECLARE_METATYPE(QFlags<QFile::Permission>)
+Q_DECLARE_METATYPE(QFile*)
+
+//
+// QFileInfo
+//
+
+static QScriptValue qtscript_QFileInfo_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 43;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QFileInfo* _q_self = qscriptvalue_cast<QFileInfo*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QFileInfo.%0(): this object is not a QFileInfo")
+ .arg(qtscript_QFileInfo_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ QDir _q_result = _q_self->absoluteDir();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->absoluteFilePath();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->absolutePath();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->baseName();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->bundleName();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->caching();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->canonicalFilePath();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->canonicalPath();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->completeBaseName();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->completeSuffix();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 0) {
+ QDateTime _q_result = _q_self->created();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 0) {
+ QDir _q_result = _q_self->dir();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->exists();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->fileName();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->filePath();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->group();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 0) {
+ uint _q_result = _q_self->groupId();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isAbsolute();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isBundle();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isDir();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isExecutable();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 21:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isFile();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 22:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isHidden();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 23:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isReadable();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 24:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isRelative();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 25:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isRoot();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 26:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isSymLink();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 27:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isWritable();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 28:
+ if (context->argumentCount() == 0) {
+ QDateTime _q_result = _q_self->lastModified();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 29:
+ if (context->argumentCount() == 0) {
+ QDateTime _q_result = _q_self->lastRead();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 30:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->makeAbsolute();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 31:
+ if (context->argumentCount() == 1) {
+ QFileInfo _q_arg0 = qscriptvalue_cast<QFileInfo>(context->argument(0));
+ bool _q_result = _q_self->operator==(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 32:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->owner();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 33:
+ if (context->argumentCount() == 0) {
+ uint _q_result = _q_self->ownerId();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 34:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->path();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 35:
+ if (context->argumentCount() == 1) {
+ QFlags<QFile::Permission> _q_arg0 = qscriptvalue_cast<QFlags<QFile::Permission> >(context->argument(0));
+ bool _q_result = _q_self->permission(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 36:
+ if (context->argumentCount() == 0) {
+ QFlags<QFile::Permission> _q_result = _q_self->permissions();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 37:
+ if (context->argumentCount() == 0) {
+ _q_self->refresh();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 38:
+ if (context->argumentCount() == 1) {
+ bool _q_arg0 = context->argument(0).toBoolean();
+ _q_self->setCaching(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 39:
+ if (context->argumentCount() == 1) {
+ if (qscriptvalue_cast<QFile*>(context->argument(0))) {
+
+ QFile & _q_arg0 = *qscriptvalue_cast<QFile*>(context->argument(0));
+ _q_self->setFile(_q_arg0);
+ return context->engine()->undefinedValue();
+ } else if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setFile(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ }
+ if (context->argumentCount() == 2) {
+ QDir _q_arg0 = qscriptvalue_cast<QDir>(context->argument(0));
+ QString _q_arg1 = context->argument(1).toString();
+ _q_self->setFile(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 40:
+ if (context->argumentCount() == 0) {
+ qint64 _q_result = _q_self->size();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 41:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->suffix();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 42:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->symLinkTarget();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 43: {
+ QString result = QString::fromLatin1("QFileInfo");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QFileInfo_throw_ambiguity_error_helper(context,
+ qtscript_QFileInfo_function_names[_id+1],
+ qtscript_QFileInfo_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QFileInfo_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QFileInfo(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QFileInfo _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ if (qscriptvalue_cast<QFile*>(context->argument(0))) {
+
+ QFile & _q_arg0 = *qscriptvalue_cast<QFile*>(context->argument(0));
+ QFileInfo _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if ((qMetaTypeId<QFileInfo>() == context->argument(0).toVariant().userType())) {
+ QFileInfo _q_arg0 = qscriptvalue_cast<QFileInfo>(context->argument(0));
+ QFileInfo _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QFileInfo _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 2) {
+ QDir _q_arg0 = qscriptvalue_cast<QDir>(context->argument(0));
+ QString _q_arg1 = context->argument(1).toString();
+ QFileInfo _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QFileInfo_throw_ambiguity_error_helper(context,
+ qtscript_QFileInfo_function_names[_id],
+ qtscript_QFileInfo_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QFileInfo_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 2
+ // static
+ // prototype
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 1
+ , 2
+ , 0
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QFileInfo*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QFileInfo*)0));
+ for (int i = 0; i < 44; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QFileInfo_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QFileInfo_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QFileInfo>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QFileInfo*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QFileInfo_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QFileSystemWatcher.cpp b/qtbindings/com_nokia_qt_core/qtscript_QFileSystemWatcher.cpp
new file mode 100644
index 0000000..b4dc602
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QFileSystemWatcher.cpp
@@ -0,0 +1,278 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qfilesystemwatcher.h>
+#include <QStringList>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qstringlist.h>
+
+#include "qtscriptshell_QFileSystemWatcher.h"
+
+static const char * const qtscript_QFileSystemWatcher_function_names[] = {
+ "QFileSystemWatcher"
+ // static
+ // prototype
+ , "addPath"
+ , "addPaths"
+ , "directories"
+ , "files"
+ , "removePath"
+ , "removePaths"
+ , "toString"
+};
+
+static const char * const qtscript_QFileSystemWatcher_function_signatures[] = {
+ "QObject parent\nList paths, QObject parent"
+ // static
+ // prototype
+ , "String file"
+ , "List files"
+ , ""
+ , ""
+ , "String file"
+ , "List files"
+""
+};
+
+static QScriptValue qtscript_QFileSystemWatcher_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QFileSystemWatcher::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QFileSystemWatcher*)
+Q_DECLARE_METATYPE(QtScriptShell_QFileSystemWatcher*)
+
+//
+// QFileSystemWatcher
+//
+
+static QScriptValue qtscript_QFileSystemWatcher_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 6;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QFileSystemWatcher* _q_self = qscriptvalue_cast<QFileSystemWatcher*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QFileSystemWatcher.%0(): this object is not a QFileSystemWatcher")
+ .arg(qtscript_QFileSystemWatcher_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->addPath(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ _q_self->addPaths(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QStringList _q_result = _q_self->directories();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QStringList _q_result = _q_self->files();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->removePath(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 1) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ _q_self->removePaths(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 6: {
+ QString result = QString::fromLatin1("QFileSystemWatcher");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QFileSystemWatcher_throw_ambiguity_error_helper(context,
+ qtscript_QFileSystemWatcher_function_names[_id+1],
+ qtscript_QFileSystemWatcher_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QFileSystemWatcher_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QFileSystemWatcher(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QFileSystemWatcher* _q_cpp_result = new QtScriptShell_QFileSystemWatcher();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QFileSystemWatcher*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ if (context->argument(0).isQObject()) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QtScriptShell_QFileSystemWatcher* _q_cpp_result = new QtScriptShell_QFileSystemWatcher(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QFileSystemWatcher*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argument(0).isArray()) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ QtScriptShell_QFileSystemWatcher* _q_cpp_result = new QtScriptShell_QFileSystemWatcher(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QFileSystemWatcher*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 2) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ QObject* _q_arg1 = context->argument(1).toQObject();
+ QtScriptShell_QFileSystemWatcher* _q_cpp_result = new QtScriptShell_QFileSystemWatcher(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QFileSystemWatcher*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QFileSystemWatcher_throw_ambiguity_error_helper(context,
+ qtscript_QFileSystemWatcher_function_names[_id],
+ qtscript_QFileSystemWatcher_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QFileSystemWatcher_toScriptValue(QScriptEngine *engine, QFileSystemWatcher* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QFileSystemWatcher_fromScriptValue(const QScriptValue &value, QFileSystemWatcher* &out)
+{
+ out = qobject_cast<QFileSystemWatcher*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QFileSystemWatcher_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 2
+ // static
+ // prototype
+ , 1
+ , 1
+ , 0
+ , 0
+ , 1
+ , 1
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QFileSystemWatcher*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QFileSystemWatcher*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
+ for (int i = 0; i < 7; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QFileSystemWatcher_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QFileSystemWatcher_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<QFileSystemWatcher*>(engine, qtscript_QFileSystemWatcher_toScriptValue,
+ qtscript_QFileSystemWatcher_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QFileSystemWatcher_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QIODevice.cpp b/qtbindings/com_nokia_qt_core/qtscript_QIODevice.cpp
new file mode 100644
index 0000000..e84a283
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QIODevice.cpp
@@ -0,0 +1,693 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qiodevice.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qiodevice.h>
+#include <qlist.h>
+#include <qobject.h>
+
+#include "qtscriptshell_QIODevice.h"
+
+static const char * const qtscript_QIODevice_function_names[] = {
+ "QIODevice"
+ // static
+ // prototype
+ , "atEnd"
+ , "bytesAvailable"
+ , "bytesToWrite"
+ , "canReadLine"
+ , "close"
+ , "errorString"
+ , "getChar"
+ , "isOpen"
+ , "isReadable"
+ , "isSequential"
+ , "isTextModeEnabled"
+ , "isWritable"
+ , "open"
+ , "openMode"
+ , "peek"
+ , "pos"
+ , "putChar"
+ , "read"
+ , "readAll"
+ , "readLine"
+ , "reset"
+ , "seek"
+ , "setTextModeEnabled"
+ , "size"
+ , "ungetChar"
+ , "waitForBytesWritten"
+ , "waitForReadyRead"
+ , "write"
+ , "toString"
+};
+
+static const char * const qtscript_QIODevice_function_signatures[] = {
+ "\nQObject parent"
+ // static
+ // prototype
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "char c"
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "OpenMode mode"
+ , ""
+ , "qint64 maxlen"
+ , ""
+ , "char c"
+ , "qint64 maxlen"
+ , ""
+ , "qint64 maxlen"
+ , ""
+ , "qint64 pos"
+ , "bool enabled"
+ , ""
+ , "char c"
+ , "int msecs"
+ , "int msecs"
+ , "QByteArray data\nchar data"
+""
+};
+
+static QScriptValue qtscript_QIODevice_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QIODevice::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QIODevice*)
+Q_DECLARE_METATYPE(QtScriptShell_QIODevice*)
+Q_DECLARE_METATYPE(QIODevice::OpenModeFlag)
+Q_DECLARE_METATYPE(QFlags<QIODevice::OpenModeFlag>)
+Q_DECLARE_METATYPE(char*)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+static QScriptValue qtscript_create_flags_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString,
+ QScriptEngine::FunctionSignature equals)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("equals"),
+ engine->newFunction(equals), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto);
+}
+
+//
+// QIODevice::OpenModeFlag
+//
+
+static const QIODevice::OpenModeFlag qtscript_QIODevice_OpenModeFlag_values[] = {
+ QIODevice::NotOpen
+ , QIODevice::ReadOnly
+ , QIODevice::WriteOnly
+ , QIODevice::ReadWrite
+ , QIODevice::Append
+ , QIODevice::Truncate
+ , QIODevice::Text
+ , QIODevice::Unbuffered
+};
+
+static const char * const qtscript_QIODevice_OpenModeFlag_keys[] = {
+ "NotOpen"
+ , "ReadOnly"
+ , "WriteOnly"
+ , "ReadWrite"
+ , "Append"
+ , "Truncate"
+ , "Text"
+ , "Unbuffered"
+};
+
+static QString qtscript_QIODevice_OpenModeFlag_toStringHelper(QIODevice::OpenModeFlag value)
+{
+ for (int i = 0; i < 8; ++i) {
+ if (qtscript_QIODevice_OpenModeFlag_values[i] == value)
+ return QString::fromLatin1(qtscript_QIODevice_OpenModeFlag_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_QIODevice_OpenModeFlag_toScriptValue(QScriptEngine *engine, const QIODevice::OpenModeFlag &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QIODevice"));
+ return clazz.property(qtscript_QIODevice_OpenModeFlag_toStringHelper(value));
+}
+
+static void qtscript_QIODevice_OpenModeFlag_fromScriptValue(const QScriptValue &value, QIODevice::OpenModeFlag &out)
+{
+ out = qvariant_cast<QIODevice::OpenModeFlag>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QIODevice_OpenModeFlag(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 8; ++i) {
+ if (qtscript_QIODevice_OpenModeFlag_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<QIODevice::OpenModeFlag>(arg));
+ }
+ return context->throwError(QString::fromLatin1("OpenModeFlag(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QIODevice_OpenModeFlag_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QIODevice::OpenModeFlag value = qscriptvalue_cast<QIODevice::OpenModeFlag>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QIODevice_OpenModeFlag_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QIODevice::OpenModeFlag value = qscriptvalue_cast<QIODevice::OpenModeFlag>(context->thisObject());
+ return QScriptValue(engine, qtscript_QIODevice_OpenModeFlag_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QIODevice_OpenModeFlag_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QIODevice_OpenModeFlag,
+ qtscript_QIODevice_OpenModeFlag_valueOf, qtscript_QIODevice_OpenModeFlag_toString);
+ qScriptRegisterMetaType<QIODevice::OpenModeFlag>(engine, qtscript_QIODevice_OpenModeFlag_toScriptValue,
+ qtscript_QIODevice_OpenModeFlag_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 8; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QIODevice_OpenModeFlag_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QIODevice_OpenModeFlag_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QIODevice::OpenMode
+//
+
+static QScriptValue qtscript_QIODevice_OpenMode_toScriptValue(QScriptEngine *engine, const QIODevice::OpenMode &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_QIODevice_OpenMode_fromScriptValue(const QScriptValue &value, QIODevice::OpenMode &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<QIODevice::OpenMode>())
+ out = qvariant_cast<QIODevice::OpenMode>(var);
+ else if (var.userType() == qMetaTypeId<QIODevice::OpenModeFlag>())
+ out = qvariant_cast<QIODevice::OpenModeFlag>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_QIODevice_OpenMode(QScriptContext *context, QScriptEngine *engine)
+{
+ QIODevice::OpenMode result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<QIODevice::OpenMode>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<QIODevice::OpenModeFlag>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("OpenMode(): argument %0 is not of type OpenModeFlag").arg(i));
+ }
+ result |= qvariant_cast<QIODevice::OpenModeFlag>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_QIODevice_OpenMode_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QIODevice::OpenMode value = qscriptvalue_cast<QIODevice::OpenMode>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QIODevice_OpenMode_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QIODevice::OpenMode value = qscriptvalue_cast<QIODevice::OpenMode>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 8; ++i) {
+ if ((value & qtscript_QIODevice_OpenModeFlag_values[i]) == qtscript_QIODevice_OpenModeFlag_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_QIODevice_OpenModeFlag_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_QIODevice_OpenMode_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<QIODevice::OpenMode>() == otherObj.value<QIODevice::OpenMode>())));
+}
+
+static QScriptValue qtscript_create_QIODevice_OpenMode_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_QIODevice_OpenMode, qtscript_QIODevice_OpenMode_valueOf,
+ qtscript_QIODevice_OpenMode_toString, qtscript_QIODevice_OpenMode_equals);
+ qScriptRegisterMetaType<QIODevice::OpenMode>(engine, qtscript_QIODevice_OpenMode_toScriptValue,
+ qtscript_QIODevice_OpenMode_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// QIODevice
+//
+
+static QScriptValue qtscript_QIODevice_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 28;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QIODevice* _q_self = qscriptvalue_cast<QIODevice*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QIODevice.%0(): this object is not a QIODevice")
+ .arg(qtscript_QIODevice_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->atEnd();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ qint64 _q_result = _q_self->bytesAvailable();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ qint64 _q_result = _q_self->bytesToWrite();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->canReadLine();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ _q_self->close();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->errorString();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 1) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ bool _q_result = _q_self->getChar(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isOpen();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isReadable();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isSequential();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isTextModeEnabled();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isWritable();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 1) {
+ QFlags<QIODevice::OpenModeFlag> _q_arg0 = qscriptvalue_cast<QFlags<QIODevice::OpenModeFlag> >(context->argument(0));
+ bool _q_result = _q_self->open(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 0) {
+ QFlags<QIODevice::OpenModeFlag> _q_result = _q_self->openMode();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 1) {
+ qint64 _q_arg0 = qscriptvalue_cast<qint64>(context->argument(0));
+ QByteArray _q_result = _q_self->peek(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 0) {
+ qint64 _q_result = _q_self->pos();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 1) {
+ char _q_arg0 = qscriptvalue_cast<char>(context->argument(0));
+ bool _q_result = _q_self->putChar(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 1) {
+ qint64 _q_arg0 = qscriptvalue_cast<qint64>(context->argument(0));
+ QByteArray _q_result = _q_self->read(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->readAll();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->readLine();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ qint64 _q_arg0 = qscriptvalue_cast<qint64>(context->argument(0));
+ QByteArray _q_result = _q_self->readLine(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->reset();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 21:
+ if (context->argumentCount() == 1) {
+ qint64 _q_arg0 = qscriptvalue_cast<qint64>(context->argument(0));
+ bool _q_result = _q_self->seek(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 22:
+ if (context->argumentCount() == 1) {
+ bool _q_arg0 = context->argument(0).toBoolean();
+ _q_self->setTextModeEnabled(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 23:
+ if (context->argumentCount() == 0) {
+ qint64 _q_result = _q_self->size();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 24:
+ if (context->argumentCount() == 1) {
+ char _q_arg0 = qscriptvalue_cast<char>(context->argument(0));
+ _q_self->ungetChar(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 25:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ bool _q_result = _q_self->waitForBytesWritten(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 26:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ bool _q_result = _q_self->waitForReadyRead(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 27:
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ qint64 _q_result = _q_self->write(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ } else if (qscriptvalue_cast<char*>(context->argument(0))) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ qint64 _q_result = _q_self->write(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 28: {
+ QString result = QString::fromLatin1("QIODevice");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QIODevice_throw_ambiguity_error_helper(context,
+ qtscript_QIODevice_function_names[_id+1],
+ qtscript_QIODevice_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QIODevice_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QIODevice(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QIODevice* _q_cpp_result = new QtScriptShell_QIODevice();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QIODevice*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QtScriptShell_QIODevice* _q_cpp_result = new QtScriptShell_QIODevice(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QIODevice*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QIODevice_throw_ambiguity_error_helper(context,
+ qtscript_QIODevice_function_names[_id],
+ qtscript_QIODevice_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QIODevice_toScriptValue(QScriptEngine *engine, QIODevice* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QIODevice_fromScriptValue(const QScriptValue &value, QIODevice* &out)
+{
+ out = qobject_cast<QIODevice*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QIODevice_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 0
+ , 1
+ , 0
+ , 1
+ , 1
+ , 0
+ , 1
+ , 0
+ , 1
+ , 1
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QIODevice*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QIODevice*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
+ for (int i = 0; i < 29; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QIODevice_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QIODevice_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<QIODevice*>(engine, qtscript_QIODevice_toScriptValue,
+ qtscript_QIODevice_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QIODevice_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ ctor.setProperty(QString::fromLatin1("OpenModeFlag"),
+ qtscript_create_QIODevice_OpenModeFlag_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("OpenMode"),
+ qtscript_create_QIODevice_OpenMode_class(engine));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QLibraryInfo.cpp b/qtbindings/com_nokia_qt_core/qtscript_QLibraryInfo.cpp
new file mode 100644
index 0000000..a4b455e
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QLibraryInfo.cpp
@@ -0,0 +1,305 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qlibraryinfo.h>
+#include <QVariant>
+
+static const char * const qtscript_QLibraryInfo_function_names[] = {
+ "QLibraryInfo"
+ // static
+ , "buildKey"
+ , "licensedProducts"
+ , "licensee"
+ , "location"
+ // prototype
+ , "toString"
+};
+
+static const char * const qtscript_QLibraryInfo_function_signatures[] = {
+ ""
+ // static
+ , ""
+ , ""
+ , ""
+ , "LibraryLocation arg__1"
+ // prototype
+""
+};
+
+static QScriptValue qtscript_QLibraryInfo_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QLibraryInfo::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QLibraryInfo*)
+Q_DECLARE_METATYPE(QLibraryInfo::LibraryLocation)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// QLibraryInfo::LibraryLocation
+//
+
+static const QLibraryInfo::LibraryLocation qtscript_QLibraryInfo_LibraryLocation_values[] = {
+ QLibraryInfo::PrefixPath
+ , QLibraryInfo::DocumentationPath
+ , QLibraryInfo::HeadersPath
+ , QLibraryInfo::LibrariesPath
+ , QLibraryInfo::BinariesPath
+ , QLibraryInfo::PluginsPath
+ , QLibraryInfo::DataPath
+ , QLibraryInfo::TranslationsPath
+ , QLibraryInfo::SettingsPath
+ , QLibraryInfo::DemosPath
+ , QLibraryInfo::ExamplesPath
+};
+
+static const char * const qtscript_QLibraryInfo_LibraryLocation_keys[] = {
+ "PrefixPath"
+ , "DocumentationPath"
+ , "HeadersPath"
+ , "LibrariesPath"
+ , "BinariesPath"
+ , "PluginsPath"
+ , "DataPath"
+ , "TranslationsPath"
+ , "SettingsPath"
+ , "DemosPath"
+ , "ExamplesPath"
+};
+
+static QString qtscript_QLibraryInfo_LibraryLocation_toStringHelper(QLibraryInfo::LibraryLocation value)
+{
+ if ((value >= QLibraryInfo::PrefixPath) && (value <= QLibraryInfo::ExamplesPath))
+ return qtscript_QLibraryInfo_LibraryLocation_keys[static_cast<int>(value)-static_cast<int>(QLibraryInfo::PrefixPath)];
+ return QString();
+}
+
+static QScriptValue qtscript_QLibraryInfo_LibraryLocation_toScriptValue(QScriptEngine *engine, const QLibraryInfo::LibraryLocation &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QLibraryInfo"));
+ return clazz.property(qtscript_QLibraryInfo_LibraryLocation_toStringHelper(value));
+}
+
+static void qtscript_QLibraryInfo_LibraryLocation_fromScriptValue(const QScriptValue &value, QLibraryInfo::LibraryLocation &out)
+{
+ out = qvariant_cast<QLibraryInfo::LibraryLocation>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QLibraryInfo_LibraryLocation(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QLibraryInfo::PrefixPath) && (arg <= QLibraryInfo::ExamplesPath))
+ return qScriptValueFromValue(engine, static_cast<QLibraryInfo::LibraryLocation>(arg));
+ return context->throwError(QString::fromLatin1("LibraryLocation(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QLibraryInfo_LibraryLocation_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QLibraryInfo::LibraryLocation value = qscriptvalue_cast<QLibraryInfo::LibraryLocation>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QLibraryInfo_LibraryLocation_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QLibraryInfo::LibraryLocation value = qscriptvalue_cast<QLibraryInfo::LibraryLocation>(context->thisObject());
+ return QScriptValue(engine, qtscript_QLibraryInfo_LibraryLocation_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QLibraryInfo_LibraryLocation_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QLibraryInfo_LibraryLocation,
+ qtscript_QLibraryInfo_LibraryLocation_valueOf, qtscript_QLibraryInfo_LibraryLocation_toString);
+ qScriptRegisterMetaType<QLibraryInfo::LibraryLocation>(engine, qtscript_QLibraryInfo_LibraryLocation_toScriptValue,
+ qtscript_QLibraryInfo_LibraryLocation_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 11; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QLibraryInfo_LibraryLocation_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QLibraryInfo_LibraryLocation_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QLibraryInfo
+//
+
+static QScriptValue qtscript_QLibraryInfo_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 0;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QLibraryInfo* _q_self = qscriptvalue_cast<QLibraryInfo*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QLibraryInfo.%0(): this object is not a QLibraryInfo")
+ .arg(qtscript_QLibraryInfo_function_names[_id+5]));
+ }
+
+ switch (_id) {
+ case 0: {
+ QString result = QString::fromLatin1("QLibraryInfo");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QLibraryInfo_throw_ambiguity_error_helper(context,
+ qtscript_QLibraryInfo_function_names[_id+5],
+ qtscript_QLibraryInfo_function_signatures[_id+5]);
+}
+
+static QScriptValue qtscript_QLibraryInfo_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QLibraryInfo cannot be constructed"));
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QString _q_result = QLibraryInfo::buildKey();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QString _q_result = QLibraryInfo::licensedProducts();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QString _q_result = QLibraryInfo::licensee();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ QLibraryInfo::LibraryLocation _q_arg0 = qscriptvalue_cast<QLibraryInfo::LibraryLocation>(context->argument(0));
+ QString _q_result = QLibraryInfo::location(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QLibraryInfo_throw_ambiguity_error_helper(context,
+ qtscript_QLibraryInfo_function_names[_id],
+ qtscript_QLibraryInfo_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QLibraryInfo_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 0
+ // static
+ , 0
+ , 0
+ , 0
+ , 1
+ // prototype
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QLibraryInfo*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QLibraryInfo*)0));
+
+ engine->setDefaultPrototype(qMetaTypeId<QLibraryInfo*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QLibraryInfo_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 4; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QLibraryInfo_static_call,
+ function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_QLibraryInfo_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ ctor.setProperty(QString::fromLatin1("LibraryLocation"),
+ qtscript_create_QLibraryInfo_LibraryLocation_class(engine, ctor));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QLocale.cpp b/qtbindings/com_nokia_qt_core/qtscript_QLocale.cpp
new file mode 100644
index 0000000..e0ad946
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QLocale.cpp
@@ -0,0 +1,2251 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qlocale.h>
+#include <QDate>
+#include <QVariant>
+#include <qdatastream.h>
+#include <qdatetime.h>
+#include <qlist.h>
+#include <qlocale.h>
+
+static const char * const qtscript_QLocale_function_names[] = {
+ "QLocale"
+ // static
+ , "c"
+ , "countriesForLanguage"
+ , "countryToString"
+ , "languageToString"
+ , "setDefault"
+ , "system"
+ // prototype
+ , "amText"
+ , "country"
+ , "dateFormat"
+ , "dateTimeFormat"
+ , "dayName"
+ , "decimalPoint"
+ , "exponential"
+ , "groupSeparator"
+ , "language"
+ , "measurementSystem"
+ , "monthName"
+ , "name"
+ , "negativeSign"
+ , "numberOptions"
+ , "equals"
+ , "percent"
+ , "pmText"
+ , "positiveSign"
+ , "readFrom"
+ , "setNumberOptions"
+ , "standaloneDayName"
+ , "standaloneMonthName"
+ , "timeFormat"
+ , "toDate"
+ , "toDateTime"
+ , "toDouble"
+ , "toFloat"
+ , "toInt"
+ , "toLongLong"
+ , "toShort"
+ , "toString"
+ , "toTime"
+ , "toUShort"
+ , "writeTo"
+ , "zeroDigit"
+};
+
+static const char * const qtscript_QLocale_function_signatures[] = {
+ "\nLanguage language, Country country\nQLocale other\nString name"
+ // static
+ , ""
+ , "Language lang"
+ , "Country country"
+ , "Language language"
+ , "QLocale locale"
+ , ""
+ // prototype
+ , ""
+ , ""
+ , "FormatType format"
+ , "FormatType format"
+ , "int arg__1, FormatType format"
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "int arg__1, FormatType format"
+ , ""
+ , ""
+ , ""
+ , "QLocale other"
+ , ""
+ , ""
+ , ""
+ , "QDataStream arg__1"
+ , "NumberOptions options"
+ , "int arg__1, FormatType format"
+ , "int arg__1, FormatType format"
+ , "FormatType format"
+ , "String string, FormatType arg__2\nString string, String format"
+ , "String string, FormatType format\nString string, String format"
+ , "String s"
+ , "String s"
+ , "String s, int base"
+ , "String s, int base"
+ , "String s, int base"
+ , "QDate date, FormatType format\nQDate date, String formatStr\nQDateTime dateTime, FormatType format\nQDateTime dateTime, String format\nQTime time, FormatType format\nQTime time, String formatStr\ndouble i, char f, int prec\nfloat i, char f, int prec\nint i\nqulonglong i\nshort i"
+ , "String string, FormatType arg__2\nString string, String format"
+ , "String s, int base"
+ , "QDataStream arg__1"
+ , ""
+};
+
+static QScriptValue qtscript_QLocale_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QLocale::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+static const QMetaObject *qtscript_QLocale_metaObject()
+{
+ return &QLocale::staticMetaObject;
+}
+
+Q_DECLARE_METATYPE(QLocale*)
+Q_DECLARE_METATYPE(QLocale::MeasurementSystem)
+Q_DECLARE_METATYPE(QLocale::NumberOption)
+Q_DECLARE_METATYPE(QFlags<QLocale::NumberOption>)
+Q_DECLARE_METATYPE(QLocale::FormatType)
+Q_DECLARE_METATYPE(QLocale::Country)
+Q_DECLARE_METATYPE(QLocale::Language)
+Q_DECLARE_METATYPE(QDataStream*)
+Q_DECLARE_METATYPE(QList<QLocale::Country>)
+
+
+ Q_DECLARE_METATYPE(QScriptValue)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+static QScriptValue qtscript_create_flags_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString,
+ QScriptEngine::FunctionSignature equals)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("equals"),
+ engine->newFunction(equals), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto);
+}
+
+//
+// QLocale::MeasurementSystem
+//
+
+static const QLocale::MeasurementSystem qtscript_QLocale_MeasurementSystem_values[] = {
+ QLocale::MetricSystem
+ , QLocale::ImperialSystem
+};
+
+static const char * const qtscript_QLocale_MeasurementSystem_keys[] = {
+ "MetricSystem"
+ , "ImperialSystem"
+};
+
+static QString qtscript_QLocale_MeasurementSystem_toStringHelper(QLocale::MeasurementSystem value)
+{
+ if ((value >= QLocale::MetricSystem) && (value <= QLocale::ImperialSystem))
+ return qtscript_QLocale_MeasurementSystem_keys[static_cast<int>(value)-static_cast<int>(QLocale::MetricSystem)];
+ return QString();
+}
+
+static QScriptValue qtscript_QLocale_MeasurementSystem_toScriptValue(QScriptEngine *engine, const QLocale::MeasurementSystem &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QLocale"));
+ return clazz.property(qtscript_QLocale_MeasurementSystem_toStringHelper(value));
+}
+
+static void qtscript_QLocale_MeasurementSystem_fromScriptValue(const QScriptValue &value, QLocale::MeasurementSystem &out)
+{
+ out = qvariant_cast<QLocale::MeasurementSystem>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QLocale_MeasurementSystem(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QLocale::MetricSystem) && (arg <= QLocale::ImperialSystem))
+ return qScriptValueFromValue(engine, static_cast<QLocale::MeasurementSystem>(arg));
+ return context->throwError(QString::fromLatin1("MeasurementSystem(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QLocale_MeasurementSystem_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QLocale::MeasurementSystem value = qscriptvalue_cast<QLocale::MeasurementSystem>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QLocale_MeasurementSystem_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QLocale::MeasurementSystem value = qscriptvalue_cast<QLocale::MeasurementSystem>(context->thisObject());
+ return QScriptValue(engine, qtscript_QLocale_MeasurementSystem_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QLocale_MeasurementSystem_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QLocale_MeasurementSystem,
+ qtscript_QLocale_MeasurementSystem_valueOf, qtscript_QLocale_MeasurementSystem_toString);
+ qScriptRegisterMetaType<QLocale::MeasurementSystem>(engine, qtscript_QLocale_MeasurementSystem_toScriptValue,
+ qtscript_QLocale_MeasurementSystem_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QLocale_MeasurementSystem_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QLocale_MeasurementSystem_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QLocale::NumberOption
+//
+
+static const QLocale::NumberOption qtscript_QLocale_NumberOption_values[] = {
+ QLocale::OmitGroupSeparator
+ , QLocale::RejectGroupSeparator
+};
+
+static const char * const qtscript_QLocale_NumberOption_keys[] = {
+ "OmitGroupSeparator"
+ , "RejectGroupSeparator"
+};
+
+static QString qtscript_QLocale_NumberOption_toStringHelper(QLocale::NumberOption value)
+{
+ if ((value >= QLocale::OmitGroupSeparator) && (value <= QLocale::RejectGroupSeparator))
+ return qtscript_QLocale_NumberOption_keys[static_cast<int>(value)-static_cast<int>(QLocale::OmitGroupSeparator)];
+ return QString();
+}
+
+static QScriptValue qtscript_QLocale_NumberOption_toScriptValue(QScriptEngine *engine, const QLocale::NumberOption &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QLocale"));
+ return clazz.property(qtscript_QLocale_NumberOption_toStringHelper(value));
+}
+
+static void qtscript_QLocale_NumberOption_fromScriptValue(const QScriptValue &value, QLocale::NumberOption &out)
+{
+ out = qvariant_cast<QLocale::NumberOption>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QLocale_NumberOption(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QLocale::OmitGroupSeparator) && (arg <= QLocale::RejectGroupSeparator))
+ return qScriptValueFromValue(engine, static_cast<QLocale::NumberOption>(arg));
+ return context->throwError(QString::fromLatin1("NumberOption(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QLocale_NumberOption_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QLocale::NumberOption value = qscriptvalue_cast<QLocale::NumberOption>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QLocale_NumberOption_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QLocale::NumberOption value = qscriptvalue_cast<QLocale::NumberOption>(context->thisObject());
+ return QScriptValue(engine, qtscript_QLocale_NumberOption_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QLocale_NumberOption_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QLocale_NumberOption,
+ qtscript_QLocale_NumberOption_valueOf, qtscript_QLocale_NumberOption_toString);
+ qScriptRegisterMetaType<QLocale::NumberOption>(engine, qtscript_QLocale_NumberOption_toScriptValue,
+ qtscript_QLocale_NumberOption_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QLocale_NumberOption_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QLocale_NumberOption_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QLocale::NumberOptions
+//
+
+static QScriptValue qtscript_QLocale_NumberOptions_toScriptValue(QScriptEngine *engine, const QLocale::NumberOptions &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_QLocale_NumberOptions_fromScriptValue(const QScriptValue &value, QLocale::NumberOptions &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<QLocale::NumberOptions>())
+ out = qvariant_cast<QLocale::NumberOptions>(var);
+ else if (var.userType() == qMetaTypeId<QLocale::NumberOption>())
+ out = qvariant_cast<QLocale::NumberOption>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_QLocale_NumberOptions(QScriptContext *context, QScriptEngine *engine)
+{
+ QLocale::NumberOptions result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<QLocale::NumberOptions>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<QLocale::NumberOption>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("NumberOptions(): argument %0 is not of type NumberOption").arg(i));
+ }
+ result |= qvariant_cast<QLocale::NumberOption>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_QLocale_NumberOptions_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QLocale::NumberOptions value = qscriptvalue_cast<QLocale::NumberOptions>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QLocale_NumberOptions_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QLocale::NumberOptions value = qscriptvalue_cast<QLocale::NumberOptions>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 2; ++i) {
+ if ((value & qtscript_QLocale_NumberOption_values[i]) == qtscript_QLocale_NumberOption_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_QLocale_NumberOption_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_QLocale_NumberOptions_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<QLocale::NumberOptions>() == otherObj.value<QLocale::NumberOptions>())));
+}
+
+static QScriptValue qtscript_create_QLocale_NumberOptions_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_QLocale_NumberOptions, qtscript_QLocale_NumberOptions_valueOf,
+ qtscript_QLocale_NumberOptions_toString, qtscript_QLocale_NumberOptions_equals);
+ qScriptRegisterMetaType<QLocale::NumberOptions>(engine, qtscript_QLocale_NumberOptions_toScriptValue,
+ qtscript_QLocale_NumberOptions_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// QLocale::FormatType
+//
+
+static const QLocale::FormatType qtscript_QLocale_FormatType_values[] = {
+ QLocale::LongFormat
+ , QLocale::ShortFormat
+ , QLocale::NarrowFormat
+};
+
+static const char * const qtscript_QLocale_FormatType_keys[] = {
+ "LongFormat"
+ , "ShortFormat"
+ , "NarrowFormat"
+};
+
+static QString qtscript_QLocale_FormatType_toStringHelper(QLocale::FormatType value)
+{
+ if ((value >= QLocale::LongFormat) && (value <= QLocale::NarrowFormat))
+ return qtscript_QLocale_FormatType_keys[static_cast<int>(value)-static_cast<int>(QLocale::LongFormat)];
+ return QString();
+}
+
+static QScriptValue qtscript_QLocale_FormatType_toScriptValue(QScriptEngine *engine, const QLocale::FormatType &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QLocale"));
+ return clazz.property(qtscript_QLocale_FormatType_toStringHelper(value));
+}
+
+static void qtscript_QLocale_FormatType_fromScriptValue(const QScriptValue &value, QLocale::FormatType &out)
+{
+ out = qvariant_cast<QLocale::FormatType>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QLocale_FormatType(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QLocale::LongFormat) && (arg <= QLocale::NarrowFormat))
+ return qScriptValueFromValue(engine, static_cast<QLocale::FormatType>(arg));
+ return context->throwError(QString::fromLatin1("FormatType(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QLocale_FormatType_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QLocale::FormatType value = qscriptvalue_cast<QLocale::FormatType>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QLocale_FormatType_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QLocale::FormatType value = qscriptvalue_cast<QLocale::FormatType>(context->thisObject());
+ return QScriptValue(engine, qtscript_QLocale_FormatType_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QLocale_FormatType_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QLocale_FormatType,
+ qtscript_QLocale_FormatType_valueOf, qtscript_QLocale_FormatType_toString);
+ qScriptRegisterMetaType<QLocale::FormatType>(engine, qtscript_QLocale_FormatType_toScriptValue,
+ qtscript_QLocale_FormatType_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QLocale_FormatType_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QLocale_FormatType_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QLocale::Country
+//
+
+static const QLocale::Country qtscript_QLocale_Country_values[] = {
+ QLocale::AnyCountry
+ , QLocale::Afghanistan
+ , QLocale::Albania
+ , QLocale::Algeria
+ , QLocale::AmericanSamoa
+ , QLocale::Andorra
+ , QLocale::Angola
+ , QLocale::Anguilla
+ , QLocale::Antarctica
+ , QLocale::AntiguaAndBarbuda
+ , QLocale::Argentina
+ , QLocale::Armenia
+ , QLocale::Aruba
+ , QLocale::Australia
+ , QLocale::Austria
+ , QLocale::Azerbaijan
+ , QLocale::Bahamas
+ , QLocale::Bahrain
+ , QLocale::Bangladesh
+ , QLocale::Barbados
+ , QLocale::Belarus
+ , QLocale::Belgium
+ , QLocale::Belize
+ , QLocale::Benin
+ , QLocale::Bermuda
+ , QLocale::Bhutan
+ , QLocale::Bolivia
+ , QLocale::BosniaAndHerzegowina
+ , QLocale::Botswana
+ , QLocale::BouvetIsland
+ , QLocale::Brazil
+ , QLocale::BritishIndianOceanTerritory
+ , QLocale::BruneiDarussalam
+ , QLocale::Bulgaria
+ , QLocale::BurkinaFaso
+ , QLocale::Burundi
+ , QLocale::Cambodia
+ , QLocale::Cameroon
+ , QLocale::Canada
+ , QLocale::CapeVerde
+ , QLocale::CaymanIslands
+ , QLocale::CentralAfricanRepublic
+ , QLocale::Chad
+ , QLocale::Chile
+ , QLocale::China
+ , QLocale::ChristmasIsland
+ , QLocale::CocosIslands
+ , QLocale::Colombia
+ , QLocale::Comoros
+ , QLocale::DemocraticRepublicOfCongo
+ , QLocale::PeoplesRepublicOfCongo
+ , QLocale::CookIslands
+ , QLocale::CostaRica
+ , QLocale::IvoryCoast
+ , QLocale::Croatia
+ , QLocale::Cuba
+ , QLocale::Cyprus
+ , QLocale::CzechRepublic
+ , QLocale::Denmark
+ , QLocale::Djibouti
+ , QLocale::Dominica
+ , QLocale::DominicanRepublic
+ , QLocale::EastTimor
+ , QLocale::Ecuador
+ , QLocale::Egypt
+ , QLocale::ElSalvador
+ , QLocale::EquatorialGuinea
+ , QLocale::Eritrea
+ , QLocale::Estonia
+ , QLocale::Ethiopia
+ , QLocale::FalklandIslands
+ , QLocale::FaroeIslands
+ , QLocale::FijiCountry
+ , QLocale::Finland
+ , QLocale::France
+ , QLocale::MetropolitanFrance
+ , QLocale::FrenchGuiana
+ , QLocale::FrenchPolynesia
+ , QLocale::FrenchSouthernTerritories
+ , QLocale::Gabon
+ , QLocale::Gambia
+ , QLocale::Georgia
+ , QLocale::Germany
+ , QLocale::Ghana
+ , QLocale::Gibraltar
+ , QLocale::Greece
+ , QLocale::Greenland
+ , QLocale::Grenada
+ , QLocale::Guadeloupe
+ , QLocale::Guam
+ , QLocale::Guatemala
+ , QLocale::Guinea
+ , QLocale::GuineaBissau
+ , QLocale::Guyana
+ , QLocale::Haiti
+ , QLocale::HeardAndMcDonaldIslands
+ , QLocale::Honduras
+ , QLocale::HongKong
+ , QLocale::Hungary
+ , QLocale::Iceland
+ , QLocale::India
+ , QLocale::Indonesia
+ , QLocale::Iran
+ , QLocale::Iraq
+ , QLocale::Ireland
+ , QLocale::Israel
+ , QLocale::Italy
+ , QLocale::Jamaica
+ , QLocale::Japan
+ , QLocale::Jordan
+ , QLocale::Kazakhstan
+ , QLocale::Kenya
+ , QLocale::Kiribati
+ , QLocale::DemocraticRepublicOfKorea
+ , QLocale::RepublicOfKorea
+ , QLocale::Kuwait
+ , QLocale::Kyrgyzstan
+ , QLocale::Lao
+ , QLocale::Latvia
+ , QLocale::Lebanon
+ , QLocale::Lesotho
+ , QLocale::Liberia
+ , QLocale::LibyanArabJamahiriya
+ , QLocale::Liechtenstein
+ , QLocale::Lithuania
+ , QLocale::Luxembourg
+ , QLocale::Macau
+ , QLocale::Macedonia
+ , QLocale::Madagascar
+ , QLocale::Malawi
+ , QLocale::Malaysia
+ , QLocale::Maldives
+ , QLocale::Mali
+ , QLocale::Malta
+ , QLocale::MarshallIslands
+ , QLocale::Martinique
+ , QLocale::Mauritania
+ , QLocale::Mauritius
+ , QLocale::Mayotte
+ , QLocale::Mexico
+ , QLocale::Micronesia
+ , QLocale::Moldova
+ , QLocale::Monaco
+ , QLocale::Mongolia
+ , QLocale::Montserrat
+ , QLocale::Morocco
+ , QLocale::Mozambique
+ , QLocale::Myanmar
+ , QLocale::Namibia
+ , QLocale::NauruCountry
+ , QLocale::Nepal
+ , QLocale::Netherlands
+ , QLocale::NetherlandsAntilles
+ , QLocale::NewCaledonia
+ , QLocale::NewZealand
+ , QLocale::Nicaragua
+ , QLocale::Niger
+ , QLocale::Nigeria
+ , QLocale::Niue
+ , QLocale::NorfolkIsland
+ , QLocale::NorthernMarianaIslands
+ , QLocale::Norway
+ , QLocale::Oman
+ , QLocale::Pakistan
+ , QLocale::Palau
+ , QLocale::PalestinianTerritory
+ , QLocale::Panama
+ , QLocale::PapuaNewGuinea
+ , QLocale::Paraguay
+ , QLocale::Peru
+ , QLocale::Philippines
+ , QLocale::Pitcairn
+ , QLocale::Poland
+ , QLocale::Portugal
+ , QLocale::PuertoRico
+ , QLocale::Qatar
+ , QLocale::Reunion
+ , QLocale::Romania
+ , QLocale::RussianFederation
+ , QLocale::Rwanda
+ , QLocale::SaintKittsAndNevis
+ , QLocale::StLucia
+ , QLocale::StVincentAndTheGrenadines
+ , QLocale::Samoa
+ , QLocale::SanMarino
+ , QLocale::SaoTomeAndPrincipe
+ , QLocale::SaudiArabia
+ , QLocale::Senegal
+ , QLocale::Seychelles
+ , QLocale::SierraLeone
+ , QLocale::Singapore
+ , QLocale::Slovakia
+ , QLocale::Slovenia
+ , QLocale::SolomonIslands
+ , QLocale::Somalia
+ , QLocale::SouthAfrica
+ , QLocale::SouthGeorgiaAndTheSouthSandwichIslands
+ , QLocale::Spain
+ , QLocale::SriLanka
+ , QLocale::StHelena
+ , QLocale::StPierreAndMiquelon
+ , QLocale::Sudan
+ , QLocale::Suriname
+ , QLocale::SvalbardAndJanMayenIslands
+ , QLocale::Swaziland
+ , QLocale::Sweden
+ , QLocale::Switzerland
+ , QLocale::SyrianArabRepublic
+ , QLocale::Taiwan
+ , QLocale::Tajikistan
+ , QLocale::Tanzania
+ , QLocale::Thailand
+ , QLocale::Togo
+ , QLocale::Tokelau
+ , QLocale::TongaCountry
+ , QLocale::TrinidadAndTobago
+ , QLocale::Tunisia
+ , QLocale::Turkey
+ , QLocale::Turkmenistan
+ , QLocale::TurksAndCaicosIslands
+ , QLocale::Tuvalu
+ , QLocale::Uganda
+ , QLocale::Ukraine
+ , QLocale::UnitedArabEmirates
+ , QLocale::UnitedKingdom
+ , QLocale::UnitedStates
+ , QLocale::UnitedStatesMinorOutlyingIslands
+ , QLocale::Uruguay
+ , QLocale::Uzbekistan
+ , QLocale::Vanuatu
+ , QLocale::VaticanCityState
+ , QLocale::Venezuela
+ , QLocale::VietNam
+ , QLocale::BritishVirginIslands
+ , QLocale::USVirginIslands
+ , QLocale::WallisAndFutunaIslands
+ , QLocale::WesternSahara
+ , QLocale::Yemen
+ , QLocale::Yugoslavia
+ , QLocale::Zambia
+ , QLocale::Zimbabwe
+ , QLocale::SerbiaAndMontenegro
+};
+
+static const char * const qtscript_QLocale_Country_keys[] = {
+ "AnyCountry"
+ , "Afghanistan"
+ , "Albania"
+ , "Algeria"
+ , "AmericanSamoa"
+ , "Andorra"
+ , "Angola"
+ , "Anguilla"
+ , "Antarctica"
+ , "AntiguaAndBarbuda"
+ , "Argentina"
+ , "Armenia"
+ , "Aruba"
+ , "Australia"
+ , "Austria"
+ , "Azerbaijan"
+ , "Bahamas"
+ , "Bahrain"
+ , "Bangladesh"
+ , "Barbados"
+ , "Belarus"
+ , "Belgium"
+ , "Belize"
+ , "Benin"
+ , "Bermuda"
+ , "Bhutan"
+ , "Bolivia"
+ , "BosniaAndHerzegowina"
+ , "Botswana"
+ , "BouvetIsland"
+ , "Brazil"
+ , "BritishIndianOceanTerritory"
+ , "BruneiDarussalam"
+ , "Bulgaria"
+ , "BurkinaFaso"
+ , "Burundi"
+ , "Cambodia"
+ , "Cameroon"
+ , "Canada"
+ , "CapeVerde"
+ , "CaymanIslands"
+ , "CentralAfricanRepublic"
+ , "Chad"
+ , "Chile"
+ , "China"
+ , "ChristmasIsland"
+ , "CocosIslands"
+ , "Colombia"
+ , "Comoros"
+ , "DemocraticRepublicOfCongo"
+ , "PeoplesRepublicOfCongo"
+ , "CookIslands"
+ , "CostaRica"
+ , "IvoryCoast"
+ , "Croatia"
+ , "Cuba"
+ , "Cyprus"
+ , "CzechRepublic"
+ , "Denmark"
+ , "Djibouti"
+ , "Dominica"
+ , "DominicanRepublic"
+ , "EastTimor"
+ , "Ecuador"
+ , "Egypt"
+ , "ElSalvador"
+ , "EquatorialGuinea"
+ , "Eritrea"
+ , "Estonia"
+ , "Ethiopia"
+ , "FalklandIslands"
+ , "FaroeIslands"
+ , "FijiCountry"
+ , "Finland"
+ , "France"
+ , "MetropolitanFrance"
+ , "FrenchGuiana"
+ , "FrenchPolynesia"
+ , "FrenchSouthernTerritories"
+ , "Gabon"
+ , "Gambia"
+ , "Georgia"
+ , "Germany"
+ , "Ghana"
+ , "Gibraltar"
+ , "Greece"
+ , "Greenland"
+ , "Grenada"
+ , "Guadeloupe"
+ , "Guam"
+ , "Guatemala"
+ , "Guinea"
+ , "GuineaBissau"
+ , "Guyana"
+ , "Haiti"
+ , "HeardAndMcDonaldIslands"
+ , "Honduras"
+ , "HongKong"
+ , "Hungary"
+ , "Iceland"
+ , "India"
+ , "Indonesia"
+ , "Iran"
+ , "Iraq"
+ , "Ireland"
+ , "Israel"
+ , "Italy"
+ , "Jamaica"
+ , "Japan"
+ , "Jordan"
+ , "Kazakhstan"
+ , "Kenya"
+ , "Kiribati"
+ , "DemocraticRepublicOfKorea"
+ , "RepublicOfKorea"
+ , "Kuwait"
+ , "Kyrgyzstan"
+ , "Lao"
+ , "Latvia"
+ , "Lebanon"
+ , "Lesotho"
+ , "Liberia"
+ , "LibyanArabJamahiriya"
+ , "Liechtenstein"
+ , "Lithuania"
+ , "Luxembourg"
+ , "Macau"
+ , "Macedonia"
+ , "Madagascar"
+ , "Malawi"
+ , "Malaysia"
+ , "Maldives"
+ , "Mali"
+ , "Malta"
+ , "MarshallIslands"
+ , "Martinique"
+ , "Mauritania"
+ , "Mauritius"
+ , "Mayotte"
+ , "Mexico"
+ , "Micronesia"
+ , "Moldova"
+ , "Monaco"
+ , "Mongolia"
+ , "Montserrat"
+ , "Morocco"
+ , "Mozambique"
+ , "Myanmar"
+ , "Namibia"
+ , "NauruCountry"
+ , "Nepal"
+ , "Netherlands"
+ , "NetherlandsAntilles"
+ , "NewCaledonia"
+ , "NewZealand"
+ , "Nicaragua"
+ , "Niger"
+ , "Nigeria"
+ , "Niue"
+ , "NorfolkIsland"
+ , "NorthernMarianaIslands"
+ , "Norway"
+ , "Oman"
+ , "Pakistan"
+ , "Palau"
+ , "PalestinianTerritory"
+ , "Panama"
+ , "PapuaNewGuinea"
+ , "Paraguay"
+ , "Peru"
+ , "Philippines"
+ , "Pitcairn"
+ , "Poland"
+ , "Portugal"
+ , "PuertoRico"
+ , "Qatar"
+ , "Reunion"
+ , "Romania"
+ , "RussianFederation"
+ , "Rwanda"
+ , "SaintKittsAndNevis"
+ , "StLucia"
+ , "StVincentAndTheGrenadines"
+ , "Samoa"
+ , "SanMarino"
+ , "SaoTomeAndPrincipe"
+ , "SaudiArabia"
+ , "Senegal"
+ , "Seychelles"
+ , "SierraLeone"
+ , "Singapore"
+ , "Slovakia"
+ , "Slovenia"
+ , "SolomonIslands"
+ , "Somalia"
+ , "SouthAfrica"
+ , "SouthGeorgiaAndTheSouthSandwichIslands"
+ , "Spain"
+ , "SriLanka"
+ , "StHelena"
+ , "StPierreAndMiquelon"
+ , "Sudan"
+ , "Suriname"
+ , "SvalbardAndJanMayenIslands"
+ , "Swaziland"
+ , "Sweden"
+ , "Switzerland"
+ , "SyrianArabRepublic"
+ , "Taiwan"
+ , "Tajikistan"
+ , "Tanzania"
+ , "Thailand"
+ , "Togo"
+ , "Tokelau"
+ , "TongaCountry"
+ , "TrinidadAndTobago"
+ , "Tunisia"
+ , "Turkey"
+ , "Turkmenistan"
+ , "TurksAndCaicosIslands"
+ , "Tuvalu"
+ , "Uganda"
+ , "Ukraine"
+ , "UnitedArabEmirates"
+ , "UnitedKingdom"
+ , "UnitedStates"
+ , "UnitedStatesMinorOutlyingIslands"
+ , "Uruguay"
+ , "Uzbekistan"
+ , "Vanuatu"
+ , "VaticanCityState"
+ , "Venezuela"
+ , "VietNam"
+ , "BritishVirginIslands"
+ , "USVirginIslands"
+ , "WallisAndFutunaIslands"
+ , "WesternSahara"
+ , "Yemen"
+ , "Yugoslavia"
+ , "Zambia"
+ , "Zimbabwe"
+ , "SerbiaAndMontenegro"
+};
+
+static QString qtscript_QLocale_Country_toStringHelper(QLocale::Country value)
+{
+ const QMetaObject *meta = qtscript_QLocale_metaObject();
+ int idx = meta->indexOfEnumerator("Country");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_QLocale_Country_toScriptValue(QScriptEngine *engine, const QLocale::Country &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QLocale"));
+ return clazz.property(qtscript_QLocale_Country_toStringHelper(value));
+}
+
+static void qtscript_QLocale_Country_fromScriptValue(const QScriptValue &value, QLocale::Country &out)
+{
+ out = qvariant_cast<QLocale::Country>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QLocale_Country(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_QLocale_metaObject();
+ int idx = meta->indexOfEnumerator("Country");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<QLocale::Country>(arg));
+ return context->throwError(QString::fromLatin1("Country(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QLocale_Country_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QLocale::Country value = qscriptvalue_cast<QLocale::Country>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QLocale_Country_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QLocale::Country value = qscriptvalue_cast<QLocale::Country>(context->thisObject());
+ return QScriptValue(engine, qtscript_QLocale_Country_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QLocale_Country_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QLocale_Country,
+ qtscript_QLocale_Country_valueOf, qtscript_QLocale_Country_toString);
+ qScriptRegisterMetaType<QLocale::Country>(engine, qtscript_QLocale_Country_toScriptValue,
+ qtscript_QLocale_Country_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 242; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QLocale_Country_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QLocale_Country_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QLocale::Language
+//
+
+static const QLocale::Language qtscript_QLocale_Language_values[] = {
+ QLocale::C
+ , QLocale::Abkhazian
+ , QLocale::Afan
+ , QLocale::Afar
+ , QLocale::Afrikaans
+ , QLocale::Albanian
+ , QLocale::Amharic
+ , QLocale::Arabic
+ , QLocale::Armenian
+ , QLocale::Assamese
+ , QLocale::Aymara
+ , QLocale::Azerbaijani
+ , QLocale::Bashkir
+ , QLocale::Basque
+ , QLocale::Bengali
+ , QLocale::Bhutani
+ , QLocale::Bihari
+ , QLocale::Bislama
+ , QLocale::Breton
+ , QLocale::Bulgarian
+ , QLocale::Burmese
+ , QLocale::Byelorussian
+ , QLocale::Cambodian
+ , QLocale::Catalan
+ , QLocale::Chinese
+ , QLocale::Corsican
+ , QLocale::Croatian
+ , QLocale::Czech
+ , QLocale::Danish
+ , QLocale::Dutch
+ , QLocale::English
+ , QLocale::Esperanto
+ , QLocale::Estonian
+ , QLocale::Faroese
+ , QLocale::FijiLanguage
+ , QLocale::Finnish
+ , QLocale::French
+ , QLocale::Frisian
+ , QLocale::Gaelic
+ , QLocale::Galician
+ , QLocale::Georgian
+ , QLocale::German
+ , QLocale::Greek
+ , QLocale::Greenlandic
+ , QLocale::Guarani
+ , QLocale::Gujarati
+ , QLocale::Hausa
+ , QLocale::Hebrew
+ , QLocale::Hindi
+ , QLocale::Hungarian
+ , QLocale::Icelandic
+ , QLocale::Indonesian
+ , QLocale::Interlingua
+ , QLocale::Interlingue
+ , QLocale::Inuktitut
+ , QLocale::Inupiak
+ , QLocale::Irish
+ , QLocale::Italian
+ , QLocale::Japanese
+ , QLocale::Javanese
+ , QLocale::Kannada
+ , QLocale::Kashmiri
+ , QLocale::Kazakh
+ , QLocale::Kinyarwanda
+ , QLocale::Kirghiz
+ , QLocale::Korean
+ , QLocale::Kurdish
+ , QLocale::Kurundi
+ , QLocale::Laothian
+ , QLocale::Latin
+ , QLocale::Latvian
+ , QLocale::Lingala
+ , QLocale::Lithuanian
+ , QLocale::Macedonian
+ , QLocale::Malagasy
+ , QLocale::Malay
+ , QLocale::Malayalam
+ , QLocale::Maltese
+ , QLocale::Maori
+ , QLocale::Marathi
+ , QLocale::Moldavian
+ , QLocale::Mongolian
+ , QLocale::NauruLanguage
+ , QLocale::Nepali
+ , QLocale::Norwegian
+ , QLocale::Occitan
+ , QLocale::Oriya
+ , QLocale::Pashto
+ , QLocale::Persian
+ , QLocale::Polish
+ , QLocale::Portuguese
+ , QLocale::Punjabi
+ , QLocale::Quechua
+ , QLocale::RhaetoRomance
+ , QLocale::Romanian
+ , QLocale::Russian
+ , QLocale::Samoan
+ , QLocale::Sangho
+ , QLocale::Sanskrit
+ , QLocale::Serbian
+ , QLocale::SerboCroatian
+ , QLocale::Sesotho
+ , QLocale::Setswana
+ , QLocale::Shona
+ , QLocale::Sindhi
+ , QLocale::Singhalese
+ , QLocale::Siswati
+ , QLocale::Slovak
+ , QLocale::Slovenian
+ , QLocale::Somali
+ , QLocale::Spanish
+ , QLocale::Sundanese
+ , QLocale::Swahili
+ , QLocale::Swedish
+ , QLocale::Tagalog
+ , QLocale::Tajik
+ , QLocale::Tamil
+ , QLocale::Tatar
+ , QLocale::Telugu
+ , QLocale::Thai
+ , QLocale::Tibetan
+ , QLocale::Tigrinya
+ , QLocale::TongaLanguage
+ , QLocale::Tsonga
+ , QLocale::Turkish
+ , QLocale::Turkmen
+ , QLocale::Twi
+ , QLocale::Uigur
+ , QLocale::Ukrainian
+ , QLocale::Urdu
+ , QLocale::Uzbek
+ , QLocale::Vietnamese
+ , QLocale::Volapuk
+ , QLocale::Welsh
+ , QLocale::Wolof
+ , QLocale::Xhosa
+ , QLocale::Yiddish
+ , QLocale::Yoruba
+ , QLocale::Zhuang
+ , QLocale::Zulu
+ , QLocale::NorwegianNynorsk
+ , QLocale::Bosnian
+ , QLocale::Divehi
+ , QLocale::Manx
+ , QLocale::Cornish
+ , QLocale::Akan
+ , QLocale::Konkani
+ , QLocale::Ga
+ , QLocale::Igbo
+ , QLocale::Kamba
+ , QLocale::Syriac
+ , QLocale::Blin
+ , QLocale::Geez
+ , QLocale::Koro
+ , QLocale::Sidamo
+ , QLocale::Atsam
+ , QLocale::Tigre
+ , QLocale::Jju
+ , QLocale::Friulian
+ , QLocale::Venda
+ , QLocale::Ewe
+ , QLocale::Walamo
+ , QLocale::Hawaiian
+ , QLocale::Tyap
+ , QLocale::Chewa
+};
+
+static const char * const qtscript_QLocale_Language_keys[] = {
+ "C"
+ , "Abkhazian"
+ , "Afan"
+ , "Afar"
+ , "Afrikaans"
+ , "Albanian"
+ , "Amharic"
+ , "Arabic"
+ , "Armenian"
+ , "Assamese"
+ , "Aymara"
+ , "Azerbaijani"
+ , "Bashkir"
+ , "Basque"
+ , "Bengali"
+ , "Bhutani"
+ , "Bihari"
+ , "Bislama"
+ , "Breton"
+ , "Bulgarian"
+ , "Burmese"
+ , "Byelorussian"
+ , "Cambodian"
+ , "Catalan"
+ , "Chinese"
+ , "Corsican"
+ , "Croatian"
+ , "Czech"
+ , "Danish"
+ , "Dutch"
+ , "English"
+ , "Esperanto"
+ , "Estonian"
+ , "Faroese"
+ , "FijiLanguage"
+ , "Finnish"
+ , "French"
+ , "Frisian"
+ , "Gaelic"
+ , "Galician"
+ , "Georgian"
+ , "German"
+ , "Greek"
+ , "Greenlandic"
+ , "Guarani"
+ , "Gujarati"
+ , "Hausa"
+ , "Hebrew"
+ , "Hindi"
+ , "Hungarian"
+ , "Icelandic"
+ , "Indonesian"
+ , "Interlingua"
+ , "Interlingue"
+ , "Inuktitut"
+ , "Inupiak"
+ , "Irish"
+ , "Italian"
+ , "Japanese"
+ , "Javanese"
+ , "Kannada"
+ , "Kashmiri"
+ , "Kazakh"
+ , "Kinyarwanda"
+ , "Kirghiz"
+ , "Korean"
+ , "Kurdish"
+ , "Kurundi"
+ , "Laothian"
+ , "Latin"
+ , "Latvian"
+ , "Lingala"
+ , "Lithuanian"
+ , "Macedonian"
+ , "Malagasy"
+ , "Malay"
+ , "Malayalam"
+ , "Maltese"
+ , "Maori"
+ , "Marathi"
+ , "Moldavian"
+ , "Mongolian"
+ , "NauruLanguage"
+ , "Nepali"
+ , "Norwegian"
+ , "Occitan"
+ , "Oriya"
+ , "Pashto"
+ , "Persian"
+ , "Polish"
+ , "Portuguese"
+ , "Punjabi"
+ , "Quechua"
+ , "RhaetoRomance"
+ , "Romanian"
+ , "Russian"
+ , "Samoan"
+ , "Sangho"
+ , "Sanskrit"
+ , "Serbian"
+ , "SerboCroatian"
+ , "Sesotho"
+ , "Setswana"
+ , "Shona"
+ , "Sindhi"
+ , "Singhalese"
+ , "Siswati"
+ , "Slovak"
+ , "Slovenian"
+ , "Somali"
+ , "Spanish"
+ , "Sundanese"
+ , "Swahili"
+ , "Swedish"
+ , "Tagalog"
+ , "Tajik"
+ , "Tamil"
+ , "Tatar"
+ , "Telugu"
+ , "Thai"
+ , "Tibetan"
+ , "Tigrinya"
+ , "TongaLanguage"
+ , "Tsonga"
+ , "Turkish"
+ , "Turkmen"
+ , "Twi"
+ , "Uigur"
+ , "Ukrainian"
+ , "Urdu"
+ , "Uzbek"
+ , "Vietnamese"
+ , "Volapuk"
+ , "Welsh"
+ , "Wolof"
+ , "Xhosa"
+ , "Yiddish"
+ , "Yoruba"
+ , "Zhuang"
+ , "Zulu"
+ , "NorwegianNynorsk"
+ , "Bosnian"
+ , "Divehi"
+ , "Manx"
+ , "Cornish"
+ , "Akan"
+ , "Konkani"
+ , "Ga"
+ , "Igbo"
+ , "Kamba"
+ , "Syriac"
+ , "Blin"
+ , "Geez"
+ , "Koro"
+ , "Sidamo"
+ , "Atsam"
+ , "Tigre"
+ , "Jju"
+ , "Friulian"
+ , "Venda"
+ , "Ewe"
+ , "Walamo"
+ , "Hawaiian"
+ , "Tyap"
+ , "Chewa"
+};
+
+static QString qtscript_QLocale_Language_toStringHelper(QLocale::Language value)
+{
+ const QMetaObject *meta = qtscript_QLocale_metaObject();
+ int idx = meta->indexOfEnumerator("Language");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_QLocale_Language_toScriptValue(QScriptEngine *engine, const QLocale::Language &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QLocale"));
+ return clazz.property(qtscript_QLocale_Language_toStringHelper(value));
+}
+
+static void qtscript_QLocale_Language_fromScriptValue(const QScriptValue &value, QLocale::Language &out)
+{
+ out = qvariant_cast<QLocale::Language>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QLocale_Language(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_QLocale_metaObject();
+ int idx = meta->indexOfEnumerator("Language");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<QLocale::Language>(arg));
+ return context->throwError(QString::fromLatin1("Language(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QLocale_Language_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QLocale::Language value = qscriptvalue_cast<QLocale::Language>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QLocale_Language_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QLocale::Language value = qscriptvalue_cast<QLocale::Language>(context->thisObject());
+ return QScriptValue(engine, qtscript_QLocale_Language_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QLocale_Language_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QLocale_Language,
+ qtscript_QLocale_Language_valueOf, qtscript_QLocale_Language_toString);
+ qScriptRegisterMetaType<QLocale::Language>(engine, qtscript_QLocale_Language_toScriptValue,
+ qtscript_QLocale_Language_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 165; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QLocale_Language_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QLocale_Language_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QLocale
+//
+
+static QScriptValue qtscript_QLocale_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 35;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QLocale* _q_self = qscriptvalue_cast<QLocale*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QLocale.%0(): this object is not a QLocale")
+ .arg(qtscript_QLocale_function_names[_id+7]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->amText();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QLocale::Country _q_result = _q_self->country();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->dateFormat();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QLocale::FormatType _q_arg0 = qscriptvalue_cast<QLocale::FormatType>(context->argument(0));
+ QString _q_result = _q_self->dateFormat(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->dateTimeFormat();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QLocale::FormatType _q_arg0 = qscriptvalue_cast<QLocale::FormatType>(context->argument(0));
+ QString _q_result = _q_self->dateTimeFormat(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QString _q_result = _q_self->dayName(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QLocale::FormatType _q_arg1 = qscriptvalue_cast<QLocale::FormatType>(context->argument(1));
+ QString _q_result = _q_self->dayName(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QChar _q_result = _q_self->decimalPoint();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ QChar _q_result = _q_self->exponential();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ QChar _q_result = _q_self->groupSeparator();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 0) {
+ QLocale::Language _q_result = _q_self->language();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 0) {
+ QLocale::MeasurementSystem _q_result = _q_self->measurementSystem();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QString _q_result = _q_self->monthName(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QLocale::FormatType _q_arg1 = qscriptvalue_cast<QLocale::FormatType>(context->argument(1));
+ QString _q_result = _q_self->monthName(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->name();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 0) {
+ QChar _q_result = _q_self->negativeSign();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 0) {
+ QFlags<QLocale::NumberOption> _q_result = _q_self->numberOptions();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 1) {
+ QLocale _q_arg0 = qscriptvalue_cast<QLocale>(context->argument(0));
+ bool _q_result = _q_self->operator==(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 0) {
+ QChar _q_result = _q_self->percent();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->pmText();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 0) {
+ QChar _q_result = _q_self->positiveSign();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator>>(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 1) {
+ QFlags<QLocale::NumberOption> _q_arg0 = qscriptvalue_cast<QFlags<QLocale::NumberOption> >(context->argument(0));
+ _q_self->setNumberOptions(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QString _q_result = _q_self->standaloneDayName(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QLocale::FormatType _q_arg1 = qscriptvalue_cast<QLocale::FormatType>(context->argument(1));
+ QString _q_result = _q_self->standaloneDayName(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 21:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QString _q_result = _q_self->standaloneMonthName(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QLocale::FormatType _q_arg1 = qscriptvalue_cast<QLocale::FormatType>(context->argument(1));
+ QString _q_result = _q_self->standaloneMonthName(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 22:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->timeFormat();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QLocale::FormatType _q_arg0 = qscriptvalue_cast<QLocale::FormatType>(context->argument(0));
+ QString _q_result = _q_self->timeFormat(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 23:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QDate _q_result = _q_self->toDate(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ if (context->argument(0).isString()
+ && (qMetaTypeId<QLocale::FormatType>() == context->argument(1).toVariant().userType())) {
+ QString _q_arg0 = context->argument(0).toString();
+ QLocale::FormatType _q_arg1 = qscriptvalue_cast<QLocale::FormatType>(context->argument(1));
+ QDate _q_result = _q_self->toDate(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ } else if (context->argument(0).isString()
+ && context->argument(1).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QDate _q_result = _q_self->toDate(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 24:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QDateTime _q_result = _q_self->toDateTime(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ if (context->argument(0).isString()
+ && (qMetaTypeId<QLocale::FormatType>() == context->argument(1).toVariant().userType())) {
+ QString _q_arg0 = context->argument(0).toString();
+ QLocale::FormatType _q_arg1 = qscriptvalue_cast<QLocale::FormatType>(context->argument(1));
+ QDateTime _q_result = _q_self->toDateTime(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ } else if (context->argument(0).isString()
+ && context->argument(1).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QDateTime _q_result = _q_self->toDateTime(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 25:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+
+ // TEMPLATE - core.prepare_removed_bool*_argument - START
+ bool __ok;
+ bool *_q_arg1 = &__ok;
+ // TEMPLATE - core.prepare_removed_bool*_argument - END
+ double _q_result = _q_self->toDouble(_q_arg0, _q_arg1);
+
+ // TEMPLATE - core.convert_to_null_or_primitive - START
+ QScriptValue _q_convertedResult;
+ if (!__ok)
+ _q_convertedResult = context->engine()->nullValue();
+ else
+ _q_convertedResult = QScriptValue(context->engine(), _q_result);
+ // TEMPLATE - core.convert_to_null_or_primitive - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 26:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+
+ // TEMPLATE - core.prepare_removed_bool*_argument - START
+ bool __ok;
+ bool *_q_arg1 = &__ok;
+ // TEMPLATE - core.prepare_removed_bool*_argument - END
+ float _q_result = _q_self->toFloat(_q_arg0, _q_arg1);
+
+ // TEMPLATE - core.convert_to_null_or_primitive - START
+ QScriptValue _q_convertedResult;
+ if (!__ok)
+ _q_convertedResult = context->engine()->nullValue();
+ else
+ _q_convertedResult = QScriptValue(context->engine(), _q_result);
+ // TEMPLATE - core.convert_to_null_or_primitive - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 27:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+
+ // TEMPLATE - core.prepare_removed_bool*_argument - START
+ bool __ok;
+ bool *_q_arg1 = &__ok;
+ // TEMPLATE - core.prepare_removed_bool*_argument - END
+ int _q_result = _q_self->toInt(_q_arg0, _q_arg1);
+
+ // TEMPLATE - core.convert_to_null_or_primitive - START
+ QScriptValue _q_convertedResult;
+ if (!__ok)
+ _q_convertedResult = context->engine()->nullValue();
+ else
+ _q_convertedResult = QScriptValue(context->engine(), _q_result);
+ // TEMPLATE - core.convert_to_null_or_primitive - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+
+ // TEMPLATE - core.prepare_removed_bool*_argument - START
+ bool __ok;
+ bool *_q_arg1 = &__ok;
+ // TEMPLATE - core.prepare_removed_bool*_argument - END
+ int _q_arg2 = context->argument(1).toInt32();
+ int _q_result = _q_self->toInt(_q_arg0, _q_arg1, _q_arg2);
+
+ // TEMPLATE - core.convert_to_null_or_primitive - START
+ QScriptValue _q_convertedResult;
+ if (!__ok)
+ _q_convertedResult = context->engine()->nullValue();
+ else
+ _q_convertedResult = QScriptValue(context->engine(), _q_result);
+ // TEMPLATE - core.convert_to_null_or_primitive - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 28:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+
+ // TEMPLATE - core.prepare_removed_bool*_argument - START
+ bool __ok;
+ bool *_q_arg1 = &__ok;
+ // TEMPLATE - core.prepare_removed_bool*_argument - END
+ qlonglong _q_result = _q_self->toLongLong(_q_arg0, _q_arg1);
+
+ QScriptValue _q_convertedResult;
+ if (!__ok)
+ _q_convertedResult = context->engine()->nullValue();
+ else
+ _q_convertedResult = QScriptValue(context->engine(), double(_q_result)).toObject();
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+
+ // TEMPLATE - core.prepare_removed_bool*_argument - START
+ bool __ok;
+ bool *_q_arg1 = &__ok;
+ // TEMPLATE - core.prepare_removed_bool*_argument - END
+ int _q_arg2 = context->argument(1).toInt32();
+ qlonglong _q_result = _q_self->toLongLong(_q_arg0, _q_arg1, _q_arg2);
+
+ QScriptValue _q_convertedResult;
+ if (!__ok)
+ _q_convertedResult = context->engine()->nullValue();
+ else
+ _q_convertedResult = QScriptValue(context->engine(), double(_q_result)).toObject();
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 29:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+
+ // TEMPLATE - core.prepare_removed_bool*_argument - START
+ bool __ok;
+ bool *_q_arg1 = &__ok;
+ // TEMPLATE - core.prepare_removed_bool*_argument - END
+ short _q_result = _q_self->toShort(_q_arg0, _q_arg1);
+
+ // TEMPLATE - core.convert_to_null_or_primitive - START
+ QScriptValue _q_convertedResult;
+ if (!__ok)
+ _q_convertedResult = context->engine()->nullValue();
+ else
+ _q_convertedResult = QScriptValue(context->engine(), _q_result);
+ // TEMPLATE - core.convert_to_null_or_primitive - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+
+ // TEMPLATE - core.prepare_removed_bool*_argument - START
+ bool __ok;
+ bool *_q_arg1 = &__ok;
+ // TEMPLATE - core.prepare_removed_bool*_argument - END
+ int _q_arg2 = context->argument(1).toInt32();
+ short _q_result = _q_self->toShort(_q_arg0, _q_arg1, _q_arg2);
+
+ // TEMPLATE - core.convert_to_null_or_primitive - START
+ QScriptValue _q_convertedResult;
+ if (!__ok)
+ _q_convertedResult = context->engine()->nullValue();
+ else
+ _q_convertedResult = QScriptValue(context->engine(), _q_result);
+ // TEMPLATE - core.convert_to_null_or_primitive - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 30:
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QDate>() == context->argument(0).toVariant().userType())) {
+ QDate _q_arg0 = qscriptvalue_cast<QDate>(context->argument(0));
+ QString _q_result = _q_self->toString(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if ((qMetaTypeId<QDateTime>() == context->argument(0).toVariant().userType())) {
+ QDateTime _q_arg0 = context->argument(0).toDateTime();
+ QString _q_result = _q_self->toString(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if ((qMetaTypeId<QTime>() == context->argument(0).toVariant().userType())) {
+ QTime _q_arg0 = qscriptvalue_cast<QTime>(context->argument(0));
+ QString _q_result = _q_self->toString(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isNumber()) {
+ double _q_arg0 = context->argument(0).toNumber();
+ QString _q_result = _q_self->toString(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isNumber()) {
+ float _q_arg0 = qscriptvalue_cast<float>(context->argument(0));
+ QString _q_result = _q_self->toString(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isNumber()) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QString _q_result = _q_self->toString(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if ((qMetaTypeId<qulonglong>() == context->argument(0).toVariant().userType())) {
+ qulonglong _q_arg0 = qscriptvalue_cast<qulonglong>(context->argument(0));
+ QString _q_result = _q_self->toString(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isNumber()) {
+ short _q_arg0 = qscriptvalue_cast<short>(context->argument(0));
+ QString _q_result = _q_self->toString(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 2) {
+ if ((qMetaTypeId<QDate>() == context->argument(0).toVariant().userType())
+ && (qMetaTypeId<QLocale::FormatType>() == context->argument(1).toVariant().userType())) {
+ QDate _q_arg0 = qscriptvalue_cast<QDate>(context->argument(0));
+ QLocale::FormatType _q_arg1 = qscriptvalue_cast<QLocale::FormatType>(context->argument(1));
+ QString _q_result = _q_self->toString(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if ((qMetaTypeId<QDate>() == context->argument(0).toVariant().userType())
+ && context->argument(1).isString()) {
+ QDate _q_arg0 = qscriptvalue_cast<QDate>(context->argument(0));
+ QString _q_arg1 = context->argument(1).toString();
+ QString _q_result = _q_self->toString(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if ((qMetaTypeId<QDateTime>() == context->argument(0).toVariant().userType())
+ && (qMetaTypeId<QLocale::FormatType>() == context->argument(1).toVariant().userType())) {
+ QDateTime _q_arg0 = context->argument(0).toDateTime();
+ QLocale::FormatType _q_arg1 = qscriptvalue_cast<QLocale::FormatType>(context->argument(1));
+ QString _q_result = _q_self->toString(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if ((qMetaTypeId<QDateTime>() == context->argument(0).toVariant().userType())
+ && context->argument(1).isString()) {
+ QDateTime _q_arg0 = context->argument(0).toDateTime();
+ QString _q_arg1 = context->argument(1).toString();
+ QString _q_result = _q_self->toString(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if ((qMetaTypeId<QTime>() == context->argument(0).toVariant().userType())
+ && (qMetaTypeId<QLocale::FormatType>() == context->argument(1).toVariant().userType())) {
+ QTime _q_arg0 = qscriptvalue_cast<QTime>(context->argument(0));
+ QLocale::FormatType _q_arg1 = qscriptvalue_cast<QLocale::FormatType>(context->argument(1));
+ QString _q_result = _q_self->toString(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if ((qMetaTypeId<QTime>() == context->argument(0).toVariant().userType())
+ && context->argument(1).isString()) {
+ QTime _q_arg0 = qscriptvalue_cast<QTime>(context->argument(0));
+ QString _q_arg1 = context->argument(1).toString();
+ QString _q_result = _q_self->toString(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isNumber()
+ && (qMetaTypeId<char>() == context->argument(1).toVariant().userType())) {
+ double _q_arg0 = context->argument(0).toNumber();
+ char _q_arg1 = qscriptvalue_cast<char>(context->argument(1));
+ QString _q_result = _q_self->toString(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isNumber()
+ && (qMetaTypeId<char>() == context->argument(1).toVariant().userType())) {
+ float _q_arg0 = qscriptvalue_cast<float>(context->argument(0));
+ char _q_arg1 = qscriptvalue_cast<char>(context->argument(1));
+ QString _q_result = _q_self->toString(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 3) {
+ if (context->argument(0).isNumber()
+ && (qMetaTypeId<char>() == context->argument(1).toVariant().userType())
+ && context->argument(2).isNumber()) {
+ double _q_arg0 = context->argument(0).toNumber();
+ char _q_arg1 = qscriptvalue_cast<char>(context->argument(1));
+ int _q_arg2 = context->argument(2).toInt32();
+ QString _q_result = _q_self->toString(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isNumber()
+ && (qMetaTypeId<char>() == context->argument(1).toVariant().userType())
+ && context->argument(2).isNumber()) {
+ float _q_arg0 = qscriptvalue_cast<float>(context->argument(0));
+ char _q_arg1 = qscriptvalue_cast<char>(context->argument(1));
+ int _q_arg2 = context->argument(2).toInt32();
+ QString _q_result = _q_self->toString(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 31:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QTime _q_result = _q_self->toTime(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ if (context->argument(0).isString()
+ && (qMetaTypeId<QLocale::FormatType>() == context->argument(1).toVariant().userType())) {
+ QString _q_arg0 = context->argument(0).toString();
+ QLocale::FormatType _q_arg1 = qscriptvalue_cast<QLocale::FormatType>(context->argument(1));
+ QTime _q_result = _q_self->toTime(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ } else if (context->argument(0).isString()
+ && context->argument(1).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QTime _q_result = _q_self->toTime(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 32:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+
+ // TEMPLATE - core.prepare_removed_bool*_argument - START
+ bool __ok;
+ bool *_q_arg1 = &__ok;
+ // TEMPLATE - core.prepare_removed_bool*_argument - END
+ ushort _q_result = _q_self->toUShort(_q_arg0, _q_arg1);
+
+ // TEMPLATE - core.convert_to_null_or_primitive - START
+ QScriptValue _q_convertedResult;
+ if (!__ok)
+ _q_convertedResult = context->engine()->nullValue();
+ else
+ _q_convertedResult = QScriptValue(context->engine(), _q_result);
+ // TEMPLATE - core.convert_to_null_or_primitive - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+
+ // TEMPLATE - core.prepare_removed_bool*_argument - START
+ bool __ok;
+ bool *_q_arg1 = &__ok;
+ // TEMPLATE - core.prepare_removed_bool*_argument - END
+ int _q_arg2 = context->argument(1).toInt32();
+ ushort _q_result = _q_self->toUShort(_q_arg0, _q_arg1, _q_arg2);
+
+ // TEMPLATE - core.convert_to_null_or_primitive - START
+ QScriptValue _q_convertedResult;
+ if (!__ok)
+ _q_convertedResult = context->engine()->nullValue();
+ else
+ _q_convertedResult = QScriptValue(context->engine(), _q_result);
+ // TEMPLATE - core.convert_to_null_or_primitive - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 33:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator<<(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 34:
+ if (context->argumentCount() == 0) {
+ QChar _q_result = _q_self->zeroDigit();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QLocale_throw_ambiguity_error_helper(context,
+ qtscript_QLocale_function_names[_id+7],
+ qtscript_QLocale_function_signatures[_id+7]);
+}
+
+static QScriptValue qtscript_QLocale_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QLocale(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QLocale _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QLocale::Language>() == context->argument(0).toVariant().userType())) {
+ QLocale::Language _q_arg0 = qscriptvalue_cast<QLocale::Language>(context->argument(0));
+ QLocale _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if ((qMetaTypeId<QLocale>() == context->argument(0).toVariant().userType())) {
+ QLocale _q_arg0 = qscriptvalue_cast<QLocale>(context->argument(0));
+ QLocale _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QLocale _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 2) {
+ QLocale::Language _q_arg0 = qscriptvalue_cast<QLocale::Language>(context->argument(0));
+ QLocale::Country _q_arg1 = qscriptvalue_cast<QLocale::Country>(context->argument(1));
+ QLocale _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QLocale _q_result = QLocale::c();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QLocale::Language _q_arg0 = qscriptvalue_cast<QLocale::Language>(context->argument(0));
+ QList<QLocale::Country> _q_result = QLocale::countriesForLanguage(_q_arg0);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ QLocale::Country _q_arg0 = qscriptvalue_cast<QLocale::Country>(context->argument(0));
+ QString _q_result = QLocale::countryToString(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ QLocale::Language _q_arg0 = qscriptvalue_cast<QLocale::Language>(context->argument(0));
+ QString _q_result = QLocale::languageToString(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 1) {
+ QLocale _q_arg0 = qscriptvalue_cast<QLocale>(context->argument(0));
+ QLocale::setDefault(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ QLocale _q_result = QLocale::system();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QLocale_throw_ambiguity_error_helper(context,
+ qtscript_QLocale_function_names[_id],
+ qtscript_QLocale_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QLocale_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 2
+ // static
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 0
+ // prototype
+ , 0
+ , 0
+ , 1
+ , 1
+ , 2
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 2
+ , 0
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 0
+ , 1
+ , 1
+ , 2
+ , 2
+ , 1
+ , 2
+ , 2
+ , 2
+ , 2
+ , 3
+ , 3
+ , 3
+ , 3
+ , 2
+ , 3
+ , 1
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QLocale*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QLocale*)0));
+ for (int i = 0; i < 35; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QLocale_prototype_call, function_lengths[i+7]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QLocale_function_names[i+7]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QLocale>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QLocale*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QLocale_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 6; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QLocale_static_call,
+ function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_QLocale_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ ctor.setProperty(QString::fromLatin1("MeasurementSystem"),
+ qtscript_create_QLocale_MeasurementSystem_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("NumberOption"),
+ qtscript_create_QLocale_NumberOption_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("NumberOptions"),
+ qtscript_create_QLocale_NumberOptions_class(engine));
+ ctor.setProperty(QString::fromLatin1("FormatType"),
+ qtscript_create_QLocale_FormatType_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("Country"),
+ qtscript_create_QLocale_Country_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("Language"),
+ qtscript_create_QLocale_Language_class(engine, ctor));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QMimeData.cpp b/qtbindings/com_nokia_qt_core/qtscript_QMimeData.cpp
new file mode 100644
index 0000000..df0ea57
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QMimeData.cpp
@@ -0,0 +1,415 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qmimedata.h>
+#include <QStringList>
+#include <QUrl>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qmimedata.h>
+#include <qobject.h>
+#include <qstringlist.h>
+#include <qurl.h>
+
+#include "qtscriptshell_QMimeData.h"
+
+static const char * const qtscript_QMimeData_function_names[] = {
+ "QMimeData"
+ // static
+ // prototype
+ , "clear"
+ , "colorData"
+ , "data"
+ , "formats"
+ , "hasColor"
+ , "hasFormat"
+ , "hasHtml"
+ , "hasImage"
+ , "hasText"
+ , "hasUrls"
+ , "html"
+ , "imageData"
+ , "removeFormat"
+ , "setColorData"
+ , "setData"
+ , "setHtml"
+ , "setImageData"
+ , "setText"
+ , "setUrls"
+ , "text"
+ , "urls"
+ , "toString"
+};
+
+static const char * const qtscript_QMimeData_function_signatures[] = {
+ ""
+ // static
+ // prototype
+ , ""
+ , ""
+ , "String mimetype"
+ , ""
+ , ""
+ , "String mimetype"
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "String mimetype"
+ , "Object color"
+ , "String mimetype, QByteArray data"
+ , "String html"
+ , "Object image"
+ , "String text"
+ , "List urls"
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QMimeData_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QMimeData::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QMimeData*)
+Q_DECLARE_METATYPE(QtScriptShell_QMimeData*)
+Q_DECLARE_METATYPE(QVariant)
+Q_DECLARE_METATYPE(QList<QUrl>)
+
+//
+// QMimeData
+//
+
+static QScriptValue qtscript_QMimeData_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 21;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QMimeData* _q_self = qscriptvalue_cast<QMimeData*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QMimeData.%0(): this object is not a QMimeData")
+ .arg(qtscript_QMimeData_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ _q_self->clear();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QVariant _q_result = _q_self->colorData();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QByteArray _q_result = _q_self->data(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QStringList _q_result = _q_self->formats();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->hasColor();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->hasFormat(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->hasHtml();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->hasImage();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->hasText();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->hasUrls();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->html();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 0) {
+ QVariant _q_result = _q_self->imageData();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->removeFormat(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 1) {
+ QVariant _q_arg0 = context->argument(0).toVariant();
+ _q_self->setColorData(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QByteArray _q_arg1 = qscriptvalue_cast<QByteArray>(context->argument(1));
+ _q_self->setData(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setHtml(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 1) {
+ QVariant _q_arg0 = context->argument(0).toVariant();
+ _q_self->setImageData(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setText(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 1) {
+ QList<QUrl> _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ _q_self->setUrls(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->text();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 0) {
+ QList<QUrl> _q_result = _q_self->urls();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 21: {
+ QString result = QString::fromLatin1("QMimeData");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QMimeData_throw_ambiguity_error_helper(context,
+ qtscript_QMimeData_function_names[_id+1],
+ qtscript_QMimeData_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QMimeData_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QMimeData(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QMimeData* _q_cpp_result = new QtScriptShell_QMimeData();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QMimeData*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QMimeData_throw_ambiguity_error_helper(context,
+ qtscript_QMimeData_function_names[_id],
+ qtscript_QMimeData_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QMimeData_toScriptValue(QScriptEngine *engine, QMimeData* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QMimeData_fromScriptValue(const QScriptValue &value, QMimeData* &out)
+{
+ out = qobject_cast<QMimeData*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QMimeData_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 0
+ // static
+ // prototype
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 1
+ , 2
+ , 1
+ , 1
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QMimeData*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QMimeData*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
+ for (int i = 0; i < 22; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QMimeData_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QMimeData_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<QMimeData*>(engine, qtscript_QMimeData_toScriptValue,
+ qtscript_QMimeData_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QMimeData_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QModelIndex.cpp b/qtbindings/com_nokia_qt_core/qtscript_QModelIndex.cpp
new file mode 100644
index 0000000..7a47508
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QModelIndex.cpp
@@ -0,0 +1,321 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qabstractitemmodel.h>
+#include <QVariant>
+#include <qabstractitemmodel.h>
+
+static const char * const qtscript_QModelIndex_function_names[] = {
+ "QModelIndex"
+ // static
+ // prototype
+ , "child"
+ , "column"
+ , "data"
+ , "flags"
+ , "internalId"
+ , "internalPointer"
+ , "isValid"
+ , "model"
+ , "equals"
+ , "operator_less"
+ , "parent"
+ , "row"
+ , "sibling"
+ , "toString"
+};
+
+static const char * const qtscript_QModelIndex_function_signatures[] = {
+ "\nQModelIndex other"
+ // static
+ // prototype
+ , "int row, int column"
+ , ""
+ , "int role"
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "QModelIndex other"
+ , "QModelIndex other"
+ , ""
+ , ""
+ , "int row, int column"
+""
+};
+
+static QScriptValue qtscript_QModelIndex_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QModelIndex::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QModelIndex)
+Q_DECLARE_METATYPE(QModelIndex*)
+Q_DECLARE_METATYPE(QVariant)
+Q_DECLARE_METATYPE(QFlags<Qt::ItemFlag>)
+Q_DECLARE_METATYPE(QAbstractItemModel*)
+
+//
+// QModelIndex
+//
+
+static QScriptValue qtscript_QModelIndex_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 13;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QModelIndex* _q_self = qscriptvalue_cast<QModelIndex*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QModelIndex.%0(): this object is not a QModelIndex")
+ .arg(qtscript_QModelIndex_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ QModelIndex _q_result = _q_self->child(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->column();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QVariant _q_result = _q_self->data();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QVariant _q_result = _q_self->data(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QFlags<Qt::ItemFlag> _q_result = _q_self->flags();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ qint64 _q_result = _q_self->internalId();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ void* _q_result = _q_self->internalPointer();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isValid();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ QAbstractItemModel* _q_result = const_cast<QAbstractItemModel*>(_q_self->model());
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 1) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ bool _q_result = _q_self->operator==(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 1) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ bool _q_result = _q_self->operator<(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 0) {
+ QModelIndex _q_result = _q_self->parent();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->row();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ QModelIndex _q_result = _q_self->sibling(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 13: {
+ QString result;
+ QDebug d(&result);
+ d << *_q_self;
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QModelIndex_throw_ambiguity_error_helper(context,
+ qtscript_QModelIndex_function_names[_id+1],
+ qtscript_QModelIndex_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QModelIndex_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QModelIndex(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QModelIndex _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ QModelIndex _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QModelIndex_throw_ambiguity_error_helper(context,
+ qtscript_QModelIndex_function_names[_id],
+ qtscript_QModelIndex_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QModelIndex_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 2
+ , 0
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 1
+ , 0
+ , 0
+ , 2
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QModelIndex*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QModelIndex*)0));
+ for (int i = 0; i < 14; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QModelIndex_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QModelIndex_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QModelIndex>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QModelIndex*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QModelIndex_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QMutex.cpp b/qtbindings/com_nokia_qt_core/qtscript_QMutex.cpp
new file mode 100644
index 0000000..c6b281c
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QMutex.cpp
@@ -0,0 +1,292 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qmutex.h>
+#include <QVariant>
+#include <qmutex.h>
+
+static const char * const qtscript_QMutex_function_names[] = {
+ "QMutex"
+ // static
+ // prototype
+ , "lock"
+ , "tryLock"
+ , "unlock"
+ , "toString"
+};
+
+static const char * const qtscript_QMutex_function_signatures[] = {
+ "RecursionMode mode"
+ // static
+ // prototype
+ , ""
+ , "\nint timeout"
+ , ""
+""
+};
+
+static QScriptValue qtscript_QMutex_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QMutex::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QMutex*)
+Q_DECLARE_METATYPE(QMutex::RecursionMode)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// QMutex::RecursionMode
+//
+
+static const QMutex::RecursionMode qtscript_QMutex_RecursionMode_values[] = {
+ QMutex::NonRecursive
+ , QMutex::Recursive
+};
+
+static const char * const qtscript_QMutex_RecursionMode_keys[] = {
+ "NonRecursive"
+ , "Recursive"
+};
+
+static QString qtscript_QMutex_RecursionMode_toStringHelper(QMutex::RecursionMode value)
+{
+ if ((value >= QMutex::NonRecursive) && (value <= QMutex::Recursive))
+ return qtscript_QMutex_RecursionMode_keys[static_cast<int>(value)-static_cast<int>(QMutex::NonRecursive)];
+ return QString();
+}
+
+static QScriptValue qtscript_QMutex_RecursionMode_toScriptValue(QScriptEngine *engine, const QMutex::RecursionMode &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QMutex"));
+ return clazz.property(qtscript_QMutex_RecursionMode_toStringHelper(value));
+}
+
+static void qtscript_QMutex_RecursionMode_fromScriptValue(const QScriptValue &value, QMutex::RecursionMode &out)
+{
+ out = qvariant_cast<QMutex::RecursionMode>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QMutex_RecursionMode(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QMutex::NonRecursive) && (arg <= QMutex::Recursive))
+ return qScriptValueFromValue(engine, static_cast<QMutex::RecursionMode>(arg));
+ return context->throwError(QString::fromLatin1("RecursionMode(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QMutex_RecursionMode_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QMutex::RecursionMode value = qscriptvalue_cast<QMutex::RecursionMode>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QMutex_RecursionMode_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QMutex::RecursionMode value = qscriptvalue_cast<QMutex::RecursionMode>(context->thisObject());
+ return QScriptValue(engine, qtscript_QMutex_RecursionMode_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QMutex_RecursionMode_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QMutex_RecursionMode,
+ qtscript_QMutex_RecursionMode_valueOf, qtscript_QMutex_RecursionMode_toString);
+ qScriptRegisterMetaType<QMutex::RecursionMode>(engine, qtscript_QMutex_RecursionMode_toScriptValue,
+ qtscript_QMutex_RecursionMode_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QMutex_RecursionMode_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QMutex_RecursionMode_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QMutex
+//
+
+static QScriptValue qtscript_QMutex_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 3;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QMutex* _q_self = qscriptvalue_cast<QMutex*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QMutex.%0(): this object is not a QMutex")
+ .arg(qtscript_QMutex_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ _q_self->lock();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->tryLock();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ bool _q_result = _q_self->tryLock(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ _q_self->unlock();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 3: {
+ QString result = QString::fromLatin1("QMutex");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QMutex_throw_ambiguity_error_helper(context,
+ qtscript_QMutex_function_names[_id+1],
+ qtscript_QMutex_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QMutex_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QMutex(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QMutex* _q_cpp_result = new QMutex();
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QMutex::RecursionMode _q_arg0 = qscriptvalue_cast<QMutex::RecursionMode>(context->argument(0));
+ QMutex* _q_cpp_result = new QMutex(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QMutex_throw_ambiguity_error_helper(context,
+ qtscript_QMutex_function_names[_id],
+ qtscript_QMutex_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QMutex_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 0
+ , 1
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QMutex*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QMutex*)0));
+ for (int i = 0; i < 4; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QMutex_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QMutex_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QMutex*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QMutex_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ ctor.setProperty(QString::fromLatin1("RecursionMode"),
+ qtscript_create_QMutex_RecursionMode_class(engine, ctor));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QObject.cpp b/qtbindings/com_nokia_qt_core/qtscript_QObject.cpp
new file mode 100644
index 0000000..865006d
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QObject.cpp
@@ -0,0 +1,425 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qobject.h>
+#include <QVarLengthArray>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+
+#include "qtscriptshell_QObject.h"
+
+static const char * const qtscript_QObject_function_names[] = {
+ "QObject"
+ // static
+ // prototype
+ , "blockSignals"
+ , "children"
+ , "dumpObjectInfo"
+ , "dumpObjectTree"
+ , "dynamicPropertyNames"
+ , "event"
+ , "eventFilter"
+ , "inherits"
+ , "installEventFilter"
+ , "isWidgetType"
+ , "killTimer"
+ , "moveToThread"
+ , "parent"
+ , "property"
+ , "removeEventFilter"
+ , "setParent"
+ , "setProperty"
+ , "signalsBlocked"
+ , "startTimer"
+ , "thread"
+ , "toString"
+};
+
+static const char * const qtscript_QObject_function_signatures[] = {
+ "QObject parent"
+ // static
+ // prototype
+ , "bool b"
+ , ""
+ , ""
+ , ""
+ , ""
+ , "QEvent arg__1"
+ , "QObject arg__1, QEvent arg__2"
+ , "char classname"
+ , "QObject arg__1"
+ , ""
+ , "int id"
+ , "Thread thread"
+ , ""
+ , "char name"
+ , "QObject arg__1"
+ , "QObject arg__1"
+ , "char name, Object value"
+ , ""
+ , "int interval"
+ , ""
+""
+};
+
+static QScriptValue qtscript_QObject_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QObject::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QtScriptShell_QObject*)
+Q_DECLARE_METATYPE(QList<QObject*>)
+Q_DECLARE_METATYPE(QList<QByteArray>)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QThread*)
+Q_DECLARE_METATYPE(QVariant)
+
+//
+// QObject
+//
+
+static QScriptValue qtscript_QObject_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 20;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QObject* _q_self = qscriptvalue_cast<QObject*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QObject.%0(): this object is not a QObject")
+ .arg(qtscript_QObject_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ bool _q_arg0 = context->argument(0).toBoolean();
+ bool _q_result = _q_self->blockSignals(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QList<QObject*> _q_result = _q_self->children();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ _q_self->dumpObjectInfo();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ _q_self->dumpObjectTree();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ QList<QByteArray> _q_result = _q_self->dynamicPropertyNames();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 1) {
+ QEvent* _q_arg0 = qscriptvalue_cast<QEvent*>(context->argument(0));
+ bool _q_result = _q_self->event(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 2) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QEvent* _q_arg1 = qscriptvalue_cast<QEvent*>(context->argument(1));
+ bool _q_result = _q_self->eventFilter(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 1) {
+
+ // TEMPLATE - core.convert_string_arg_to_char* - START
+ QByteArray tmp__q_arg0 = context->argument(0).toString().toLatin1();
+ const char * _q_arg0 = tmp__q_arg0.constData();
+ // TEMPLATE - core.convert_string_arg_to_char* - END
+ bool _q_result = _q_self->inherits(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 1) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ _q_self->installEventFilter(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isWidgetType();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->killTimer(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 1) {
+ QThread* _q_arg0 = qscriptvalue_cast<QThread*>(context->argument(0));
+ _q_self->moveToThread(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 0) {
+ QObject* _q_result = _q_self->parent();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 1) {
+
+ // TEMPLATE - core.convert_string_arg_to_char* - START
+ QByteArray tmp__q_arg0 = context->argument(0).toString().toLatin1();
+ const char * _q_arg0 = tmp__q_arg0.constData();
+ // TEMPLATE - core.convert_string_arg_to_char* - END
+ QVariant _q_result = _q_self->property(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 1) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ _q_self->removeEventFilter(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 1) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ _q_self->setParent(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 2) {
+
+ // TEMPLATE - core.convert_string_arg_to_char* - START
+ QByteArray tmp__q_arg0 = context->argument(0).toString().toLatin1();
+ const char * _q_arg0 = tmp__q_arg0.constData();
+ // TEMPLATE - core.convert_string_arg_to_char* - END
+ QVariant _q_arg1 = context->argument(1).toVariant();
+ bool _q_result = _q_self->setProperty(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->signalsBlocked();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_result = _q_self->startTimer(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 0) {
+ QThread* _q_result = _q_self->thread();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 20: {
+ QString result;
+ QDebug d(&result);
+ d << _q_self;
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QObject_throw_ambiguity_error_helper(context,
+ qtscript_QObject_function_names[_id+1],
+ qtscript_QObject_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QObject_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QObject(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QObject* _q_cpp_result = new QtScriptShell_QObject();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QObject*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QtScriptShell_QObject* _q_cpp_result = new QtScriptShell_QObject(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QObject*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QObject_throw_ambiguity_error_helper(context,
+ qtscript_QObject_function_names[_id],
+ qtscript_QObject_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QObject_toScriptValue(QScriptEngine *engine, QObject* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QObject_fromScriptValue(const QScriptValue &value, QObject* &out)
+{
+ out = qobject_cast<QObject*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QObject_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 2
+ , 1
+ , 1
+ , 0
+ , 1
+ , 1
+ , 0
+ , 1
+ , 1
+ , 1
+ , 2
+ , 0
+ , 1
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QObject*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QObject*)0));
+ for (int i = 0; i < 21; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QObject_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QObject_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<QObject*>(engine, qtscript_QObject_toScriptValue,
+ qtscript_QObject_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QObject_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QPersistentModelIndex.cpp b/qtbindings/com_nokia_qt_core/qtscript_QPersistentModelIndex.cpp
new file mode 100644
index 0000000..b18299f
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QPersistentModelIndex.cpp
@@ -0,0 +1,335 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qabstractitemmodel.h>
+#include <QVariant>
+#include <qabstractitemmodel.h>
+
+static const char * const qtscript_QPersistentModelIndex_function_names[] = {
+ "QPersistentModelIndex"
+ // static
+ // prototype
+ , "child"
+ , "column"
+ , "data"
+ , "flags"
+ , "internalId"
+ , "isValid"
+ , "model"
+ , "operator_cast_QModelIndex"
+ , "equals"
+ , "operator_less"
+ , "parent"
+ , "row"
+ , "sibling"
+ , "toString"
+};
+
+static const char * const qtscript_QPersistentModelIndex_function_signatures[] = {
+ "\nQModelIndex index\nQPersistentModelIndex other"
+ // static
+ // prototype
+ , "int row, int column"
+ , ""
+ , "int role"
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "QModelIndex other\nQPersistentModelIndex other"
+ , "QPersistentModelIndex other"
+ , ""
+ , ""
+ , "int row, int column"
+""
+};
+
+static QScriptValue qtscript_QPersistentModelIndex_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QPersistentModelIndex::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QPersistentModelIndex)
+Q_DECLARE_METATYPE(QPersistentModelIndex*)
+Q_DECLARE_METATYPE(QModelIndex)
+Q_DECLARE_METATYPE(QVariant)
+Q_DECLARE_METATYPE(QFlags<Qt::ItemFlag>)
+Q_DECLARE_METATYPE(QAbstractItemModel*)
+
+//
+// QPersistentModelIndex
+//
+
+static QScriptValue qtscript_QPersistentModelIndex_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 13;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QPersistentModelIndex* _q_self = qscriptvalue_cast<QPersistentModelIndex*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QPersistentModelIndex.%0(): this object is not a QPersistentModelIndex")
+ .arg(qtscript_QPersistentModelIndex_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ QModelIndex _q_result = _q_self->child(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->column();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QVariant _q_result = _q_self->data();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QVariant _q_result = _q_self->data(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QFlags<Qt::ItemFlag> _q_result = _q_self->flags();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ qint64 _q_result = _q_self->internalId();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isValid();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ QAbstractItemModel* _q_result = const_cast<QAbstractItemModel*>(_q_self->model());
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ QModelIndex _q_result = _q_self->operator const QModelIndex&();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QModelIndex>() == context->argument(0).toVariant().userType())) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ bool _q_result = _q_self->operator==(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if ((qMetaTypeId<QPersistentModelIndex>() == context->argument(0).toVariant().userType())) {
+ QPersistentModelIndex _q_arg0 = qscriptvalue_cast<QPersistentModelIndex>(context->argument(0));
+ bool _q_result = _q_self->operator==(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 1) {
+ QPersistentModelIndex _q_arg0 = qscriptvalue_cast<QPersistentModelIndex>(context->argument(0));
+ bool _q_result = _q_self->operator<(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 0) {
+ QModelIndex _q_result = _q_self->parent();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->row();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ QModelIndex _q_result = _q_self->sibling(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 13: {
+ QString result;
+ QDebug d(&result);
+ d << *_q_self;
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QPersistentModelIndex_throw_ambiguity_error_helper(context,
+ qtscript_QPersistentModelIndex_function_names[_id+1],
+ qtscript_QPersistentModelIndex_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QPersistentModelIndex_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QPersistentModelIndex(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QPersistentModelIndex _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QModelIndex>() == context->argument(0).toVariant().userType())) {
+ QModelIndex _q_arg0 = qscriptvalue_cast<QModelIndex>(context->argument(0));
+ QPersistentModelIndex _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if ((qMetaTypeId<QPersistentModelIndex>() == context->argument(0).toVariant().userType())) {
+ QPersistentModelIndex _q_arg0 = qscriptvalue_cast<QPersistentModelIndex>(context->argument(0));
+ QPersistentModelIndex _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QPersistentModelIndex_throw_ambiguity_error_helper(context,
+ qtscript_QPersistentModelIndex_function_names[_id],
+ qtscript_QPersistentModelIndex_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QPersistentModelIndex_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 2
+ , 0
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 1
+ , 0
+ , 0
+ , 2
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QPersistentModelIndex*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QPersistentModelIndex*)0));
+ for (int i = 0; i < 14; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QPersistentModelIndex_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QPersistentModelIndex_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QPersistentModelIndex>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QPersistentModelIndex*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QPersistentModelIndex_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QPoint.cpp b/qtbindings/com_nokia_qt_core/qtscript_QPoint.cpp
new file mode 100644
index 0000000..ee5ed97
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QPoint.cpp
@@ -0,0 +1,318 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qpoint.h>
+#include <QVariant>
+#include <qdatastream.h>
+#include <qpoint.h>
+
+static const char * const qtscript_QPoint_function_names[] = {
+ "QPoint"
+ // static
+ // prototype
+ , "isNull"
+ , "manhattanLength"
+ , "operator_add_assign"
+ , "operator_divide_assign"
+ , "equals"
+ , "operator_multiply_assign"
+ , "operator_subtract_assign"
+ , "readFrom"
+ , "setX"
+ , "setY"
+ , "writeTo"
+ , "x"
+ , "y"
+ , "toString"
+};
+
+static const char * const qtscript_QPoint_function_signatures[] = {
+ "\nint xpos, int ypos"
+ // static
+ // prototype
+ , ""
+ , ""
+ , "QPoint p"
+ , "qreal c"
+ , "QPoint p2"
+ , "qreal c"
+ , "QPoint p"
+ , "QDataStream arg__1"
+ , "int x"
+ , "int y"
+ , "QDataStream arg__1"
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QPoint_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QPoint::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QPoint*)
+Q_DECLARE_METATYPE(QDataStream*)
+
+//
+// QPoint
+//
+
+static QScriptValue qtscript_QPoint_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 13;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QPoint* _q_self = qscriptvalue_cast<QPoint*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QPoint.%0(): this object is not a QPoint")
+ .arg(qtscript_QPoint_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isNull();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->manhattanLength();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QPoint _q_arg0 = qscriptvalue_cast<QPoint>(context->argument(0));
+ QPoint _q_result = _q_self->operator+=(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ QPoint _q_result = _q_self->operator/=(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ QPoint _q_arg0 = qscriptvalue_cast<QPoint>(context->argument(0));
+ bool _q_result = operator==(*_q_self, _q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ QPoint _q_result = _q_self->operator*=(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 1) {
+ QPoint _q_arg0 = qscriptvalue_cast<QPoint>(context->argument(0));
+ QPoint _q_result = _q_self->operator-=(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator>>(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setX(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setY(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator<<(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->x();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->y();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 13: {
+ QString result;
+ QDebug d(&result);
+ d << *_q_self;
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QPoint_throw_ambiguity_error_helper(context,
+ qtscript_QPoint_function_names[_id+1],
+ qtscript_QPoint_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QPoint_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QPoint(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QPoint _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ QPoint _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QPoint_throw_ambiguity_error_helper(context,
+ qtscript_QPoint_function_names[_id],
+ qtscript_QPoint_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QPoint_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 2
+ // static
+ // prototype
+ , 0
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QPoint*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QPoint*)0));
+ for (int i = 0; i < 14; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QPoint_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QPoint_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QPoint>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QPoint*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QPoint_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QPointF.cpp b/qtbindings/com_nokia_qt_core/qtscript_QPointF.cpp
new file mode 100644
index 0000000..6a8ef56
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QPointF.cpp
@@ -0,0 +1,323 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qpoint.h>
+#include <QVariant>
+#include <qdatastream.h>
+#include <qpoint.h>
+
+static const char * const qtscript_QPointF_function_names[] = {
+ "QPointF"
+ // static
+ // prototype
+ , "isNull"
+ , "operator_add_assign"
+ , "operator_divide_assign"
+ , "equals"
+ , "operator_multiply_assign"
+ , "operator_subtract_assign"
+ , "readFrom"
+ , "setX"
+ , "setY"
+ , "toPoint"
+ , "writeTo"
+ , "x"
+ , "y"
+ , "toString"
+};
+
+static const char * const qtscript_QPointF_function_signatures[] = {
+ "\nQPoint p\nqreal xpos, qreal ypos"
+ // static
+ // prototype
+ , ""
+ , "QPointF p"
+ , "qreal c"
+ , "QPointF p2"
+ , "qreal c"
+ , "QPointF p"
+ , "QDataStream arg__1"
+ , "qreal x"
+ , "qreal y"
+ , ""
+ , "QDataStream arg__1"
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QPointF_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QPointF::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QPointF*)
+Q_DECLARE_METATYPE(QDataStream*)
+
+//
+// QPointF
+//
+
+static QScriptValue qtscript_QPointF_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 13;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QPointF* _q_self = qscriptvalue_cast<QPointF*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QPointF.%0(): this object is not a QPointF")
+ .arg(qtscript_QPointF_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isNull();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QPointF _q_arg0 = qscriptvalue_cast<QPointF>(context->argument(0));
+ QPointF _q_result = _q_self->operator+=(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ QPointF _q_result = _q_self->operator/=(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ QPointF _q_arg0 = qscriptvalue_cast<QPointF>(context->argument(0));
+ bool _q_result = operator==(*_q_self, _q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ QPointF _q_result = _q_self->operator*=(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 1) {
+ QPointF _q_arg0 = qscriptvalue_cast<QPointF>(context->argument(0));
+ QPointF _q_result = _q_self->operator-=(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator>>(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ _q_self->setX(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ _q_self->setY(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 0) {
+ QPoint _q_result = _q_self->toPoint();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator<<(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 0) {
+ qreal _q_result = _q_self->x();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 0) {
+ qreal _q_result = _q_self->y();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 13: {
+ QString result;
+ QDebug d(&result);
+ d << *_q_self;
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QPointF_throw_ambiguity_error_helper(context,
+ qtscript_QPointF_function_names[_id+1],
+ qtscript_QPointF_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QPointF_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QPointF(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QPointF _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QPoint _q_arg0 = qscriptvalue_cast<QPoint>(context->argument(0));
+ QPointF _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 2) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ qreal _q_arg1 = qscriptvalue_cast<qreal>(context->argument(1));
+ QPointF _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QPointF_throw_ambiguity_error_helper(context,
+ qtscript_QPointF_function_names[_id],
+ qtscript_QPointF_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QPointF_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 2
+ // static
+ // prototype
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 0
+ , 1
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QPointF*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QPointF*)0));
+ for (int i = 0; i < 14; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QPointF_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QPointF_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QPointF>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QPointF*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QPointF_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QProcess.cpp b/qtbindings/com_nokia_qt_core/qtscript_QProcess.cpp
new file mode 100644
index 0000000..7760498
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QProcess.cpp
@@ -0,0 +1,931 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qprocess.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qprocess.h>
+#include <qstringlist.h>
+
+#include "qtscriptshell_QProcess.h"
+
+static const char * const qtscript_QProcess_function_names[] = {
+ "QProcess"
+ // static
+ , "execute"
+ , "startDetached"
+ , "systemEnvironment"
+ // prototype
+ , "closeReadChannel"
+ , "closeWriteChannel"
+ , "environment"
+ , "error"
+ , "exitCode"
+ , "exitStatus"
+ , "processChannelMode"
+ , "readAllStandardError"
+ , "readAllStandardOutput"
+ , "readChannel"
+ , "setEnvironment"
+ , "setProcessChannelMode"
+ , "setReadChannel"
+ , "setStandardErrorFile"
+ , "setStandardInputFile"
+ , "setStandardOutputFile"
+ , "setStandardOutputProcess"
+ , "setWorkingDirectory"
+ , "start"
+ , "state"
+ , "waitForFinished"
+ , "waitForStarted"
+ , "workingDirectory"
+ , "toString"
+};
+
+static const char * const qtscript_QProcess_function_signatures[] = {
+ "QObject parent"
+ // static
+ , "String program\nString program, List arguments"
+ , "String program\nString program, List arguments\nString program, List arguments, String workingDirectory, qint64 pid"
+ , ""
+ // prototype
+ , "ProcessChannel channel"
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "List environment"
+ , "ProcessChannelMode mode"
+ , "ProcessChannel channel"
+ , "String fileName, OpenMode mode"
+ , "String fileName"
+ , "String fileName, OpenMode mode"
+ , "QProcess destination"
+ , "String dir"
+ , "String program, OpenMode mode\nString program, List arguments, OpenMode mode"
+ , ""
+ , "int msecs"
+ , "int msecs"
+ , ""
+""
+};
+
+static QScriptValue qtscript_QProcess_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QProcess::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QProcess*)
+Q_DECLARE_METATYPE(QtScriptShell_QProcess*)
+Q_DECLARE_METATYPE(QProcess::ProcessError)
+Q_DECLARE_METATYPE(QProcess::ProcessChannelMode)
+Q_DECLARE_METATYPE(QProcess::ProcessChannel)
+Q_DECLARE_METATYPE(QProcess::ProcessState)
+Q_DECLARE_METATYPE(QProcess::ExitStatus)
+Q_DECLARE_METATYPE(QFlags<QIODevice::OpenModeFlag>)
+Q_DECLARE_METATYPE(qint64*)
+Q_DECLARE_METATYPE(QIODevice*)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// QProcess::ProcessError
+//
+
+static const QProcess::ProcessError qtscript_QProcess_ProcessError_values[] = {
+ QProcess::FailedToStart
+ , QProcess::Crashed
+ , QProcess::Timedout
+ , QProcess::ReadError
+ , QProcess::WriteError
+ , QProcess::UnknownError
+};
+
+static const char * const qtscript_QProcess_ProcessError_keys[] = {
+ "FailedToStart"
+ , "Crashed"
+ , "Timedout"
+ , "ReadError"
+ , "WriteError"
+ , "UnknownError"
+};
+
+static QString qtscript_QProcess_ProcessError_toStringHelper(QProcess::ProcessError value)
+{
+ if ((value >= QProcess::FailedToStart) && (value <= QProcess::UnknownError))
+ return qtscript_QProcess_ProcessError_keys[static_cast<int>(value)-static_cast<int>(QProcess::FailedToStart)];
+ return QString();
+}
+
+static QScriptValue qtscript_QProcess_ProcessError_toScriptValue(QScriptEngine *engine, const QProcess::ProcessError &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QProcess"));
+ return clazz.property(qtscript_QProcess_ProcessError_toStringHelper(value));
+}
+
+static void qtscript_QProcess_ProcessError_fromScriptValue(const QScriptValue &value, QProcess::ProcessError &out)
+{
+ out = qvariant_cast<QProcess::ProcessError>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QProcess_ProcessError(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QProcess::FailedToStart) && (arg <= QProcess::UnknownError))
+ return qScriptValueFromValue(engine, static_cast<QProcess::ProcessError>(arg));
+ return context->throwError(QString::fromLatin1("ProcessError(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QProcess_ProcessError_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QProcess::ProcessError value = qscriptvalue_cast<QProcess::ProcessError>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QProcess_ProcessError_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QProcess::ProcessError value = qscriptvalue_cast<QProcess::ProcessError>(context->thisObject());
+ return QScriptValue(engine, qtscript_QProcess_ProcessError_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QProcess_ProcessError_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QProcess_ProcessError,
+ qtscript_QProcess_ProcessError_valueOf, qtscript_QProcess_ProcessError_toString);
+ qScriptRegisterMetaType<QProcess::ProcessError>(engine, qtscript_QProcess_ProcessError_toScriptValue,
+ qtscript_QProcess_ProcessError_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 6; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QProcess_ProcessError_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QProcess_ProcessError_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QProcess::ProcessChannelMode
+//
+
+static const QProcess::ProcessChannelMode qtscript_QProcess_ProcessChannelMode_values[] = {
+ QProcess::SeparateChannels
+ , QProcess::MergedChannels
+ , QProcess::ForwardedChannels
+};
+
+static const char * const qtscript_QProcess_ProcessChannelMode_keys[] = {
+ "SeparateChannels"
+ , "MergedChannels"
+ , "ForwardedChannels"
+};
+
+static QString qtscript_QProcess_ProcessChannelMode_toStringHelper(QProcess::ProcessChannelMode value)
+{
+ if ((value >= QProcess::SeparateChannels) && (value <= QProcess::ForwardedChannels))
+ return qtscript_QProcess_ProcessChannelMode_keys[static_cast<int>(value)-static_cast<int>(QProcess::SeparateChannels)];
+ return QString();
+}
+
+static QScriptValue qtscript_QProcess_ProcessChannelMode_toScriptValue(QScriptEngine *engine, const QProcess::ProcessChannelMode &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QProcess"));
+ return clazz.property(qtscript_QProcess_ProcessChannelMode_toStringHelper(value));
+}
+
+static void qtscript_QProcess_ProcessChannelMode_fromScriptValue(const QScriptValue &value, QProcess::ProcessChannelMode &out)
+{
+ out = qvariant_cast<QProcess::ProcessChannelMode>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QProcess_ProcessChannelMode(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QProcess::SeparateChannels) && (arg <= QProcess::ForwardedChannels))
+ return qScriptValueFromValue(engine, static_cast<QProcess::ProcessChannelMode>(arg));
+ return context->throwError(QString::fromLatin1("ProcessChannelMode(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QProcess_ProcessChannelMode_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QProcess::ProcessChannelMode value = qscriptvalue_cast<QProcess::ProcessChannelMode>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QProcess_ProcessChannelMode_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QProcess::ProcessChannelMode value = qscriptvalue_cast<QProcess::ProcessChannelMode>(context->thisObject());
+ return QScriptValue(engine, qtscript_QProcess_ProcessChannelMode_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QProcess_ProcessChannelMode_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QProcess_ProcessChannelMode,
+ qtscript_QProcess_ProcessChannelMode_valueOf, qtscript_QProcess_ProcessChannelMode_toString);
+ qScriptRegisterMetaType<QProcess::ProcessChannelMode>(engine, qtscript_QProcess_ProcessChannelMode_toScriptValue,
+ qtscript_QProcess_ProcessChannelMode_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QProcess_ProcessChannelMode_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QProcess_ProcessChannelMode_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QProcess::ProcessChannel
+//
+
+static const QProcess::ProcessChannel qtscript_QProcess_ProcessChannel_values[] = {
+ QProcess::StandardOutput
+ , QProcess::StandardError
+};
+
+static const char * const qtscript_QProcess_ProcessChannel_keys[] = {
+ "StandardOutput"
+ , "StandardError"
+};
+
+static QString qtscript_QProcess_ProcessChannel_toStringHelper(QProcess::ProcessChannel value)
+{
+ if ((value >= QProcess::StandardOutput) && (value <= QProcess::StandardError))
+ return qtscript_QProcess_ProcessChannel_keys[static_cast<int>(value)-static_cast<int>(QProcess::StandardOutput)];
+ return QString();
+}
+
+static QScriptValue qtscript_QProcess_ProcessChannel_toScriptValue(QScriptEngine *engine, const QProcess::ProcessChannel &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QProcess"));
+ return clazz.property(qtscript_QProcess_ProcessChannel_toStringHelper(value));
+}
+
+static void qtscript_QProcess_ProcessChannel_fromScriptValue(const QScriptValue &value, QProcess::ProcessChannel &out)
+{
+ out = qvariant_cast<QProcess::ProcessChannel>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QProcess_ProcessChannel(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QProcess::StandardOutput) && (arg <= QProcess::StandardError))
+ return qScriptValueFromValue(engine, static_cast<QProcess::ProcessChannel>(arg));
+ return context->throwError(QString::fromLatin1("ProcessChannel(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QProcess_ProcessChannel_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QProcess::ProcessChannel value = qscriptvalue_cast<QProcess::ProcessChannel>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QProcess_ProcessChannel_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QProcess::ProcessChannel value = qscriptvalue_cast<QProcess::ProcessChannel>(context->thisObject());
+ return QScriptValue(engine, qtscript_QProcess_ProcessChannel_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QProcess_ProcessChannel_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QProcess_ProcessChannel,
+ qtscript_QProcess_ProcessChannel_valueOf, qtscript_QProcess_ProcessChannel_toString);
+ qScriptRegisterMetaType<QProcess::ProcessChannel>(engine, qtscript_QProcess_ProcessChannel_toScriptValue,
+ qtscript_QProcess_ProcessChannel_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QProcess_ProcessChannel_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QProcess_ProcessChannel_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QProcess::ProcessState
+//
+
+static const QProcess::ProcessState qtscript_QProcess_ProcessState_values[] = {
+ QProcess::NotRunning
+ , QProcess::Starting
+ , QProcess::Running
+};
+
+static const char * const qtscript_QProcess_ProcessState_keys[] = {
+ "NotRunning"
+ , "Starting"
+ , "Running"
+};
+
+static QString qtscript_QProcess_ProcessState_toStringHelper(QProcess::ProcessState value)
+{
+ if ((value >= QProcess::NotRunning) && (value <= QProcess::Running))
+ return qtscript_QProcess_ProcessState_keys[static_cast<int>(value)-static_cast<int>(QProcess::NotRunning)];
+ return QString();
+}
+
+static QScriptValue qtscript_QProcess_ProcessState_toScriptValue(QScriptEngine *engine, const QProcess::ProcessState &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QProcess"));
+ return clazz.property(qtscript_QProcess_ProcessState_toStringHelper(value));
+}
+
+static void qtscript_QProcess_ProcessState_fromScriptValue(const QScriptValue &value, QProcess::ProcessState &out)
+{
+ out = qvariant_cast<QProcess::ProcessState>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QProcess_ProcessState(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QProcess::NotRunning) && (arg <= QProcess::Running))
+ return qScriptValueFromValue(engine, static_cast<QProcess::ProcessState>(arg));
+ return context->throwError(QString::fromLatin1("ProcessState(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QProcess_ProcessState_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QProcess::ProcessState value = qscriptvalue_cast<QProcess::ProcessState>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QProcess_ProcessState_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QProcess::ProcessState value = qscriptvalue_cast<QProcess::ProcessState>(context->thisObject());
+ return QScriptValue(engine, qtscript_QProcess_ProcessState_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QProcess_ProcessState_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QProcess_ProcessState,
+ qtscript_QProcess_ProcessState_valueOf, qtscript_QProcess_ProcessState_toString);
+ qScriptRegisterMetaType<QProcess::ProcessState>(engine, qtscript_QProcess_ProcessState_toScriptValue,
+ qtscript_QProcess_ProcessState_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QProcess_ProcessState_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QProcess_ProcessState_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QProcess::ExitStatus
+//
+
+static const QProcess::ExitStatus qtscript_QProcess_ExitStatus_values[] = {
+ QProcess::NormalExit
+ , QProcess::CrashExit
+};
+
+static const char * const qtscript_QProcess_ExitStatus_keys[] = {
+ "NormalExit"
+ , "CrashExit"
+};
+
+static QString qtscript_QProcess_ExitStatus_toStringHelper(QProcess::ExitStatus value)
+{
+ if ((value >= QProcess::NormalExit) && (value <= QProcess::CrashExit))
+ return qtscript_QProcess_ExitStatus_keys[static_cast<int>(value)-static_cast<int>(QProcess::NormalExit)];
+ return QString();
+}
+
+static QScriptValue qtscript_QProcess_ExitStatus_toScriptValue(QScriptEngine *engine, const QProcess::ExitStatus &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QProcess"));
+ return clazz.property(qtscript_QProcess_ExitStatus_toStringHelper(value));
+}
+
+static void qtscript_QProcess_ExitStatus_fromScriptValue(const QScriptValue &value, QProcess::ExitStatus &out)
+{
+ out = qvariant_cast<QProcess::ExitStatus>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QProcess_ExitStatus(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QProcess::NormalExit) && (arg <= QProcess::CrashExit))
+ return qScriptValueFromValue(engine, static_cast<QProcess::ExitStatus>(arg));
+ return context->throwError(QString::fromLatin1("ExitStatus(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QProcess_ExitStatus_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QProcess::ExitStatus value = qscriptvalue_cast<QProcess::ExitStatus>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QProcess_ExitStatus_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QProcess::ExitStatus value = qscriptvalue_cast<QProcess::ExitStatus>(context->thisObject());
+ return QScriptValue(engine, qtscript_QProcess_ExitStatus_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QProcess_ExitStatus_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QProcess_ExitStatus,
+ qtscript_QProcess_ExitStatus_valueOf, qtscript_QProcess_ExitStatus_toString);
+ qScriptRegisterMetaType<QProcess::ExitStatus>(engine, qtscript_QProcess_ExitStatus_toScriptValue,
+ qtscript_QProcess_ExitStatus_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QProcess_ExitStatus_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QProcess_ExitStatus_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QProcess
+//
+
+static QScriptValue qtscript_QProcess_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 23;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QProcess* _q_self = qscriptvalue_cast<QProcess*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QProcess.%0(): this object is not a QProcess")
+ .arg(qtscript_QProcess_function_names[_id+4]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ QProcess::ProcessChannel _q_arg0 = qscriptvalue_cast<QProcess::ProcessChannel>(context->argument(0));
+ _q_self->closeReadChannel(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ _q_self->closeWriteChannel();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QStringList _q_result = _q_self->environment();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QProcess::ProcessError _q_result = _q_self->error();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->exitCode();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QProcess::ExitStatus _q_result = _q_self->exitStatus();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ QProcess::ProcessChannelMode _q_result = _q_self->processChannelMode();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->readAllStandardError();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->readAllStandardOutput();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 0) {
+ QProcess::ProcessChannel _q_result = _q_self->readChannel();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 1) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ _q_self->setEnvironment(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 1) {
+ QProcess::ProcessChannelMode _q_arg0 = qscriptvalue_cast<QProcess::ProcessChannelMode>(context->argument(0));
+ _q_self->setProcessChannelMode(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 1) {
+ QProcess::ProcessChannel _q_arg0 = qscriptvalue_cast<QProcess::ProcessChannel>(context->argument(0));
+ _q_self->setReadChannel(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setStandardErrorFile(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QFlags<QIODevice::OpenModeFlag> _q_arg1 = qscriptvalue_cast<QFlags<QIODevice::OpenModeFlag> >(context->argument(1));
+ _q_self->setStandardErrorFile(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setStandardInputFile(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setStandardOutputFile(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QFlags<QIODevice::OpenModeFlag> _q_arg1 = qscriptvalue_cast<QFlags<QIODevice::OpenModeFlag> >(context->argument(1));
+ _q_self->setStandardOutputFile(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 1) {
+ QProcess* _q_arg0 = qscriptvalue_cast<QProcess*>(context->argument(0));
+ _q_self->setStandardOutputProcess(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setWorkingDirectory(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->start(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ if (context->argument(0).isString()
+ && (qMetaTypeId<QFlags<QIODevice::OpenModeFlag> >() == context->argument(1).toVariant().userType())) {
+ QString _q_arg0 = context->argument(0).toString();
+ QFlags<QIODevice::OpenModeFlag> _q_arg1 = qscriptvalue_cast<QFlags<QIODevice::OpenModeFlag> >(context->argument(1));
+ _q_self->start(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ } else if (context->argument(0).isString()
+ && context->argument(1).isArray()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QStringList _q_arg1;
+ qScriptValueToSequence(context->argument(1), _q_arg1);
+ _q_self->start(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ }
+ if (context->argumentCount() == 3) {
+ QString _q_arg0 = context->argument(0).toString();
+ QStringList _q_arg1;
+ qScriptValueToSequence(context->argument(1), _q_arg1);
+ QFlags<QIODevice::OpenModeFlag> _q_arg2 = qscriptvalue_cast<QFlags<QIODevice::OpenModeFlag> >(context->argument(2));
+ _q_self->start(_q_arg0, _q_arg1, _q_arg2);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 0) {
+ QProcess::ProcessState _q_result = _q_self->state();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->waitForFinished();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ bool _q_result = _q_self->waitForFinished(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 21:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->waitForStarted();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ bool _q_result = _q_self->waitForStarted(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 22:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->workingDirectory();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 23: {
+ QString result = QString::fromLatin1("QProcess");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QProcess_throw_ambiguity_error_helper(context,
+ qtscript_QProcess_function_names[_id+4],
+ qtscript_QProcess_function_signatures[_id+4]);
+}
+
+static QScriptValue qtscript_QProcess_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QProcess(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QProcess* _q_cpp_result = new QtScriptShell_QProcess();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QProcess*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QtScriptShell_QProcess* _q_cpp_result = new QtScriptShell_QProcess(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QProcess*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ int _q_result = QProcess::execute(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QStringList _q_arg1;
+ qScriptValueToSequence(context->argument(1), _q_arg1);
+ int _q_result = QProcess::execute(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = QProcess::startDetached(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QStringList _q_arg1;
+ qScriptValueToSequence(context->argument(1), _q_arg1);
+ bool _q_result = QProcess::startDetached(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ QString _q_arg0 = context->argument(0).toString();
+ QStringList _q_arg1;
+ qScriptValueToSequence(context->argument(1), _q_arg1);
+ QString _q_arg2 = context->argument(2).toString();
+ bool _q_result = QProcess::startDetached(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 4) {
+ QString _q_arg0 = context->argument(0).toString();
+ QStringList _q_arg1;
+ qScriptValueToSequence(context->argument(1), _q_arg1);
+ QString _q_arg2 = context->argument(2).toString();
+ qint64* _q_arg3 = qscriptvalue_cast<qint64*>(context->argument(3));
+ bool _q_result = QProcess::startDetached(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QStringList _q_result = QProcess::systemEnvironment();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QProcess_throw_ambiguity_error_helper(context,
+ qtscript_QProcess_function_names[_id],
+ qtscript_QProcess_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QProcess_toScriptValue(QScriptEngine *engine, QProcess* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QProcess_fromScriptValue(const QScriptValue &value, QProcess* &out)
+{
+ out = qobject_cast<QProcess*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QProcess_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ , 2
+ , 4
+ , 0
+ // prototype
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 1
+ , 1
+ , 2
+ , 1
+ , 2
+ , 1
+ , 1
+ , 3
+ , 0
+ , 1
+ , 1
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QProcess*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QProcess*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QIODevice*>()));
+ for (int i = 0; i < 24; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QProcess_prototype_call, function_lengths[i+4]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QProcess_function_names[i+4]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<QProcess*>(engine, qtscript_QProcess_toScriptValue,
+ qtscript_QProcess_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QProcess_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 3; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QProcess_static_call,
+ function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_QProcess_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ ctor.setProperty(QString::fromLatin1("ProcessError"),
+ qtscript_create_QProcess_ProcessError_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ProcessChannelMode"),
+ qtscript_create_QProcess_ProcessChannelMode_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ProcessChannel"),
+ qtscript_create_QProcess_ProcessChannel_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ProcessState"),
+ qtscript_create_QProcess_ProcessState_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ExitStatus"),
+ qtscript_create_QProcess_ExitStatus_class(engine, ctor));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QRect.cpp b/qtbindings/com_nokia_qt_core/qtscript_QRect.cpp
new file mode 100644
index 0000000..bbb0c54
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QRect.cpp
@@ -0,0 +1,839 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qrect.h>
+#include <QVariant>
+#include <qdatastream.h>
+#include <qpoint.h>
+#include <qrect.h>
+#include <qsize.h>
+
+static const char * const qtscript_QRect_function_names[] = {
+ "QRect"
+ // static
+ // prototype
+ , "adjust"
+ , "adjusted"
+ , "bottom"
+ , "bottomLeft"
+ , "bottomRight"
+ , "center"
+ , "contains"
+ , "height"
+ , "intersected"
+ , "intersects"
+ , "isEmpty"
+ , "isNull"
+ , "isValid"
+ , "left"
+ , "moveBottom"
+ , "moveBottomLeft"
+ , "moveBottomRight"
+ , "moveCenter"
+ , "moveLeft"
+ , "moveRight"
+ , "moveTo"
+ , "moveTop"
+ , "moveTopLeft"
+ , "moveTopRight"
+ , "normalized"
+ , "equals"
+ , "readFrom"
+ , "right"
+ , "setBottom"
+ , "setBottomLeft"
+ , "setBottomRight"
+ , "setCoords"
+ , "setHeight"
+ , "setLeft"
+ , "setRect"
+ , "setRight"
+ , "setSize"
+ , "setTop"
+ , "setTopLeft"
+ , "setTopRight"
+ , "setWidth"
+ , "setX"
+ , "setY"
+ , "size"
+ , "top"
+ , "topLeft"
+ , "topRight"
+ , "translate"
+ , "translated"
+ , "united"
+ , "width"
+ , "writeTo"
+ , "x"
+ , "y"
+ , "toString"
+};
+
+static const char * const qtscript_QRect_function_signatures[] = {
+ "\nQPoint topleft, QPoint bottomright\nQPoint topleft, QSize size\nint left, int top, int width, int height"
+ // static
+ // prototype
+ , "int x1, int y1, int x2, int y2"
+ , "int x1, int y1, int x2, int y2"
+ , ""
+ , ""
+ , ""
+ , ""
+ , "QPoint p, bool proper\nQRect r, bool proper\nint x, int y\nint x, int y, bool proper"
+ , ""
+ , "QRect other"
+ , "QRect r"
+ , ""
+ , ""
+ , ""
+ , ""
+ , "int pos"
+ , "QPoint p"
+ , "QPoint p"
+ , "QPoint p"
+ , "int pos"
+ , "int pos"
+ , "QPoint p\nint x, int t"
+ , "int pos"
+ , "QPoint p"
+ , "QPoint p"
+ , ""
+ , "QRect arg__2"
+ , "QDataStream arg__1"
+ , ""
+ , "int pos"
+ , "QPoint p"
+ , "QPoint p"
+ , "int x1, int y1, int x2, int y2"
+ , "int h"
+ , "int pos"
+ , "int x, int y, int w, int h"
+ , "int pos"
+ , "QSize s"
+ , "int pos"
+ , "QPoint p"
+ , "QPoint p"
+ , "int w"
+ , "int x"
+ , "int y"
+ , ""
+ , ""
+ , ""
+ , ""
+ , "QPoint p\nint dx, int dy"
+ , "QPoint p\nint dx, int dy"
+ , "QRect other"
+ , ""
+ , "QDataStream arg__1"
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QRect_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QRect::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QRect*)
+Q_DECLARE_METATYPE(QDataStream*)
+
+//
+// QRect
+//
+
+static QScriptValue qtscript_QRect_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 54;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QRect* _q_self = qscriptvalue_cast<QRect*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QRect.%0(): this object is not a QRect")
+ .arg(qtscript_QRect_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 4) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_arg2 = context->argument(2).toInt32();
+ int _q_arg3 = context->argument(3).toInt32();
+ _q_self->adjust(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 4) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_arg2 = context->argument(2).toInt32();
+ int _q_arg3 = context->argument(3).toInt32();
+ QRect _q_result = _q_self->adjusted(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->bottom();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QPoint _q_result = _q_self->bottomLeft();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ QPoint _q_result = _q_self->bottomRight();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QPoint _q_result = _q_self->center();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QPoint>() == context->argument(0).toVariant().userType())) {
+ QPoint _q_arg0 = qscriptvalue_cast<QPoint>(context->argument(0));
+ bool _q_result = _q_self->contains(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if ((qMetaTypeId<QRect>() == context->argument(0).toVariant().userType())) {
+ QRect _q_arg0 = qscriptvalue_cast<QRect>(context->argument(0));
+ bool _q_result = _q_self->contains(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 2) {
+ if ((qMetaTypeId<QPoint>() == context->argument(0).toVariant().userType())
+ && context->argument(1).isBoolean()) {
+ QPoint _q_arg0 = qscriptvalue_cast<QPoint>(context->argument(0));
+ bool _q_arg1 = context->argument(1).toBoolean();
+ bool _q_result = _q_self->contains(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if ((qMetaTypeId<QRect>() == context->argument(0).toVariant().userType())
+ && context->argument(1).isBoolean()) {
+ QRect _q_arg0 = qscriptvalue_cast<QRect>(context->argument(0));
+ bool _q_arg1 = context->argument(1).toBoolean();
+ bool _q_result = _q_self->contains(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isNumber()
+ && context->argument(1).isNumber()) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ bool _q_result = _q_self->contains(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 3) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ bool _q_arg2 = context->argument(2).toBoolean();
+ bool _q_result = _q_self->contains(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->height();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 1) {
+ QRect _q_arg0 = qscriptvalue_cast<QRect>(context->argument(0));
+ QRect _q_result = _q_self->intersected(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 1) {
+ QRect _q_arg0 = qscriptvalue_cast<QRect>(context->argument(0));
+ bool _q_result = _q_self->intersects(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isEmpty();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isNull();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isValid();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->left();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->moveBottom(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 1) {
+ QPoint _q_arg0 = qscriptvalue_cast<QPoint>(context->argument(0));
+ _q_self->moveBottomLeft(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 1) {
+ QPoint _q_arg0 = qscriptvalue_cast<QPoint>(context->argument(0));
+ _q_self->moveBottomRight(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 1) {
+ QPoint _q_arg0 = qscriptvalue_cast<QPoint>(context->argument(0));
+ _q_self->moveCenter(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->moveLeft(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->moveRight(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 1) {
+ QPoint _q_arg0 = qscriptvalue_cast<QPoint>(context->argument(0));
+ _q_self->moveTo(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ _q_self->moveTo(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 21:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->moveTop(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 22:
+ if (context->argumentCount() == 1) {
+ QPoint _q_arg0 = qscriptvalue_cast<QPoint>(context->argument(0));
+ _q_self->moveTopLeft(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 23:
+ if (context->argumentCount() == 1) {
+ QPoint _q_arg0 = qscriptvalue_cast<QPoint>(context->argument(0));
+ _q_self->moveTopRight(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 24:
+ if (context->argumentCount() == 0) {
+ QRect _q_result = _q_self->normalized();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 25:
+ if (context->argumentCount() == 1) {
+ QRect _q_arg0 = qscriptvalue_cast<QRect>(context->argument(0));
+ bool _q_result = operator==(*_q_self, _q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 26:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator>>(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 27:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->right();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 28:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setBottom(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 29:
+ if (context->argumentCount() == 1) {
+ QPoint _q_arg0 = qscriptvalue_cast<QPoint>(context->argument(0));
+ _q_self->setBottomLeft(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 30:
+ if (context->argumentCount() == 1) {
+ QPoint _q_arg0 = qscriptvalue_cast<QPoint>(context->argument(0));
+ _q_self->setBottomRight(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 31:
+ if (context->argumentCount() == 4) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_arg2 = context->argument(2).toInt32();
+ int _q_arg3 = context->argument(3).toInt32();
+ _q_self->setCoords(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 32:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setHeight(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 33:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setLeft(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 34:
+ if (context->argumentCount() == 4) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_arg2 = context->argument(2).toInt32();
+ int _q_arg3 = context->argument(3).toInt32();
+ _q_self->setRect(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 35:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setRight(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 36:
+ if (context->argumentCount() == 1) {
+ QSize _q_arg0 = qscriptvalue_cast<QSize>(context->argument(0));
+ _q_self->setSize(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 37:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setTop(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 38:
+ if (context->argumentCount() == 1) {
+ QPoint _q_arg0 = qscriptvalue_cast<QPoint>(context->argument(0));
+ _q_self->setTopLeft(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 39:
+ if (context->argumentCount() == 1) {
+ QPoint _q_arg0 = qscriptvalue_cast<QPoint>(context->argument(0));
+ _q_self->setTopRight(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 40:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setWidth(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 41:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setX(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 42:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setY(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 43:
+ if (context->argumentCount() == 0) {
+ QSize _q_result = _q_self->size();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 44:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->top();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 45:
+ if (context->argumentCount() == 0) {
+ QPoint _q_result = _q_self->topLeft();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 46:
+ if (context->argumentCount() == 0) {
+ QPoint _q_result = _q_self->topRight();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 47:
+ if (context->argumentCount() == 1) {
+ QPoint _q_arg0 = qscriptvalue_cast<QPoint>(context->argument(0));
+ _q_self->translate(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ _q_self->translate(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 48:
+ if (context->argumentCount() == 1) {
+ QPoint _q_arg0 = qscriptvalue_cast<QPoint>(context->argument(0));
+ QRect _q_result = _q_self->translated(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ QRect _q_result = _q_self->translated(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 49:
+ if (context->argumentCount() == 1) {
+ QRect _q_arg0 = qscriptvalue_cast<QRect>(context->argument(0));
+ QRect _q_result = _q_self->united(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 50:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->width();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 51:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator<<(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 52:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->x();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 53:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->y();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 54: {
+ QString result;
+ QDebug d(&result);
+ d << *_q_self;
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QRect_throw_ambiguity_error_helper(context,
+ qtscript_QRect_function_names[_id+1],
+ qtscript_QRect_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QRect_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QRect(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QRect _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 2) {
+ if ((qMetaTypeId<QPoint>() == context->argument(0).toVariant().userType())
+ && (qMetaTypeId<QPoint>() == context->argument(1).toVariant().userType())) {
+ QPoint _q_arg0 = qscriptvalue_cast<QPoint>(context->argument(0));
+ QPoint _q_arg1 = qscriptvalue_cast<QPoint>(context->argument(1));
+ QRect _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if ((qMetaTypeId<QPoint>() == context->argument(0).toVariant().userType())
+ && (qMetaTypeId<QSize>() == context->argument(1).toVariant().userType())) {
+ QPoint _q_arg0 = qscriptvalue_cast<QPoint>(context->argument(0));
+ QSize _q_arg1 = qscriptvalue_cast<QSize>(context->argument(1));
+ QRect _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 4) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_arg2 = context->argument(2).toInt32();
+ int _q_arg3 = context->argument(3).toInt32();
+ QRect _q_cpp_result(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QRect_throw_ambiguity_error_helper(context,
+ qtscript_QRect_function_names[_id],
+ qtscript_QRect_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QRect_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 4
+ // static
+ // prototype
+ , 4
+ , 4
+ , 0
+ , 0
+ , 0
+ , 0
+ , 3
+ , 0
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 2
+ , 1
+ , 1
+ , 1
+ , 0
+ , 1
+ , 1
+ , 0
+ , 1
+ , 1
+ , 1
+ , 4
+ , 1
+ , 1
+ , 4
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 2
+ , 2
+ , 1
+ , 0
+ , 1
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QRect*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QRect*)0));
+ for (int i = 0; i < 55; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QRect_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QRect_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QRect>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QRect*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QRect_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QRectF.cpp b/qtbindings/com_nokia_qt_core/qtscript_QRectF.cpp
new file mode 100644
index 0000000..ca050cb
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QRectF.cpp
@@ -0,0 +1,842 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qrect.h>
+#include <QVariant>
+#include <qdatastream.h>
+#include <qpoint.h>
+#include <qrect.h>
+#include <qsize.h>
+
+static const char * const qtscript_QRectF_function_names[] = {
+ "QRectF"
+ // static
+ // prototype
+ , "adjust"
+ , "adjusted"
+ , "bottom"
+ , "bottomLeft"
+ , "bottomRight"
+ , "center"
+ , "contains"
+ , "height"
+ , "intersected"
+ , "intersects"
+ , "isEmpty"
+ , "isNull"
+ , "isValid"
+ , "left"
+ , "moveBottom"
+ , "moveBottomLeft"
+ , "moveBottomRight"
+ , "moveCenter"
+ , "moveLeft"
+ , "moveRight"
+ , "moveTo"
+ , "moveTop"
+ , "moveTopLeft"
+ , "moveTopRight"
+ , "normalized"
+ , "equals"
+ , "readFrom"
+ , "right"
+ , "setBottom"
+ , "setBottomLeft"
+ , "setBottomRight"
+ , "setCoords"
+ , "setHeight"
+ , "setLeft"
+ , "setRect"
+ , "setRight"
+ , "setSize"
+ , "setTop"
+ , "setTopLeft"
+ , "setTopRight"
+ , "setWidth"
+ , "setX"
+ , "setY"
+ , "size"
+ , "toAlignedRect"
+ , "toRect"
+ , "top"
+ , "topLeft"
+ , "topRight"
+ , "translate"
+ , "translated"
+ , "united"
+ , "width"
+ , "writeTo"
+ , "x"
+ , "y"
+ , "toString"
+};
+
+static const char * const qtscript_QRectF_function_signatures[] = {
+ "\nQPointF topleft, QPointF bottomRight\nQPointF topleft, QSizeF size\nQRect rect\nqreal left, qreal top, qreal width, qreal height"
+ // static
+ // prototype
+ , "qreal x1, qreal y1, qreal x2, qreal y2"
+ , "qreal x1, qreal y1, qreal x2, qreal y2"
+ , ""
+ , ""
+ , ""
+ , ""
+ , "QPointF p\nQRectF r\nqreal x, qreal y"
+ , ""
+ , "QRectF other"
+ , "QRectF r"
+ , ""
+ , ""
+ , ""
+ , ""
+ , "qreal pos"
+ , "QPointF p"
+ , "QPointF p"
+ , "QPointF p"
+ , "qreal pos"
+ , "qreal pos"
+ , "QPointF p\nqreal x, qreal t"
+ , "qreal pos"
+ , "QPointF p"
+ , "QPointF p"
+ , ""
+ , "QRectF arg__2"
+ , "QDataStream arg__1"
+ , ""
+ , "qreal pos"
+ , "QPointF p"
+ , "QPointF p"
+ , "qreal x1, qreal y1, qreal x2, qreal y2"
+ , "qreal h"
+ , "qreal pos"
+ , "qreal x, qreal y, qreal w, qreal h"
+ , "qreal pos"
+ , "QSizeF s"
+ , "qreal pos"
+ , "QPointF p"
+ , "QPointF p"
+ , "qreal w"
+ , "qreal pos"
+ , "qreal pos"
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "QPointF p\nqreal dx, qreal dy"
+ , "QPointF p\nqreal dx, qreal dy"
+ , "QRectF other"
+ , ""
+ , "QDataStream arg__1"
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QRectF_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QRectF::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QRectF*)
+Q_DECLARE_METATYPE(QDataStream*)
+
+//
+// QRectF
+//
+
+static QScriptValue qtscript_QRectF_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 56;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QRectF* _q_self = qscriptvalue_cast<QRectF*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QRectF.%0(): this object is not a QRectF")
+ .arg(qtscript_QRectF_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 4) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ qreal _q_arg1 = qscriptvalue_cast<qreal>(context->argument(1));
+ qreal _q_arg2 = qscriptvalue_cast<qreal>(context->argument(2));
+ qreal _q_arg3 = qscriptvalue_cast<qreal>(context->argument(3));
+ _q_self->adjust(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 4) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ qreal _q_arg1 = qscriptvalue_cast<qreal>(context->argument(1));
+ qreal _q_arg2 = qscriptvalue_cast<qreal>(context->argument(2));
+ qreal _q_arg3 = qscriptvalue_cast<qreal>(context->argument(3));
+ QRectF _q_result = _q_self->adjusted(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ qreal _q_result = _q_self->bottom();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QPointF _q_result = _q_self->bottomLeft();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ QPointF _q_result = _q_self->bottomRight();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QPointF _q_result = _q_self->center();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QPointF>() == context->argument(0).toVariant().userType())) {
+ QPointF _q_arg0 = qscriptvalue_cast<QPointF>(context->argument(0));
+ bool _q_result = _q_self->contains(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if ((qMetaTypeId<QRectF>() == context->argument(0).toVariant().userType())) {
+ QRectF _q_arg0 = qscriptvalue_cast<QRectF>(context->argument(0));
+ bool _q_result = _q_self->contains(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 2) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ qreal _q_arg1 = qscriptvalue_cast<qreal>(context->argument(1));
+ bool _q_result = _q_self->contains(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ qreal _q_result = _q_self->height();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 1) {
+ QRectF _q_arg0 = qscriptvalue_cast<QRectF>(context->argument(0));
+ QRectF _q_result = _q_self->intersected(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 1) {
+ QRectF _q_arg0 = qscriptvalue_cast<QRectF>(context->argument(0));
+ bool _q_result = _q_self->intersects(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isEmpty();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isNull();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isValid();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 0) {
+ qreal _q_result = _q_self->left();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ _q_self->moveBottom(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 1) {
+ QPointF _q_arg0 = qscriptvalue_cast<QPointF>(context->argument(0));
+ _q_self->moveBottomLeft(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 1) {
+ QPointF _q_arg0 = qscriptvalue_cast<QPointF>(context->argument(0));
+ _q_self->moveBottomRight(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 1) {
+ QPointF _q_arg0 = qscriptvalue_cast<QPointF>(context->argument(0));
+ _q_self->moveCenter(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ _q_self->moveLeft(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ _q_self->moveRight(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 1) {
+ QPointF _q_arg0 = qscriptvalue_cast<QPointF>(context->argument(0));
+ _q_self->moveTo(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ qreal _q_arg1 = qscriptvalue_cast<qreal>(context->argument(1));
+ _q_self->moveTo(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 21:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ _q_self->moveTop(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 22:
+ if (context->argumentCount() == 1) {
+ QPointF _q_arg0 = qscriptvalue_cast<QPointF>(context->argument(0));
+ _q_self->moveTopLeft(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 23:
+ if (context->argumentCount() == 1) {
+ QPointF _q_arg0 = qscriptvalue_cast<QPointF>(context->argument(0));
+ _q_self->moveTopRight(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 24:
+ if (context->argumentCount() == 0) {
+ QRectF _q_result = _q_self->normalized();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 25:
+ if (context->argumentCount() == 1) {
+ QRectF _q_arg0 = qscriptvalue_cast<QRectF>(context->argument(0));
+ bool _q_result = operator==(*_q_self, _q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 26:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator>>(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 27:
+ if (context->argumentCount() == 0) {
+ qreal _q_result = _q_self->right();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 28:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ _q_self->setBottom(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 29:
+ if (context->argumentCount() == 1) {
+ QPointF _q_arg0 = qscriptvalue_cast<QPointF>(context->argument(0));
+ _q_self->setBottomLeft(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 30:
+ if (context->argumentCount() == 1) {
+ QPointF _q_arg0 = qscriptvalue_cast<QPointF>(context->argument(0));
+ _q_self->setBottomRight(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 31:
+ if (context->argumentCount() == 4) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ qreal _q_arg1 = qscriptvalue_cast<qreal>(context->argument(1));
+ qreal _q_arg2 = qscriptvalue_cast<qreal>(context->argument(2));
+ qreal _q_arg3 = qscriptvalue_cast<qreal>(context->argument(3));
+ _q_self->setCoords(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 32:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ _q_self->setHeight(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 33:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ _q_self->setLeft(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 34:
+ if (context->argumentCount() == 4) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ qreal _q_arg1 = qscriptvalue_cast<qreal>(context->argument(1));
+ qreal _q_arg2 = qscriptvalue_cast<qreal>(context->argument(2));
+ qreal _q_arg3 = qscriptvalue_cast<qreal>(context->argument(3));
+ _q_self->setRect(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 35:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ _q_self->setRight(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 36:
+ if (context->argumentCount() == 1) {
+ QSizeF _q_arg0 = qscriptvalue_cast<QSizeF>(context->argument(0));
+ _q_self->setSize(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 37:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ _q_self->setTop(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 38:
+ if (context->argumentCount() == 1) {
+ QPointF _q_arg0 = qscriptvalue_cast<QPointF>(context->argument(0));
+ _q_self->setTopLeft(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 39:
+ if (context->argumentCount() == 1) {
+ QPointF _q_arg0 = qscriptvalue_cast<QPointF>(context->argument(0));
+ _q_self->setTopRight(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 40:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ _q_self->setWidth(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 41:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ _q_self->setX(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 42:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ _q_self->setY(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 43:
+ if (context->argumentCount() == 0) {
+ QSizeF _q_result = _q_self->size();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 44:
+ if (context->argumentCount() == 0) {
+ QRect _q_result = _q_self->toAlignedRect();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 45:
+ if (context->argumentCount() == 0) {
+ QRect _q_result = _q_self->toRect();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 46:
+ if (context->argumentCount() == 0) {
+ qreal _q_result = _q_self->top();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 47:
+ if (context->argumentCount() == 0) {
+ QPointF _q_result = _q_self->topLeft();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 48:
+ if (context->argumentCount() == 0) {
+ QPointF _q_result = _q_self->topRight();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 49:
+ if (context->argumentCount() == 1) {
+ QPointF _q_arg0 = qscriptvalue_cast<QPointF>(context->argument(0));
+ _q_self->translate(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ qreal _q_arg1 = qscriptvalue_cast<qreal>(context->argument(1));
+ _q_self->translate(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 50:
+ if (context->argumentCount() == 1) {
+ QPointF _q_arg0 = qscriptvalue_cast<QPointF>(context->argument(0));
+ QRectF _q_result = _q_self->translated(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ qreal _q_arg1 = qscriptvalue_cast<qreal>(context->argument(1));
+ QRectF _q_result = _q_self->translated(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 51:
+ if (context->argumentCount() == 1) {
+ QRectF _q_arg0 = qscriptvalue_cast<QRectF>(context->argument(0));
+ QRectF _q_result = _q_self->united(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 52:
+ if (context->argumentCount() == 0) {
+ qreal _q_result = _q_self->width();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 53:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator<<(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 54:
+ if (context->argumentCount() == 0) {
+ qreal _q_result = _q_self->x();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 55:
+ if (context->argumentCount() == 0) {
+ qreal _q_result = _q_self->y();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 56: {
+ QString result;
+ QDebug d(&result);
+ d << *_q_self;
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QRectF_throw_ambiguity_error_helper(context,
+ qtscript_QRectF_function_names[_id+1],
+ qtscript_QRectF_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QRectF_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QRectF(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QRectF _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QRect _q_arg0 = qscriptvalue_cast<QRect>(context->argument(0));
+ QRectF _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 2) {
+ if ((qMetaTypeId<QPointF>() == context->argument(0).toVariant().userType())
+ && (qMetaTypeId<QPointF>() == context->argument(1).toVariant().userType())) {
+ QPointF _q_arg0 = qscriptvalue_cast<QPointF>(context->argument(0));
+ QPointF _q_arg1 = qscriptvalue_cast<QPointF>(context->argument(1));
+ QRectF _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if ((qMetaTypeId<QPointF>() == context->argument(0).toVariant().userType())
+ && (qMetaTypeId<QSizeF>() == context->argument(1).toVariant().userType())) {
+ QPointF _q_arg0 = qscriptvalue_cast<QPointF>(context->argument(0));
+ QSizeF _q_arg1 = qscriptvalue_cast<QSizeF>(context->argument(1));
+ QRectF _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 4) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ qreal _q_arg1 = qscriptvalue_cast<qreal>(context->argument(1));
+ qreal _q_arg2 = qscriptvalue_cast<qreal>(context->argument(2));
+ qreal _q_arg3 = qscriptvalue_cast<qreal>(context->argument(3));
+ QRectF _q_cpp_result(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QRectF_throw_ambiguity_error_helper(context,
+ qtscript_QRectF_function_names[_id],
+ qtscript_QRectF_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QRectF_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 4
+ // static
+ // prototype
+ , 4
+ , 4
+ , 0
+ , 0
+ , 0
+ , 0
+ , 2
+ , 0
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 2
+ , 1
+ , 1
+ , 1
+ , 0
+ , 1
+ , 1
+ , 0
+ , 1
+ , 1
+ , 1
+ , 4
+ , 1
+ , 1
+ , 4
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 2
+ , 2
+ , 1
+ , 0
+ , 1
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QRectF*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QRectF*)0));
+ for (int i = 0; i < 57; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QRectF_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QRectF_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QRectF>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QRectF*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QRectF_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QRunnable.cpp b/qtbindings/com_nokia_qt_core/qtscript_QRunnable.cpp
new file mode 100644
index 0000000..1f5bec1
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QRunnable.cpp
@@ -0,0 +1,202 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qrunnable.h>
+#include <QVariant>
+
+#include "qtscriptshell_QRunnable.h"
+
+static const char * const qtscript_QRunnable_function_names[] = {
+ "QRunnable"
+ // static
+ // prototype
+ , "autoDelete"
+ , "run"
+ , "setAutoDelete"
+ , "toString"
+};
+
+static const char * const qtscript_QRunnable_function_signatures[] = {
+ ""
+ // static
+ // prototype
+ , ""
+ , ""
+ , "bool _autoDelete"
+""
+};
+
+static QScriptValue qtscript_QRunnable_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QRunnable::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QRunnable*)
+Q_DECLARE_METATYPE(QtScriptShell_QRunnable*)
+
+//
+// QRunnable
+//
+
+static QScriptValue qtscript_QRunnable_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 3;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QRunnable* _q_self = qscriptvalue_cast<QRunnable*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QRunnable.%0(): this object is not a QRunnable")
+ .arg(qtscript_QRunnable_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->autoDelete();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ _q_self->run();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ bool _q_arg0 = context->argument(0).toBoolean();
+ _q_self->setAutoDelete(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 3: {
+ QString result = QString::fromLatin1("QRunnable");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QRunnable_throw_ambiguity_error_helper(context,
+ qtscript_QRunnable_function_names[_id+1],
+ qtscript_QRunnable_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QRunnable_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QRunnable(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QRunnable* _q_cpp_result = new QtScriptShell_QRunnable();
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QRunnable*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QRunnable_throw_ambiguity_error_helper(context,
+ qtscript_QRunnable_function_names[_id],
+ qtscript_QRunnable_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QRunnable_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 0
+ // static
+ // prototype
+ , 0
+ , 0
+ , 1
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QRunnable*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QRunnable*)0));
+ for (int i = 0; i < 4; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QRunnable_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QRunnable_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QRunnable*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QRunnable_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QSemaphore.cpp b/qtbindings/com_nokia_qt_core/qtscript_QSemaphore.cpp
new file mode 100644
index 0000000..dadb0f4
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QSemaphore.cpp
@@ -0,0 +1,234 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qsemaphore.h>
+#include <QVariant>
+#include <qsemaphore.h>
+
+static const char * const qtscript_QSemaphore_function_names[] = {
+ "QSemaphore"
+ // static
+ // prototype
+ , "acquire"
+ , "available"
+ , "release"
+ , "tryAcquire"
+ , "toString"
+};
+
+static const char * const qtscript_QSemaphore_function_signatures[] = {
+ "int n"
+ // static
+ // prototype
+ , "int n"
+ , ""
+ , "int n"
+ , "int n\nint n, int timeout"
+""
+};
+
+static QScriptValue qtscript_QSemaphore_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QSemaphore::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QSemaphore*)
+
+//
+// QSemaphore
+//
+
+static QScriptValue qtscript_QSemaphore_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 4;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QSemaphore* _q_self = qscriptvalue_cast<QSemaphore*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QSemaphore.%0(): this object is not a QSemaphore")
+ .arg(qtscript_QSemaphore_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ _q_self->acquire();
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->acquire(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->available();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ _q_self->release();
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->release(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->tryAcquire();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ bool _q_result = _q_self->tryAcquire(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ bool _q_result = _q_self->tryAcquire(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4: {
+ QString result = QString::fromLatin1("QSemaphore");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QSemaphore_throw_ambiguity_error_helper(context,
+ qtscript_QSemaphore_function_names[_id+1],
+ qtscript_QSemaphore_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QSemaphore_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QSemaphore(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QSemaphore* _q_cpp_result = new QSemaphore();
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QSemaphore* _q_cpp_result = new QSemaphore(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QSemaphore_throw_ambiguity_error_helper(context,
+ qtscript_QSemaphore_function_names[_id],
+ qtscript_QSemaphore_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QSemaphore_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 1
+ , 0
+ , 1
+ , 2
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QSemaphore*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QSemaphore*)0));
+ for (int i = 0; i < 5; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QSemaphore_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QSemaphore_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QSemaphore*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QSemaphore_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QSettings.cpp b/qtbindings/com_nokia_qt_core/qtscript_QSettings.cpp
new file mode 100644
index 0000000..8210ea5
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QSettings.cpp
@@ -0,0 +1,916 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qsettings.h>
+#include <QStringList>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qsettings.h>
+#include <qstringlist.h>
+#include <qtextcodec.h>
+
+#include "qtscriptshell_QSettings.h"
+
+static const char * const qtscript_QSettings_function_names[] = {
+ "QSettings"
+ // static
+ , "defaultFormat"
+ , "setDefaultFormat"
+ , "setPath"
+ // prototype
+ , "allKeys"
+ , "applicationName"
+ , "beginGroup"
+ , "beginReadArray"
+ , "beginWriteArray"
+ , "childGroups"
+ , "childKeys"
+ , "clear"
+ , "contains"
+ , "endArray"
+ , "endGroup"
+ , "fallbacksEnabled"
+ , "fileName"
+ , "format"
+ , "group"
+ , "iniCodec"
+ , "isWritable"
+ , "organizationName"
+ , "remove"
+ , "scope"
+ , "setArrayIndex"
+ , "setFallbacksEnabled"
+ , "setIniCodec"
+ , "setValue"
+ , "status"
+ , "sync"
+ , "value"
+ , "toString"
+};
+
+static const char * const qtscript_QSettings_function_signatures[] = {
+ "QObject parent\nFormat format, Scope scope, String organization, String application, QObject parent\nScope scope, String organization, String application, QObject parent\nString fileName, Format format, QObject parent\nString organization, String application, QObject parent"
+ // static
+ , ""
+ , "Format format"
+ , "Format format, Scope scope, String path"
+ // prototype
+ , ""
+ , ""
+ , "String prefix"
+ , "String prefix"
+ , "String prefix, int size"
+ , ""
+ , ""
+ , ""
+ , "String key"
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "String key"
+ , ""
+ , "int i"
+ , "bool b"
+ , "QTextCodec codec\nchar codecName"
+ , "String key, Object value"
+ , ""
+ , ""
+ , "String key, Object defaultValue"
+""
+};
+
+static QScriptValue qtscript_QSettings_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QSettings::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QSettings*)
+Q_DECLARE_METATYPE(QtScriptShell_QSettings*)
+Q_DECLARE_METATYPE(QSettings::Format)
+Q_DECLARE_METATYPE(QSettings::Status)
+Q_DECLARE_METATYPE(QSettings::Scope)
+Q_DECLARE_METATYPE(QTextCodec*)
+Q_DECLARE_METATYPE(char*)
+Q_DECLARE_METATYPE(QVariant)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// QSettings::Format
+//
+
+static const QSettings::Format qtscript_QSettings_Format_values[] = {
+ QSettings::NativeFormat
+ , QSettings::IniFormat
+ , QSettings::InvalidFormat
+ , QSettings::CustomFormat1
+ , QSettings::CustomFormat2
+ , QSettings::CustomFormat3
+ , QSettings::CustomFormat4
+ , QSettings::CustomFormat5
+ , QSettings::CustomFormat6
+ , QSettings::CustomFormat7
+ , QSettings::CustomFormat8
+ , QSettings::CustomFormat9
+ , QSettings::CustomFormat10
+ , QSettings::CustomFormat11
+ , QSettings::CustomFormat12
+ , QSettings::CustomFormat13
+ , QSettings::CustomFormat14
+ , QSettings::CustomFormat15
+ , QSettings::CustomFormat16
+};
+
+static const char * const qtscript_QSettings_Format_keys[] = {
+ "NativeFormat"
+ , "IniFormat"
+ , "InvalidFormat"
+ , "CustomFormat1"
+ , "CustomFormat2"
+ , "CustomFormat3"
+ , "CustomFormat4"
+ , "CustomFormat5"
+ , "CustomFormat6"
+ , "CustomFormat7"
+ , "CustomFormat8"
+ , "CustomFormat9"
+ , "CustomFormat10"
+ , "CustomFormat11"
+ , "CustomFormat12"
+ , "CustomFormat13"
+ , "CustomFormat14"
+ , "CustomFormat15"
+ , "CustomFormat16"
+};
+
+static QString qtscript_QSettings_Format_toStringHelper(QSettings::Format value)
+{
+ for (int i = 0; i < 19; ++i) {
+ if (qtscript_QSettings_Format_values[i] == value)
+ return QString::fromLatin1(qtscript_QSettings_Format_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_QSettings_Format_toScriptValue(QScriptEngine *engine, const QSettings::Format &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QSettings"));
+ return clazz.property(qtscript_QSettings_Format_toStringHelper(value));
+}
+
+static void qtscript_QSettings_Format_fromScriptValue(const QScriptValue &value, QSettings::Format &out)
+{
+ out = qvariant_cast<QSettings::Format>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QSettings_Format(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 19; ++i) {
+ if (qtscript_QSettings_Format_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<QSettings::Format>(arg));
+ }
+ return context->throwError(QString::fromLatin1("Format(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QSettings_Format_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QSettings::Format value = qscriptvalue_cast<QSettings::Format>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QSettings_Format_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QSettings::Format value = qscriptvalue_cast<QSettings::Format>(context->thisObject());
+ return QScriptValue(engine, qtscript_QSettings_Format_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QSettings_Format_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QSettings_Format,
+ qtscript_QSettings_Format_valueOf, qtscript_QSettings_Format_toString);
+ qScriptRegisterMetaType<QSettings::Format>(engine, qtscript_QSettings_Format_toScriptValue,
+ qtscript_QSettings_Format_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 19; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QSettings_Format_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QSettings_Format_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QSettings::Status
+//
+
+static const QSettings::Status qtscript_QSettings_Status_values[] = {
+ QSettings::NoError
+ , QSettings::AccessError
+ , QSettings::FormatError
+};
+
+static const char * const qtscript_QSettings_Status_keys[] = {
+ "NoError"
+ , "AccessError"
+ , "FormatError"
+};
+
+static QString qtscript_QSettings_Status_toStringHelper(QSettings::Status value)
+{
+ if ((value >= QSettings::NoError) && (value <= QSettings::FormatError))
+ return qtscript_QSettings_Status_keys[static_cast<int>(value)-static_cast<int>(QSettings::NoError)];
+ return QString();
+}
+
+static QScriptValue qtscript_QSettings_Status_toScriptValue(QScriptEngine *engine, const QSettings::Status &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QSettings"));
+ return clazz.property(qtscript_QSettings_Status_toStringHelper(value));
+}
+
+static void qtscript_QSettings_Status_fromScriptValue(const QScriptValue &value, QSettings::Status &out)
+{
+ out = qvariant_cast<QSettings::Status>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QSettings_Status(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QSettings::NoError) && (arg <= QSettings::FormatError))
+ return qScriptValueFromValue(engine, static_cast<QSettings::Status>(arg));
+ return context->throwError(QString::fromLatin1("Status(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QSettings_Status_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QSettings::Status value = qscriptvalue_cast<QSettings::Status>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QSettings_Status_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QSettings::Status value = qscriptvalue_cast<QSettings::Status>(context->thisObject());
+ return QScriptValue(engine, qtscript_QSettings_Status_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QSettings_Status_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QSettings_Status,
+ qtscript_QSettings_Status_valueOf, qtscript_QSettings_Status_toString);
+ qScriptRegisterMetaType<QSettings::Status>(engine, qtscript_QSettings_Status_toScriptValue,
+ qtscript_QSettings_Status_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QSettings_Status_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QSettings_Status_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QSettings::Scope
+//
+
+static const QSettings::Scope qtscript_QSettings_Scope_values[] = {
+ QSettings::UserScope
+ , QSettings::SystemScope
+};
+
+static const char * const qtscript_QSettings_Scope_keys[] = {
+ "UserScope"
+ , "SystemScope"
+};
+
+static QString qtscript_QSettings_Scope_toStringHelper(QSettings::Scope value)
+{
+ if ((value >= QSettings::UserScope) && (value <= QSettings::SystemScope))
+ return qtscript_QSettings_Scope_keys[static_cast<int>(value)-static_cast<int>(QSettings::UserScope)];
+ return QString();
+}
+
+static QScriptValue qtscript_QSettings_Scope_toScriptValue(QScriptEngine *engine, const QSettings::Scope &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QSettings"));
+ return clazz.property(qtscript_QSettings_Scope_toStringHelper(value));
+}
+
+static void qtscript_QSettings_Scope_fromScriptValue(const QScriptValue &value, QSettings::Scope &out)
+{
+ out = qvariant_cast<QSettings::Scope>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QSettings_Scope(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QSettings::UserScope) && (arg <= QSettings::SystemScope))
+ return qScriptValueFromValue(engine, static_cast<QSettings::Scope>(arg));
+ return context->throwError(QString::fromLatin1("Scope(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QSettings_Scope_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QSettings::Scope value = qscriptvalue_cast<QSettings::Scope>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QSettings_Scope_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QSettings::Scope value = qscriptvalue_cast<QSettings::Scope>(context->thisObject());
+ return QScriptValue(engine, qtscript_QSettings_Scope_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QSettings_Scope_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QSettings_Scope,
+ qtscript_QSettings_Scope_valueOf, qtscript_QSettings_Scope_toString);
+ qScriptRegisterMetaType<QSettings::Scope>(engine, qtscript_QSettings_Scope_toScriptValue,
+ qtscript_QSettings_Scope_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QSettings_Scope_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QSettings_Scope_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QSettings
+//
+
+static QScriptValue qtscript_QSettings_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 27;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QSettings* _q_self = qscriptvalue_cast<QSettings*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QSettings.%0(): this object is not a QSettings")
+ .arg(qtscript_QSettings_function_names[_id+4]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ QStringList _q_result = _q_self->allKeys();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->applicationName();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->beginGroup(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ int _q_result = _q_self->beginReadArray(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->beginWriteArray(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ int _q_arg1 = context->argument(1).toInt32();
+ _q_self->beginWriteArray(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QStringList _q_result = _q_self->childGroups();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ QStringList _q_result = _q_self->childKeys();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ _q_self->clear();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->contains(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 0) {
+ _q_self->endArray();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 0) {
+ _q_self->endGroup();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->fallbacksEnabled();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->fileName();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 0) {
+ QSettings::Format _q_result = _q_self->format();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->group();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 0) {
+ QTextCodec* _q_result = _q_self->iniCodec();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isWritable();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->organizationName();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->remove(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 0) {
+ QSettings::Scope _q_result = _q_self->scope();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setArrayIndex(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 21:
+ if (context->argumentCount() == 1) {
+ bool _q_arg0 = context->argument(0).toBoolean();
+ _q_self->setFallbacksEnabled(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 22:
+ if (context->argumentCount() == 1) {
+ if (qscriptvalue_cast<QTextCodec*>(context->argument(0))) {
+ QTextCodec* _q_arg0 = qscriptvalue_cast<QTextCodec*>(context->argument(0));
+ _q_self->setIniCodec(_q_arg0);
+ return context->engine()->undefinedValue();
+ } else if (qscriptvalue_cast<char*>(context->argument(0))) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ _q_self->setIniCodec(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ }
+ break;
+
+ case 23:
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QVariant _q_arg1 = context->argument(1).toVariant();
+ _q_self->setValue(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 24:
+ if (context->argumentCount() == 0) {
+ QSettings::Status _q_result = _q_self->status();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 25:
+ if (context->argumentCount() == 0) {
+ _q_self->sync();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 26:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QVariant _q_result = _q_self->value(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QVariant _q_arg1 = context->argument(1).toVariant();
+ QVariant _q_result = _q_self->value(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 27: {
+ QString result = QString::fromLatin1("QSettings");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QSettings_throw_ambiguity_error_helper(context,
+ qtscript_QSettings_function_names[_id+4],
+ qtscript_QSettings_function_signatures[_id+4]);
+}
+
+static QScriptValue qtscript_QSettings_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QSettings(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QSettings* _q_cpp_result = new QtScriptShell_QSettings();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QSettings*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ if (context->argument(0).isQObject()) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QtScriptShell_QSettings* _q_cpp_result = new QtScriptShell_QSettings(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QSettings*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QtScriptShell_QSettings* _q_cpp_result = new QtScriptShell_QSettings(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QSettings*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 2) {
+ if ((qMetaTypeId<QSettings::Scope>() == context->argument(0).toVariant().userType())
+ && context->argument(1).isString()) {
+ QSettings::Scope _q_arg0 = qscriptvalue_cast<QSettings::Scope>(context->argument(0));
+ QString _q_arg1 = context->argument(1).toString();
+ QtScriptShell_QSettings* _q_cpp_result = new QtScriptShell_QSettings(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QSettings*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argument(0).isString()
+ && (qMetaTypeId<QSettings::Format>() == context->argument(1).toVariant().userType())) {
+ QString _q_arg0 = context->argument(0).toString();
+ QSettings::Format _q_arg1 = qscriptvalue_cast<QSettings::Format>(context->argument(1));
+ QtScriptShell_QSettings* _q_cpp_result = new QtScriptShell_QSettings(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QSettings*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argument(0).isString()
+ && context->argument(1).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QtScriptShell_QSettings* _q_cpp_result = new QtScriptShell_QSettings(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QSettings*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 3) {
+ if ((qMetaTypeId<QSettings::Format>() == context->argument(0).toVariant().userType())
+ && (qMetaTypeId<QSettings::Scope>() == context->argument(1).toVariant().userType())
+ && context->argument(2).isString()) {
+ QSettings::Format _q_arg0 = qscriptvalue_cast<QSettings::Format>(context->argument(0));
+ QSettings::Scope _q_arg1 = qscriptvalue_cast<QSettings::Scope>(context->argument(1));
+ QString _q_arg2 = context->argument(2).toString();
+ QtScriptShell_QSettings* _q_cpp_result = new QtScriptShell_QSettings(_q_arg0, _q_arg1, _q_arg2);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QSettings*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if ((qMetaTypeId<QSettings::Scope>() == context->argument(0).toVariant().userType())
+ && context->argument(1).isString()
+ && context->argument(2).isString()) {
+ QSettings::Scope _q_arg0 = qscriptvalue_cast<QSettings::Scope>(context->argument(0));
+ QString _q_arg1 = context->argument(1).toString();
+ QString _q_arg2 = context->argument(2).toString();
+ QtScriptShell_QSettings* _q_cpp_result = new QtScriptShell_QSettings(_q_arg0, _q_arg1, _q_arg2);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QSettings*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argument(0).isString()
+ && (qMetaTypeId<QSettings::Format>() == context->argument(1).toVariant().userType())
+ && context->argument(2).isQObject()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QSettings::Format _q_arg1 = qscriptvalue_cast<QSettings::Format>(context->argument(1));
+ QObject* _q_arg2 = context->argument(2).toQObject();
+ QtScriptShell_QSettings* _q_cpp_result = new QtScriptShell_QSettings(_q_arg0, _q_arg1, _q_arg2);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QSettings*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argument(0).isString()
+ && context->argument(1).isString()
+ && context->argument(2).isQObject()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QObject* _q_arg2 = context->argument(2).toQObject();
+ QtScriptShell_QSettings* _q_cpp_result = new QtScriptShell_QSettings(_q_arg0, _q_arg1, _q_arg2);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QSettings*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 4) {
+ if ((qMetaTypeId<QSettings::Format>() == context->argument(0).toVariant().userType())
+ && (qMetaTypeId<QSettings::Scope>() == context->argument(1).toVariant().userType())
+ && context->argument(2).isString()
+ && context->argument(3).isString()) {
+ QSettings::Format _q_arg0 = qscriptvalue_cast<QSettings::Format>(context->argument(0));
+ QSettings::Scope _q_arg1 = qscriptvalue_cast<QSettings::Scope>(context->argument(1));
+ QString _q_arg2 = context->argument(2).toString();
+ QString _q_arg3 = context->argument(3).toString();
+ QtScriptShell_QSettings* _q_cpp_result = new QtScriptShell_QSettings(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QSettings*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if ((qMetaTypeId<QSettings::Scope>() == context->argument(0).toVariant().userType())
+ && context->argument(1).isString()
+ && context->argument(2).isString()
+ && context->argument(3).isQObject()) {
+ QSettings::Scope _q_arg0 = qscriptvalue_cast<QSettings::Scope>(context->argument(0));
+ QString _q_arg1 = context->argument(1).toString();
+ QString _q_arg2 = context->argument(2).toString();
+ QObject* _q_arg3 = context->argument(3).toQObject();
+ QtScriptShell_QSettings* _q_cpp_result = new QtScriptShell_QSettings(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QSettings*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 5) {
+ QSettings::Format _q_arg0 = qscriptvalue_cast<QSettings::Format>(context->argument(0));
+ QSettings::Scope _q_arg1 = qscriptvalue_cast<QSettings::Scope>(context->argument(1));
+ QString _q_arg2 = context->argument(2).toString();
+ QString _q_arg3 = context->argument(3).toString();
+ QObject* _q_arg4 = context->argument(4).toQObject();
+ QtScriptShell_QSettings* _q_cpp_result = new QtScriptShell_QSettings(_q_arg0, _q_arg1, _q_arg2, _q_arg3, _q_arg4);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QSettings*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QSettings::Format _q_result = QSettings::defaultFormat();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QSettings::Format _q_arg0 = qscriptvalue_cast<QSettings::Format>(context->argument(0));
+ QSettings::setDefaultFormat(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 3) {
+ QSettings::Format _q_arg0 = qscriptvalue_cast<QSettings::Format>(context->argument(0));
+ QSettings::Scope _q_arg1 = qscriptvalue_cast<QSettings::Scope>(context->argument(1));
+ QString _q_arg2 = context->argument(2).toString();
+ QSettings::setPath(_q_arg0, _q_arg1, _q_arg2);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QSettings_throw_ambiguity_error_helper(context,
+ qtscript_QSettings_function_names[_id],
+ qtscript_QSettings_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QSettings_toScriptValue(QScriptEngine *engine, QSettings* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QSettings_fromScriptValue(const QScriptValue &value, QSettings* &out)
+{
+ out = qobject_cast<QSettings*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QSettings_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 5
+ // static
+ , 0
+ , 1
+ , 3
+ // prototype
+ , 0
+ , 0
+ , 1
+ , 1
+ , 2
+ , 0
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 0
+ , 1
+ , 1
+ , 1
+ , 2
+ , 0
+ , 0
+ , 2
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QSettings*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QSettings*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
+ for (int i = 0; i < 28; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QSettings_prototype_call, function_lengths[i+4]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QSettings_function_names[i+4]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<QSettings*>(engine, qtscript_QSettings_toScriptValue,
+ qtscript_QSettings_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QSettings_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 3; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QSettings_static_call,
+ function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_QSettings_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ ctor.setProperty(QString::fromLatin1("Format"),
+ qtscript_create_QSettings_Format_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("Status"),
+ qtscript_create_QSettings_Status_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("Scope"),
+ qtscript_create_QSettings_Scope_class(engine, ctor));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QSignalMapper.cpp b/qtbindings/com_nokia_qt_core/qtscript_QSignalMapper.cpp
new file mode 100644
index 0000000..bbbb772
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QSignalMapper.cpp
@@ -0,0 +1,274 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qsignalmapper.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qsignalmapper.h>
+
+#include "qtscriptshell_QSignalMapper.h"
+
+static const char * const qtscript_QSignalMapper_function_names[] = {
+ "QSignalMapper"
+ // static
+ // prototype
+ , "mappingById"
+ , "mappingByObject"
+ , "mappingByString"
+ , "removeMappings"
+ , "setMappingById"
+ , "setMappingByObject"
+ , "setMappingByString"
+ , "toString"
+};
+
+static const char * const qtscript_QSignalMapper_function_signatures[] = {
+ "QObject parent"
+ // static
+ // prototype
+ , "int id"
+ , "QObject object"
+ , "String text"
+ , "QObject sender"
+ , "QObject sender, int id"
+ , "QObject sender, QObject object"
+ , "QObject sender, String text"
+""
+};
+
+static QScriptValue qtscript_QSignalMapper_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QSignalMapper::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QSignalMapper*)
+Q_DECLARE_METATYPE(QtScriptShell_QSignalMapper*)
+
+//
+// QSignalMapper
+//
+
+static QScriptValue qtscript_QSignalMapper_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 7;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QSignalMapper* _q_self = qscriptvalue_cast<QSignalMapper*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QSignalMapper.%0(): this object is not a QSignalMapper")
+ .arg(qtscript_QSignalMapper_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QObject* _q_result = _q_self->mapping(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QObject* _q_result = _q_self->mapping(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QObject* _q_result = _q_self->mapping(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ _q_self->removeMappings(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 2) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ int _q_arg1 = context->argument(1).toInt32();
+ _q_self->setMapping(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 2) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QObject* _q_arg1 = context->argument(1).toQObject();
+ _q_self->setMapping(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 2) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QString _q_arg1 = context->argument(1).toString();
+ _q_self->setMapping(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 7: {
+ QString result = QString::fromLatin1("QSignalMapper");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QSignalMapper_throw_ambiguity_error_helper(context,
+ qtscript_QSignalMapper_function_names[_id+1],
+ qtscript_QSignalMapper_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QSignalMapper_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QSignalMapper(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QSignalMapper* _q_cpp_result = new QtScriptShell_QSignalMapper();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QSignalMapper*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QtScriptShell_QSignalMapper* _q_cpp_result = new QtScriptShell_QSignalMapper(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QSignalMapper*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QSignalMapper_throw_ambiguity_error_helper(context,
+ qtscript_QSignalMapper_function_names[_id],
+ qtscript_QSignalMapper_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QSignalMapper_toScriptValue(QScriptEngine *engine, QSignalMapper* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QSignalMapper_fromScriptValue(const QScriptValue &value, QSignalMapper* &out)
+{
+ out = qobject_cast<QSignalMapper*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QSignalMapper_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 1
+ , 1
+ , 1
+ , 1
+ , 2
+ , 2
+ , 2
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QSignalMapper*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QSignalMapper*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
+ for (int i = 0; i < 8; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QSignalMapper_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QSignalMapper_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<QSignalMapper*>(engine, qtscript_QSignalMapper_toScriptValue,
+ qtscript_QSignalMapper_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QSignalMapper_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QSize.cpp b/qtbindings/com_nokia_qt_core/qtscript_QSize.cpp
new file mode 100644
index 0000000..776745d
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QSize.cpp
@@ -0,0 +1,380 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qsize.h>
+#include <QVariant>
+#include <qdatastream.h>
+#include <qsize.h>
+
+static const char * const qtscript_QSize_function_names[] = {
+ "QSize"
+ // static
+ // prototype
+ , "boundedTo"
+ , "expandedTo"
+ , "height"
+ , "isEmpty"
+ , "isNull"
+ , "isValid"
+ , "operator_add_assign"
+ , "operator_divide_assign"
+ , "equals"
+ , "operator_multiply_assign"
+ , "operator_subtract_assign"
+ , "readFrom"
+ , "scale"
+ , "setHeight"
+ , "setWidth"
+ , "transpose"
+ , "width"
+ , "writeTo"
+ , "toString"
+};
+
+static const char * const qtscript_QSize_function_signatures[] = {
+ "\nint w, int h"
+ // static
+ // prototype
+ , "QSize arg__1"
+ , "QSize arg__1"
+ , ""
+ , ""
+ , ""
+ , ""
+ , "QSize arg__1"
+ , "qreal c"
+ , "QSize s2"
+ , "qreal c"
+ , "QSize arg__1"
+ , "QDataStream arg__1"
+ , "QSize s, AspectRatioMode mode\nint w, int h, AspectRatioMode mode"
+ , "int h"
+ , "int w"
+ , ""
+ , ""
+ , "QDataStream arg__1"
+""
+};
+
+static QScriptValue qtscript_QSize_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QSize::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QSize*)
+Q_DECLARE_METATYPE(QDataStream*)
+Q_DECLARE_METATYPE(Qt::AspectRatioMode)
+
+//
+// QSize
+//
+
+static QScriptValue qtscript_QSize_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 18;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QSize* _q_self = qscriptvalue_cast<QSize*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QSize.%0(): this object is not a QSize")
+ .arg(qtscript_QSize_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ QSize _q_arg0 = qscriptvalue_cast<QSize>(context->argument(0));
+ QSize _q_result = _q_self->boundedTo(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QSize _q_arg0 = qscriptvalue_cast<QSize>(context->argument(0));
+ QSize _q_result = _q_self->expandedTo(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->height();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isEmpty();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isNull();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isValid();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 1) {
+ QSize _q_arg0 = qscriptvalue_cast<QSize>(context->argument(0));
+ QSize _q_result = _q_self->operator+=(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ QSize _q_result = _q_self->operator/=(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 1) {
+ QSize _q_arg0 = qscriptvalue_cast<QSize>(context->argument(0));
+ bool _q_result = operator==(*_q_self, _q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ QSize _q_result = _q_self->operator*=(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 1) {
+ QSize _q_arg0 = qscriptvalue_cast<QSize>(context->argument(0));
+ QSize _q_result = _q_self->operator-=(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator>>(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 2) {
+ QSize _q_arg0 = qscriptvalue_cast<QSize>(context->argument(0));
+ Qt::AspectRatioMode _q_arg1 = qscriptvalue_cast<Qt::AspectRatioMode>(context->argument(1));
+ _q_self->scale(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 3) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ Qt::AspectRatioMode _q_arg2 = qscriptvalue_cast<Qt::AspectRatioMode>(context->argument(2));
+ _q_self->scale(_q_arg0, _q_arg1, _q_arg2);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setHeight(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setWidth(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 0) {
+ _q_self->transpose();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->width();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator<<(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 18: {
+ QString result;
+ QDebug d(&result);
+ d << *_q_self;
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QSize_throw_ambiguity_error_helper(context,
+ qtscript_QSize_function_names[_id+1],
+ qtscript_QSize_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QSize_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QSize(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QSize _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ QSize _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QSize_throw_ambiguity_error_helper(context,
+ qtscript_QSize_function_names[_id],
+ qtscript_QSize_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QSize_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 2
+ // static
+ // prototype
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 3
+ , 1
+ , 1
+ , 0
+ , 0
+ , 1
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QSize*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QSize*)0));
+ for (int i = 0; i < 19; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QSize_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QSize_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QSize>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QSize*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QSize_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QSizeF.cpp b/qtbindings/com_nokia_qt_core/qtscript_QSizeF.cpp
new file mode 100644
index 0000000..17ca9a0
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QSizeF.cpp
@@ -0,0 +1,395 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qsize.h>
+#include <QVariant>
+#include <qdatastream.h>
+#include <qsize.h>
+
+static const char * const qtscript_QSizeF_function_names[] = {
+ "QSizeF"
+ // static
+ // prototype
+ , "boundedTo"
+ , "expandedTo"
+ , "height"
+ , "isEmpty"
+ , "isNull"
+ , "isValid"
+ , "operator_add_assign"
+ , "operator_divide_assign"
+ , "equals"
+ , "operator_multiply_assign"
+ , "operator_subtract_assign"
+ , "readFrom"
+ , "scale"
+ , "setHeight"
+ , "setWidth"
+ , "toSize"
+ , "transpose"
+ , "width"
+ , "writeTo"
+ , "toString"
+};
+
+static const char * const qtscript_QSizeF_function_signatures[] = {
+ "\nQSize sz\nqreal w, qreal h"
+ // static
+ // prototype
+ , "QSizeF arg__1"
+ , "QSizeF arg__1"
+ , ""
+ , ""
+ , ""
+ , ""
+ , "QSizeF arg__1"
+ , "qreal c"
+ , "QSizeF s2"
+ , "qreal c"
+ , "QSizeF arg__1"
+ , "QDataStream arg__1"
+ , "QSizeF s, AspectRatioMode mode\nqreal w, qreal h, AspectRatioMode mode"
+ , "qreal h"
+ , "qreal w"
+ , ""
+ , ""
+ , ""
+ , "QDataStream arg__1"
+""
+};
+
+static QScriptValue qtscript_QSizeF_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QSizeF::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QSizeF*)
+Q_DECLARE_METATYPE(QDataStream*)
+Q_DECLARE_METATYPE(Qt::AspectRatioMode)
+
+//
+// QSizeF
+//
+
+static QScriptValue qtscript_QSizeF_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 19;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QSizeF* _q_self = qscriptvalue_cast<QSizeF*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QSizeF.%0(): this object is not a QSizeF")
+ .arg(qtscript_QSizeF_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ QSizeF _q_arg0 = qscriptvalue_cast<QSizeF>(context->argument(0));
+ QSizeF _q_result = _q_self->boundedTo(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QSizeF _q_arg0 = qscriptvalue_cast<QSizeF>(context->argument(0));
+ QSizeF _q_result = _q_self->expandedTo(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ qreal _q_result = _q_self->height();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isEmpty();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isNull();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isValid();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 1) {
+ QSizeF _q_arg0 = qscriptvalue_cast<QSizeF>(context->argument(0));
+ QSizeF _q_result = _q_self->operator+=(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ QSizeF _q_result = _q_self->operator/=(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 1) {
+ QSizeF _q_arg0 = qscriptvalue_cast<QSizeF>(context->argument(0));
+ bool _q_result = operator==(*_q_self, _q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ QSizeF _q_result = _q_self->operator*=(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 1) {
+ QSizeF _q_arg0 = qscriptvalue_cast<QSizeF>(context->argument(0));
+ QSizeF _q_result = _q_self->operator-=(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator>>(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 2) {
+ QSizeF _q_arg0 = qscriptvalue_cast<QSizeF>(context->argument(0));
+ Qt::AspectRatioMode _q_arg1 = qscriptvalue_cast<Qt::AspectRatioMode>(context->argument(1));
+ _q_self->scale(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 3) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ qreal _q_arg1 = qscriptvalue_cast<qreal>(context->argument(1));
+ Qt::AspectRatioMode _q_arg2 = qscriptvalue_cast<Qt::AspectRatioMode>(context->argument(2));
+ _q_self->scale(_q_arg0, _q_arg1, _q_arg2);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ _q_self->setHeight(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 1) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ _q_self->setWidth(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 0) {
+ QSize _q_result = _q_self->toSize();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 0) {
+ _q_self->transpose();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 0) {
+ qreal _q_result = _q_self->width();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator<<(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 19: {
+ QString result;
+ QDebug d(&result);
+ d << *_q_self;
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QSizeF_throw_ambiguity_error_helper(context,
+ qtscript_QSizeF_function_names[_id+1],
+ qtscript_QSizeF_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QSizeF_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QSizeF(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QSizeF _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QSize _q_arg0 = qscriptvalue_cast<QSize>(context->argument(0));
+ QSizeF _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 2) {
+ qreal _q_arg0 = qscriptvalue_cast<qreal>(context->argument(0));
+ qreal _q_arg1 = qscriptvalue_cast<qreal>(context->argument(1));
+ QSizeF _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QSizeF_throw_ambiguity_error_helper(context,
+ qtscript_QSizeF_function_names[_id],
+ qtscript_QSizeF_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QSizeF_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 2
+ // static
+ // prototype
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 3
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ , 1
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QSizeF*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QSizeF*)0));
+ for (int i = 0; i < 20; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QSizeF_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QSizeF_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QSizeF>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QSizeF*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QSizeF_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QSocketNotifier.cpp b/qtbindings/com_nokia_qt_core/qtscript_QSocketNotifier.cpp
new file mode 100644
index 0000000..64f3fde
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QSocketNotifier.cpp
@@ -0,0 +1,314 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qsocketnotifier.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qsocketnotifier.h>
+
+#include "qtscriptshell_QSocketNotifier.h"
+
+static const char * const qtscript_QSocketNotifier_function_names[] = {
+ "QSocketNotifier"
+ // static
+ // prototype
+ , "isEnabled"
+ , "socket"
+ , "type"
+ , "toString"
+};
+
+static const char * const qtscript_QSocketNotifier_function_signatures[] = {
+ "int socket, Type arg__2, QObject parent"
+ // static
+ // prototype
+ , ""
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QSocketNotifier_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QSocketNotifier::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QSocketNotifier*)
+Q_DECLARE_METATYPE(QtScriptShell_QSocketNotifier*)
+Q_DECLARE_METATYPE(QSocketNotifier::Type)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// QSocketNotifier::Type
+//
+
+static const QSocketNotifier::Type qtscript_QSocketNotifier_Type_values[] = {
+ QSocketNotifier::Read
+ , QSocketNotifier::Write
+ , QSocketNotifier::Exception
+};
+
+static const char * const qtscript_QSocketNotifier_Type_keys[] = {
+ "Read"
+ , "Write"
+ , "Exception"
+};
+
+static QString qtscript_QSocketNotifier_Type_toStringHelper(QSocketNotifier::Type value)
+{
+ if ((value >= QSocketNotifier::Read) && (value <= QSocketNotifier::Exception))
+ return qtscript_QSocketNotifier_Type_keys[static_cast<int>(value)-static_cast<int>(QSocketNotifier::Read)];
+ return QString();
+}
+
+static QScriptValue qtscript_QSocketNotifier_Type_toScriptValue(QScriptEngine *engine, const QSocketNotifier::Type &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QSocketNotifier"));
+ return clazz.property(qtscript_QSocketNotifier_Type_toStringHelper(value));
+}
+
+static void qtscript_QSocketNotifier_Type_fromScriptValue(const QScriptValue &value, QSocketNotifier::Type &out)
+{
+ out = qvariant_cast<QSocketNotifier::Type>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QSocketNotifier_Type(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QSocketNotifier::Read) && (arg <= QSocketNotifier::Exception))
+ return qScriptValueFromValue(engine, static_cast<QSocketNotifier::Type>(arg));
+ return context->throwError(QString::fromLatin1("Type(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QSocketNotifier_Type_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QSocketNotifier::Type value = qscriptvalue_cast<QSocketNotifier::Type>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QSocketNotifier_Type_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QSocketNotifier::Type value = qscriptvalue_cast<QSocketNotifier::Type>(context->thisObject());
+ return QScriptValue(engine, qtscript_QSocketNotifier_Type_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QSocketNotifier_Type_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QSocketNotifier_Type,
+ qtscript_QSocketNotifier_Type_valueOf, qtscript_QSocketNotifier_Type_toString);
+ qScriptRegisterMetaType<QSocketNotifier::Type>(engine, qtscript_QSocketNotifier_Type_toScriptValue,
+ qtscript_QSocketNotifier_Type_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QSocketNotifier_Type_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QSocketNotifier_Type_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QSocketNotifier
+//
+
+static QScriptValue qtscript_QSocketNotifier_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 3;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QSocketNotifier* _q_self = qscriptvalue_cast<QSocketNotifier*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QSocketNotifier.%0(): this object is not a QSocketNotifier")
+ .arg(qtscript_QSocketNotifier_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isEnabled();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->socket();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QSocketNotifier::Type _q_result = _q_self->type();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3: {
+ QString result = QString::fromLatin1("QSocketNotifier");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QSocketNotifier_throw_ambiguity_error_helper(context,
+ qtscript_QSocketNotifier_function_names[_id+1],
+ qtscript_QSocketNotifier_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QSocketNotifier_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QSocketNotifier(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QSocketNotifier::Type _q_arg1 = qscriptvalue_cast<QSocketNotifier::Type>(context->argument(1));
+ QtScriptShell_QSocketNotifier* _q_cpp_result = new QtScriptShell_QSocketNotifier(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QSocketNotifier*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 3) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QSocketNotifier::Type _q_arg1 = qscriptvalue_cast<QSocketNotifier::Type>(context->argument(1));
+ QObject* _q_arg2 = context->argument(2).toQObject();
+ QtScriptShell_QSocketNotifier* _q_cpp_result = new QtScriptShell_QSocketNotifier(_q_arg0, _q_arg1, _q_arg2);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QSocketNotifier*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QSocketNotifier_throw_ambiguity_error_helper(context,
+ qtscript_QSocketNotifier_function_names[_id],
+ qtscript_QSocketNotifier_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QSocketNotifier_toScriptValue(QScriptEngine *engine, QSocketNotifier* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QSocketNotifier_fromScriptValue(const QScriptValue &value, QSocketNotifier* &out)
+{
+ out = qobject_cast<QSocketNotifier*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QSocketNotifier_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 3
+ // static
+ // prototype
+ , 0
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QSocketNotifier*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QSocketNotifier*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
+ for (int i = 0; i < 4; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QSocketNotifier_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QSocketNotifier_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<QSocketNotifier*>(engine, qtscript_QSocketNotifier_toScriptValue,
+ qtscript_QSocketNotifier_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QSocketNotifier_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ ctor.setProperty(QString::fromLatin1("Type"),
+ qtscript_create_QSocketNotifier_Type_class(engine, ctor));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QStringMatcher.cpp b/qtbindings/com_nokia_qt_core/qtscript_QStringMatcher.cpp
new file mode 100644
index 0000000..bc705ba
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QStringMatcher.cpp
@@ -0,0 +1,282 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qstringmatcher.h>
+#include <QVariant>
+#include <qstringmatcher.h>
+
+static const char * const qtscript_QStringMatcher_function_names[] = {
+ "QStringMatcher"
+ // static
+ // prototype
+ , "caseSensitivity"
+ , "indexIn"
+ , "pattern"
+ , "setCaseSensitivity"
+ , "setPattern"
+ , "toString"
+};
+
+static const char * const qtscript_QStringMatcher_function_signatures[] = {
+ "\nchar uc, int len, CaseSensitivity cs\nString pattern, CaseSensitivity cs\nQStringMatcher other"
+ // static
+ // prototype
+ , ""
+ , "char str, int length, int from\nString str, int from"
+ , ""
+ , "CaseSensitivity cs"
+ , "String pattern"
+""
+};
+
+static QScriptValue qtscript_QStringMatcher_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QStringMatcher::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QStringMatcher)
+Q_DECLARE_METATYPE(QStringMatcher*)
+Q_DECLARE_METATYPE(Qt::CaseSensitivity)
+Q_DECLARE_METATYPE(QChar*)
+
+//
+// QStringMatcher
+//
+
+static QScriptValue qtscript_QStringMatcher_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 5;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QStringMatcher* _q_self = qscriptvalue_cast<QStringMatcher*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QStringMatcher.%0(): this object is not a QStringMatcher")
+ .arg(qtscript_QStringMatcher_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ Qt::CaseSensitivity _q_result = _q_self->caseSensitivity();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ int _q_result = _q_self->indexIn(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ if (qscriptvalue_cast<QChar*>(context->argument(0))
+ && context->argument(1).isNumber()) {
+ QChar* _q_arg0 = qscriptvalue_cast<QChar*>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_result = _q_self->indexIn(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isString()
+ && context->argument(1).isNumber()) {
+ QString _q_arg0 = context->argument(0).toString();
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_result = _q_self->indexIn(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 3) {
+ QChar* _q_arg0 = qscriptvalue_cast<QChar*>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_arg2 = context->argument(2).toInt32();
+ int _q_result = _q_self->indexIn(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->pattern();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ Qt::CaseSensitivity _q_arg0 = qscriptvalue_cast<Qt::CaseSensitivity>(context->argument(0));
+ _q_self->setCaseSensitivity(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setPattern(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 5: {
+ QString result = QString::fromLatin1("QStringMatcher");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QStringMatcher_throw_ambiguity_error_helper(context,
+ qtscript_QStringMatcher_function_names[_id+1],
+ qtscript_QStringMatcher_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QStringMatcher_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QStringMatcher(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QStringMatcher _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QStringMatcher _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if ((qMetaTypeId<QStringMatcher>() == context->argument(0).toVariant().userType())) {
+ QStringMatcher _q_arg0 = qscriptvalue_cast<QStringMatcher>(context->argument(0));
+ QStringMatcher _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 2) {
+ if (qscriptvalue_cast<QChar*>(context->argument(0))
+ && context->argument(1).isNumber()) {
+ QChar* _q_arg0 = qscriptvalue_cast<QChar*>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ QStringMatcher _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argument(0).isString()
+ && (qMetaTypeId<Qt::CaseSensitivity>() == context->argument(1).toVariant().userType())) {
+ QString _q_arg0 = context->argument(0).toString();
+ Qt::CaseSensitivity _q_arg1 = qscriptvalue_cast<Qt::CaseSensitivity>(context->argument(1));
+ QStringMatcher _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 3) {
+ QChar* _q_arg0 = qscriptvalue_cast<QChar*>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ Qt::CaseSensitivity _q_arg2 = qscriptvalue_cast<Qt::CaseSensitivity>(context->argument(2));
+ QStringMatcher _q_cpp_result(_q_arg0, _q_arg1, _q_arg2);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QStringMatcher_throw_ambiguity_error_helper(context,
+ qtscript_QStringMatcher_function_names[_id],
+ qtscript_QStringMatcher_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QStringMatcher_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 3
+ // static
+ // prototype
+ , 0
+ , 3
+ , 0
+ , 1
+ , 1
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QStringMatcher*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QStringMatcher*)0));
+ for (int i = 0; i < 6; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QStringMatcher_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QStringMatcher_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QStringMatcher>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QStringMatcher*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QStringMatcher_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QSystemSemaphore.cpp b/qtbindings/com_nokia_qt_core/qtscript_QSystemSemaphore.cpp
new file mode 100644
index 0000000..5879138
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QSystemSemaphore.cpp
@@ -0,0 +1,425 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qsystemsemaphore.h>
+#include <QVariant>
+#include <qsystemsemaphore.h>
+
+static const char * const qtscript_QSystemSemaphore_function_names[] = {
+ "QSystemSemaphore"
+ // static
+ // prototype
+ , "acquire"
+ , "error"
+ , "errorString"
+ , "key"
+ , "release"
+ , "setKey"
+ , "toString"
+};
+
+static const char * const qtscript_QSystemSemaphore_function_signatures[] = {
+ "String key, int initialValue, AccessMode mode"
+ // static
+ // prototype
+ , ""
+ , ""
+ , ""
+ , ""
+ , "int n"
+ , "String key, int initialValue, AccessMode mode"
+""
+};
+
+static QScriptValue qtscript_QSystemSemaphore_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QSystemSemaphore::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QSystemSemaphore*)
+Q_DECLARE_METATYPE(QSystemSemaphore::AccessMode)
+Q_DECLARE_METATYPE(QSystemSemaphore::SystemSemaphoreError)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// QSystemSemaphore::AccessMode
+//
+
+static const QSystemSemaphore::AccessMode qtscript_QSystemSemaphore_AccessMode_values[] = {
+ QSystemSemaphore::Open
+ , QSystemSemaphore::Create
+};
+
+static const char * const qtscript_QSystemSemaphore_AccessMode_keys[] = {
+ "Open"
+ , "Create"
+};
+
+static QString qtscript_QSystemSemaphore_AccessMode_toStringHelper(QSystemSemaphore::AccessMode value)
+{
+ if ((value >= QSystemSemaphore::Open) && (value <= QSystemSemaphore::Create))
+ return qtscript_QSystemSemaphore_AccessMode_keys[static_cast<int>(value)-static_cast<int>(QSystemSemaphore::Open)];
+ return QString();
+}
+
+static QScriptValue qtscript_QSystemSemaphore_AccessMode_toScriptValue(QScriptEngine *engine, const QSystemSemaphore::AccessMode &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QSystemSemaphore"));
+ return clazz.property(qtscript_QSystemSemaphore_AccessMode_toStringHelper(value));
+}
+
+static void qtscript_QSystemSemaphore_AccessMode_fromScriptValue(const QScriptValue &value, QSystemSemaphore::AccessMode &out)
+{
+ out = qvariant_cast<QSystemSemaphore::AccessMode>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QSystemSemaphore_AccessMode(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QSystemSemaphore::Open) && (arg <= QSystemSemaphore::Create))
+ return qScriptValueFromValue(engine, static_cast<QSystemSemaphore::AccessMode>(arg));
+ return context->throwError(QString::fromLatin1("AccessMode(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QSystemSemaphore_AccessMode_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QSystemSemaphore::AccessMode value = qscriptvalue_cast<QSystemSemaphore::AccessMode>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QSystemSemaphore_AccessMode_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QSystemSemaphore::AccessMode value = qscriptvalue_cast<QSystemSemaphore::AccessMode>(context->thisObject());
+ return QScriptValue(engine, qtscript_QSystemSemaphore_AccessMode_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QSystemSemaphore_AccessMode_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QSystemSemaphore_AccessMode,
+ qtscript_QSystemSemaphore_AccessMode_valueOf, qtscript_QSystemSemaphore_AccessMode_toString);
+ qScriptRegisterMetaType<QSystemSemaphore::AccessMode>(engine, qtscript_QSystemSemaphore_AccessMode_toScriptValue,
+ qtscript_QSystemSemaphore_AccessMode_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QSystemSemaphore_AccessMode_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QSystemSemaphore_AccessMode_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QSystemSemaphore::SystemSemaphoreError
+//
+
+static const QSystemSemaphore::SystemSemaphoreError qtscript_QSystemSemaphore_SystemSemaphoreError_values[] = {
+ QSystemSemaphore::NoError
+ , QSystemSemaphore::PermissionDenied
+ , QSystemSemaphore::KeyError
+ , QSystemSemaphore::AlreadyExists
+ , QSystemSemaphore::NotFound
+ , QSystemSemaphore::OutOfResources
+ , QSystemSemaphore::UnknownError
+};
+
+static const char * const qtscript_QSystemSemaphore_SystemSemaphoreError_keys[] = {
+ "NoError"
+ , "PermissionDenied"
+ , "KeyError"
+ , "AlreadyExists"
+ , "NotFound"
+ , "OutOfResources"
+ , "UnknownError"
+};
+
+static QString qtscript_QSystemSemaphore_SystemSemaphoreError_toStringHelper(QSystemSemaphore::SystemSemaphoreError value)
+{
+ if ((value >= QSystemSemaphore::NoError) && (value <= QSystemSemaphore::UnknownError))
+ return qtscript_QSystemSemaphore_SystemSemaphoreError_keys[static_cast<int>(value)-static_cast<int>(QSystemSemaphore::NoError)];
+ return QString();
+}
+
+static QScriptValue qtscript_QSystemSemaphore_SystemSemaphoreError_toScriptValue(QScriptEngine *engine, const QSystemSemaphore::SystemSemaphoreError &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QSystemSemaphore"));
+ return clazz.property(qtscript_QSystemSemaphore_SystemSemaphoreError_toStringHelper(value));
+}
+
+static void qtscript_QSystemSemaphore_SystemSemaphoreError_fromScriptValue(const QScriptValue &value, QSystemSemaphore::SystemSemaphoreError &out)
+{
+ out = qvariant_cast<QSystemSemaphore::SystemSemaphoreError>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QSystemSemaphore_SystemSemaphoreError(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QSystemSemaphore::NoError) && (arg <= QSystemSemaphore::UnknownError))
+ return qScriptValueFromValue(engine, static_cast<QSystemSemaphore::SystemSemaphoreError>(arg));
+ return context->throwError(QString::fromLatin1("SystemSemaphoreError(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QSystemSemaphore_SystemSemaphoreError_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QSystemSemaphore::SystemSemaphoreError value = qscriptvalue_cast<QSystemSemaphore::SystemSemaphoreError>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QSystemSemaphore_SystemSemaphoreError_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QSystemSemaphore::SystemSemaphoreError value = qscriptvalue_cast<QSystemSemaphore::SystemSemaphoreError>(context->thisObject());
+ return QScriptValue(engine, qtscript_QSystemSemaphore_SystemSemaphoreError_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QSystemSemaphore_SystemSemaphoreError_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QSystemSemaphore_SystemSemaphoreError,
+ qtscript_QSystemSemaphore_SystemSemaphoreError_valueOf, qtscript_QSystemSemaphore_SystemSemaphoreError_toString);
+ qScriptRegisterMetaType<QSystemSemaphore::SystemSemaphoreError>(engine, qtscript_QSystemSemaphore_SystemSemaphoreError_toScriptValue,
+ qtscript_QSystemSemaphore_SystemSemaphoreError_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 7; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QSystemSemaphore_SystemSemaphoreError_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QSystemSemaphore_SystemSemaphoreError_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QSystemSemaphore
+//
+
+static QScriptValue qtscript_QSystemSemaphore_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 6;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QSystemSemaphore* _q_self = qscriptvalue_cast<QSystemSemaphore*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QSystemSemaphore.%0(): this object is not a QSystemSemaphore")
+ .arg(qtscript_QSystemSemaphore_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->acquire();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QSystemSemaphore::SystemSemaphoreError _q_result = _q_self->error();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->errorString();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->key();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->release();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ bool _q_result = _q_self->release(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setKey(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ int _q_arg1 = context->argument(1).toInt32();
+ _q_self->setKey(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 3) {
+ QString _q_arg0 = context->argument(0).toString();
+ int _q_arg1 = context->argument(1).toInt32();
+ QSystemSemaphore::AccessMode _q_arg2 = qscriptvalue_cast<QSystemSemaphore::AccessMode>(context->argument(2));
+ _q_self->setKey(_q_arg0, _q_arg1, _q_arg2);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 6: {
+ QString result = QString::fromLatin1("QSystemSemaphore");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QSystemSemaphore_throw_ambiguity_error_helper(context,
+ qtscript_QSystemSemaphore_function_names[_id+1],
+ qtscript_QSystemSemaphore_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QSystemSemaphore_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QSystemSemaphore(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QSystemSemaphore* _q_cpp_result = new QSystemSemaphore(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ int _q_arg1 = context->argument(1).toInt32();
+ QSystemSemaphore* _q_cpp_result = new QSystemSemaphore(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 3) {
+ QString _q_arg0 = context->argument(0).toString();
+ int _q_arg1 = context->argument(1).toInt32();
+ QSystemSemaphore::AccessMode _q_arg2 = qscriptvalue_cast<QSystemSemaphore::AccessMode>(context->argument(2));
+ QSystemSemaphore* _q_cpp_result = new QSystemSemaphore(_q_arg0, _q_arg1, _q_arg2);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QSystemSemaphore_throw_ambiguity_error_helper(context,
+ qtscript_QSystemSemaphore_function_names[_id],
+ qtscript_QSystemSemaphore_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QSystemSemaphore_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 3
+ // static
+ // prototype
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 3
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QSystemSemaphore*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QSystemSemaphore*)0));
+ for (int i = 0; i < 7; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QSystemSemaphore_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QSystemSemaphore_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QSystemSemaphore*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QSystemSemaphore_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ ctor.setProperty(QString::fromLatin1("AccessMode"),
+ qtscript_create_QSystemSemaphore_AccessMode_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("SystemSemaphoreError"),
+ qtscript_create_QSystemSemaphore_SystemSemaphoreError_class(engine, ctor));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QTemporaryFile.cpp b/qtbindings/com_nokia_qt_core/qtscript_QTemporaryFile.cpp
new file mode 100644
index 0000000..3e2c034
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QTemporaryFile.cpp
@@ -0,0 +1,298 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qtemporaryfile.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qfile.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qtemporaryfile.h>
+
+#include "qtscriptshell_QTemporaryFile.h"
+
+static const char * const qtscript_QTemporaryFile_function_names[] = {
+ "QTemporaryFile"
+ // static
+ , "createLocalFile"
+ // prototype
+ , "autoRemove"
+ , "fileTemplate"
+ , "open"
+ , "setAutoRemove"
+ , "setFileTemplate"
+ , "uniqueFilename"
+ , "toString"
+};
+
+static const char * const qtscript_QTemporaryFile_function_signatures[] = {
+ "\nQObject parent\nString templateName\nString templateName, QObject parent"
+ // static
+ , "QFile file\nString fileName"
+ // prototype
+ , ""
+ , ""
+ , ""
+ , "bool b"
+ , "String name"
+ , ""
+""
+};
+
+static QScriptValue qtscript_QTemporaryFile_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QTemporaryFile::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QTemporaryFile*)
+Q_DECLARE_METATYPE(QtScriptShell_QTemporaryFile*)
+Q_DECLARE_METATYPE(QFile*)
+
+//
+// QTemporaryFile
+//
+
+static QScriptValue qtscript_QTemporaryFile_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 6;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QTemporaryFile* _q_self = qscriptvalue_cast<QTemporaryFile*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QTemporaryFile.%0(): this object is not a QTemporaryFile")
+ .arg(qtscript_QTemporaryFile_function_names[_id+2]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->autoRemove();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->fileTemplate();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->open();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ bool _q_arg0 = context->argument(0).toBoolean();
+ _q_self->setAutoRemove(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setFileTemplate(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->fileName();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6: {
+ QString result = QString::fromLatin1("QTemporaryFile");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTemporaryFile_throw_ambiguity_error_helper(context,
+ qtscript_QTemporaryFile_function_names[_id+2],
+ qtscript_QTemporaryFile_function_signatures[_id+2]);
+}
+
+static QScriptValue qtscript_QTemporaryFile_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QTemporaryFile(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QTemporaryFile* _q_cpp_result = new QtScriptShell_QTemporaryFile();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QTemporaryFile*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ if (context->argument(0).isQObject()) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QtScriptShell_QTemporaryFile* _q_cpp_result = new QtScriptShell_QTemporaryFile(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QTemporaryFile*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QtScriptShell_QTemporaryFile* _q_cpp_result = new QtScriptShell_QTemporaryFile(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QTemporaryFile*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QObject* _q_arg1 = context->argument(1).toQObject();
+ QtScriptShell_QTemporaryFile* _q_cpp_result = new QtScriptShell_QTemporaryFile(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QTemporaryFile*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ if (qscriptvalue_cast<QFile*>(context->argument(0))) {
+
+ QFile & _q_arg0 = *qscriptvalue_cast<QFile*>(context->argument(0));
+ QTemporaryFile* _q_result = QTemporaryFile::createLocalFile(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ } else if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QTemporaryFile* _q_result = QTemporaryFile::createLocalFile(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTemporaryFile_throw_ambiguity_error_helper(context,
+ qtscript_QTemporaryFile_function_names[_id],
+ qtscript_QTemporaryFile_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QTemporaryFile_toScriptValue(QScriptEngine *engine, QTemporaryFile* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QTemporaryFile_fromScriptValue(const QScriptValue &value, QTemporaryFile* &out)
+{
+ out = qobject_cast<QTemporaryFile*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QTemporaryFile_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 2
+ // static
+ , 1
+ // prototype
+ , 0
+ , 0
+ , 0
+ , 1
+ , 1
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QTemporaryFile*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QTemporaryFile*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QFile*>()));
+ for (int i = 0; i < 7; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QTemporaryFile_prototype_call, function_lengths[i+2]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QTemporaryFile_function_names[i+2]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<QTemporaryFile*>(engine, qtscript_QTemporaryFile_toScriptValue,
+ qtscript_QTemporaryFile_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QTemporaryFile_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 1; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QTemporaryFile_static_call,
+ function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_QTemporaryFile_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QTextBoundaryFinder.cpp b/qtbindings/com_nokia_qt_core/qtscript_QTextBoundaryFinder.cpp
new file mode 100644
index 0000000..91ade36
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QTextBoundaryFinder.cpp
@@ -0,0 +1,548 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qtextboundaryfinder.h>
+#include <QVariant>
+#include <qtextboundaryfinder.h>
+
+static const char * const qtscript_QTextBoundaryFinder_function_names[] = {
+ "QTextBoundaryFinder"
+ // static
+ // prototype
+ , "boundaryReasons"
+ , "isAtBoundary"
+ , "isValid"
+ , "position"
+ , "setPosition"
+ , "string"
+ , "toEnd"
+ , "toNextBoundary"
+ , "toPreviousBoundary"
+ , "toStart"
+ , "type"
+ , "toString"
+};
+
+static const char * const qtscript_QTextBoundaryFinder_function_signatures[] = {
+ "\nBoundaryType type, String string\nQTextBoundaryFinder other"
+ // static
+ // prototype
+ , ""
+ , ""
+ , ""
+ , ""
+ , "int position"
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QTextBoundaryFinder_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QTextBoundaryFinder::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QTextBoundaryFinder)
+Q_DECLARE_METATYPE(QTextBoundaryFinder*)
+Q_DECLARE_METATYPE(QTextBoundaryFinder::BoundaryReason)
+Q_DECLARE_METATYPE(QFlags<QTextBoundaryFinder::BoundaryReason>)
+Q_DECLARE_METATYPE(QTextBoundaryFinder::BoundaryType)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+static QScriptValue qtscript_create_flags_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString,
+ QScriptEngine::FunctionSignature equals)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("equals"),
+ engine->newFunction(equals), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto);
+}
+
+//
+// QTextBoundaryFinder::BoundaryReason
+//
+
+static const QTextBoundaryFinder::BoundaryReason qtscript_QTextBoundaryFinder_BoundaryReason_values[] = {
+ QTextBoundaryFinder::NotAtBoundary
+ , QTextBoundaryFinder::StartWord
+ , QTextBoundaryFinder::EndWord
+};
+
+static const char * const qtscript_QTextBoundaryFinder_BoundaryReason_keys[] = {
+ "NotAtBoundary"
+ , "StartWord"
+ , "EndWord"
+};
+
+static QString qtscript_QTextBoundaryFinder_BoundaryReason_toStringHelper(QTextBoundaryFinder::BoundaryReason value)
+{
+ if ((value >= QTextBoundaryFinder::NotAtBoundary) && (value <= QTextBoundaryFinder::EndWord))
+ return qtscript_QTextBoundaryFinder_BoundaryReason_keys[static_cast<int>(value)-static_cast<int>(QTextBoundaryFinder::NotAtBoundary)];
+ return QString();
+}
+
+static QScriptValue qtscript_QTextBoundaryFinder_BoundaryReason_toScriptValue(QScriptEngine *engine, const QTextBoundaryFinder::BoundaryReason &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QTextBoundaryFinder"));
+ return clazz.property(qtscript_QTextBoundaryFinder_BoundaryReason_toStringHelper(value));
+}
+
+static void qtscript_QTextBoundaryFinder_BoundaryReason_fromScriptValue(const QScriptValue &value, QTextBoundaryFinder::BoundaryReason &out)
+{
+ out = qvariant_cast<QTextBoundaryFinder::BoundaryReason>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QTextBoundaryFinder_BoundaryReason(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QTextBoundaryFinder::NotAtBoundary) && (arg <= QTextBoundaryFinder::EndWord))
+ return qScriptValueFromValue(engine, static_cast<QTextBoundaryFinder::BoundaryReason>(arg));
+ return context->throwError(QString::fromLatin1("BoundaryReason(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QTextBoundaryFinder_BoundaryReason_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextBoundaryFinder::BoundaryReason value = qscriptvalue_cast<QTextBoundaryFinder::BoundaryReason>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QTextBoundaryFinder_BoundaryReason_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextBoundaryFinder::BoundaryReason value = qscriptvalue_cast<QTextBoundaryFinder::BoundaryReason>(context->thisObject());
+ return QScriptValue(engine, qtscript_QTextBoundaryFinder_BoundaryReason_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QTextBoundaryFinder_BoundaryReason_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QTextBoundaryFinder_BoundaryReason,
+ qtscript_QTextBoundaryFinder_BoundaryReason_valueOf, qtscript_QTextBoundaryFinder_BoundaryReason_toString);
+ qScriptRegisterMetaType<QTextBoundaryFinder::BoundaryReason>(engine, qtscript_QTextBoundaryFinder_BoundaryReason_toScriptValue,
+ qtscript_QTextBoundaryFinder_BoundaryReason_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QTextBoundaryFinder_BoundaryReason_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QTextBoundaryFinder_BoundaryReason_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QTextBoundaryFinder::BoundaryReasons
+//
+
+static QScriptValue qtscript_QTextBoundaryFinder_BoundaryReasons_toScriptValue(QScriptEngine *engine, const QTextBoundaryFinder::BoundaryReasons &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_QTextBoundaryFinder_BoundaryReasons_fromScriptValue(const QScriptValue &value, QTextBoundaryFinder::BoundaryReasons &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<QTextBoundaryFinder::BoundaryReasons>())
+ out = qvariant_cast<QTextBoundaryFinder::BoundaryReasons>(var);
+ else if (var.userType() == qMetaTypeId<QTextBoundaryFinder::BoundaryReason>())
+ out = qvariant_cast<QTextBoundaryFinder::BoundaryReason>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_QTextBoundaryFinder_BoundaryReasons(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextBoundaryFinder::BoundaryReasons result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<QTextBoundaryFinder::BoundaryReasons>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<QTextBoundaryFinder::BoundaryReason>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("BoundaryReasons(): argument %0 is not of type BoundaryReason").arg(i));
+ }
+ result |= qvariant_cast<QTextBoundaryFinder::BoundaryReason>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_QTextBoundaryFinder_BoundaryReasons_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextBoundaryFinder::BoundaryReasons value = qscriptvalue_cast<QTextBoundaryFinder::BoundaryReasons>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QTextBoundaryFinder_BoundaryReasons_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextBoundaryFinder::BoundaryReasons value = qscriptvalue_cast<QTextBoundaryFinder::BoundaryReasons>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 3; ++i) {
+ if ((value & qtscript_QTextBoundaryFinder_BoundaryReason_values[i]) == qtscript_QTextBoundaryFinder_BoundaryReason_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_QTextBoundaryFinder_BoundaryReason_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_QTextBoundaryFinder_BoundaryReasons_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<QTextBoundaryFinder::BoundaryReasons>() == otherObj.value<QTextBoundaryFinder::BoundaryReasons>())));
+}
+
+static QScriptValue qtscript_create_QTextBoundaryFinder_BoundaryReasons_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_QTextBoundaryFinder_BoundaryReasons, qtscript_QTextBoundaryFinder_BoundaryReasons_valueOf,
+ qtscript_QTextBoundaryFinder_BoundaryReasons_toString, qtscript_QTextBoundaryFinder_BoundaryReasons_equals);
+ qScriptRegisterMetaType<QTextBoundaryFinder::BoundaryReasons>(engine, qtscript_QTextBoundaryFinder_BoundaryReasons_toScriptValue,
+ qtscript_QTextBoundaryFinder_BoundaryReasons_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// QTextBoundaryFinder::BoundaryType
+//
+
+static const QTextBoundaryFinder::BoundaryType qtscript_QTextBoundaryFinder_BoundaryType_values[] = {
+ QTextBoundaryFinder::Grapheme
+ , QTextBoundaryFinder::Word
+ , QTextBoundaryFinder::Line
+ , QTextBoundaryFinder::Sentence
+};
+
+static const char * const qtscript_QTextBoundaryFinder_BoundaryType_keys[] = {
+ "Grapheme"
+ , "Word"
+ , "Line"
+ , "Sentence"
+};
+
+static QString qtscript_QTextBoundaryFinder_BoundaryType_toStringHelper(QTextBoundaryFinder::BoundaryType value)
+{
+ if ((value >= QTextBoundaryFinder::Grapheme) && (value <= QTextBoundaryFinder::Sentence))
+ return qtscript_QTextBoundaryFinder_BoundaryType_keys[static_cast<int>(value)-static_cast<int>(QTextBoundaryFinder::Grapheme)];
+ return QString();
+}
+
+static QScriptValue qtscript_QTextBoundaryFinder_BoundaryType_toScriptValue(QScriptEngine *engine, const QTextBoundaryFinder::BoundaryType &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QTextBoundaryFinder"));
+ return clazz.property(qtscript_QTextBoundaryFinder_BoundaryType_toStringHelper(value));
+}
+
+static void qtscript_QTextBoundaryFinder_BoundaryType_fromScriptValue(const QScriptValue &value, QTextBoundaryFinder::BoundaryType &out)
+{
+ out = qvariant_cast<QTextBoundaryFinder::BoundaryType>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QTextBoundaryFinder_BoundaryType(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QTextBoundaryFinder::Grapheme) && (arg <= QTextBoundaryFinder::Sentence))
+ return qScriptValueFromValue(engine, static_cast<QTextBoundaryFinder::BoundaryType>(arg));
+ return context->throwError(QString::fromLatin1("BoundaryType(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QTextBoundaryFinder_BoundaryType_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextBoundaryFinder::BoundaryType value = qscriptvalue_cast<QTextBoundaryFinder::BoundaryType>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QTextBoundaryFinder_BoundaryType_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextBoundaryFinder::BoundaryType value = qscriptvalue_cast<QTextBoundaryFinder::BoundaryType>(context->thisObject());
+ return QScriptValue(engine, qtscript_QTextBoundaryFinder_BoundaryType_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QTextBoundaryFinder_BoundaryType_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QTextBoundaryFinder_BoundaryType,
+ qtscript_QTextBoundaryFinder_BoundaryType_valueOf, qtscript_QTextBoundaryFinder_BoundaryType_toString);
+ qScriptRegisterMetaType<QTextBoundaryFinder::BoundaryType>(engine, qtscript_QTextBoundaryFinder_BoundaryType_toScriptValue,
+ qtscript_QTextBoundaryFinder_BoundaryType_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 4; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QTextBoundaryFinder_BoundaryType_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QTextBoundaryFinder_BoundaryType_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QTextBoundaryFinder
+//
+
+static QScriptValue qtscript_QTextBoundaryFinder_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 11;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QTextBoundaryFinder* _q_self = qscriptvalue_cast<QTextBoundaryFinder*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QTextBoundaryFinder.%0(): this object is not a QTextBoundaryFinder")
+ .arg(qtscript_QTextBoundaryFinder_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ QFlags<QTextBoundaryFinder::BoundaryReason> _q_result = _q_self->boundaryReasons();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isAtBoundary();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isValid();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->position();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setPosition(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->string();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ _q_self->toEnd();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->toNextBoundary();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->toPreviousBoundary();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 0) {
+ _q_self->toStart();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 0) {
+ QTextBoundaryFinder::BoundaryType _q_result = _q_self->type();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11: {
+ QString result = QString::fromLatin1("QTextBoundaryFinder");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTextBoundaryFinder_throw_ambiguity_error_helper(context,
+ qtscript_QTextBoundaryFinder_function_names[_id+1],
+ qtscript_QTextBoundaryFinder_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QTextBoundaryFinder_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QTextBoundaryFinder(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QTextBoundaryFinder _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QTextBoundaryFinder _q_arg0 = qscriptvalue_cast<QTextBoundaryFinder>(context->argument(0));
+ QTextBoundaryFinder _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 2) {
+ QTextBoundaryFinder::BoundaryType _q_arg0 = qscriptvalue_cast<QTextBoundaryFinder::BoundaryType>(context->argument(0));
+ QString _q_arg1 = context->argument(1).toString();
+ QTextBoundaryFinder _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTextBoundaryFinder_throw_ambiguity_error_helper(context,
+ qtscript_QTextBoundaryFinder_function_names[_id],
+ qtscript_QTextBoundaryFinder_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QTextBoundaryFinder_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 2
+ // static
+ // prototype
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QTextBoundaryFinder*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QTextBoundaryFinder*)0));
+ for (int i = 0; i < 12; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QTextBoundaryFinder_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QTextBoundaryFinder_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QTextBoundaryFinder>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QTextBoundaryFinder*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QTextBoundaryFinder_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ ctor.setProperty(QString::fromLatin1("BoundaryReason"),
+ qtscript_create_QTextBoundaryFinder_BoundaryReason_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("BoundaryReasons"),
+ qtscript_create_QTextBoundaryFinder_BoundaryReasons_class(engine));
+ ctor.setProperty(QString::fromLatin1("BoundaryType"),
+ qtscript_create_QTextBoundaryFinder_BoundaryType_class(engine, ctor));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QTextCodec.cpp b/qtbindings/com_nokia_qt_core/qtscript_QTextCodec.cpp
new file mode 100644
index 0000000..8537773
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QTextCodec.cpp
@@ -0,0 +1,575 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qtextcodec.h>
+#include <QTextCodec>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qlist.h>
+#include <qtextcodec.h>
+
+#include "qtscriptshell_QTextCodec.h"
+
+static const char * const qtscript_QTextCodec_function_names[] = {
+ "QTextCodec"
+ // static
+ , "availableCodecs"
+ , "availableMibs"
+ , "codecForCStrings"
+ , "codecForHtml"
+ , "codecForLocale"
+ , "codecForMib"
+ , "codecForName"
+ , "setCodecForCStrings"
+ , "setCodecForLocale"
+ , "setCodecForTr"
+ // prototype
+ , "aliases"
+ , "canEncode"
+ , "fromUnicode"
+ , "makeDecoder"
+ , "makeEncoder"
+ , "mibEnum"
+ , "name"
+ , "toUnicode"
+ , "toString"
+};
+
+static const char * const qtscript_QTextCodec_function_signatures[] = {
+ ""
+ // static
+ , ""
+ , ""
+ , ""
+ , "QByteArray ba\nQByteArray ba, QTextCodec defaultCodec"
+ , ""
+ , "int mib"
+ , "QByteArray name\nchar name"
+ , "QTextCodec c"
+ , "QTextCodec c"
+ , "QTextCodec c"
+ // prototype
+ , ""
+ , "char arg__1\nString arg__1"
+ , "String uc"
+ , ""
+ , ""
+ , ""
+ , ""
+ , "QByteArray arg__1"
+""
+};
+
+static QScriptValue qtscript_QTextCodec_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QTextCodec::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QTextCodec*)
+Q_DECLARE_METATYPE(QtScriptShell_QTextCodec*)
+Q_DECLARE_METATYPE(QTextCodec::ConversionFlag)
+Q_DECLARE_METATYPE(QFlags<QTextCodec::ConversionFlag>)
+Q_DECLARE_METATYPE(QList<QByteArray>)
+Q_DECLARE_METATYPE(QTextDecoder*)
+Q_DECLARE_METATYPE(QTextEncoder*)
+Q_DECLARE_METATYPE(QList<int>)
+Q_DECLARE_METATYPE(char*)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+static QScriptValue qtscript_create_flags_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString,
+ QScriptEngine::FunctionSignature equals)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("equals"),
+ engine->newFunction(equals), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto);
+}
+
+//
+// QTextCodec::ConversionFlag
+//
+
+static const QTextCodec::ConversionFlag qtscript_QTextCodec_ConversionFlag_values[] = {
+ QTextCodec::ConvertInvalidToNull
+ , QTextCodec::DefaultConversion
+ , QTextCodec::IgnoreHeader
+ , QTextCodec::FreeFunction
+};
+
+static const char * const qtscript_QTextCodec_ConversionFlag_keys[] = {
+ "ConvertInvalidToNull"
+ , "DefaultConversion"
+ , "IgnoreHeader"
+ , "FreeFunction"
+};
+
+static QString qtscript_QTextCodec_ConversionFlag_toStringHelper(QTextCodec::ConversionFlag value)
+{
+ for (int i = 0; i < 4; ++i) {
+ if (qtscript_QTextCodec_ConversionFlag_values[i] == value)
+ return QString::fromLatin1(qtscript_QTextCodec_ConversionFlag_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_QTextCodec_ConversionFlag_toScriptValue(QScriptEngine *engine, const QTextCodec::ConversionFlag &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QTextCodec"));
+ return clazz.property(qtscript_QTextCodec_ConversionFlag_toStringHelper(value));
+}
+
+static void qtscript_QTextCodec_ConversionFlag_fromScriptValue(const QScriptValue &value, QTextCodec::ConversionFlag &out)
+{
+ out = qvariant_cast<QTextCodec::ConversionFlag>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QTextCodec_ConversionFlag(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 4; ++i) {
+ if (qtscript_QTextCodec_ConversionFlag_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<QTextCodec::ConversionFlag>(arg));
+ }
+ return context->throwError(QString::fromLatin1("ConversionFlag(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QTextCodec_ConversionFlag_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextCodec::ConversionFlag value = qscriptvalue_cast<QTextCodec::ConversionFlag>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QTextCodec_ConversionFlag_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextCodec::ConversionFlag value = qscriptvalue_cast<QTextCodec::ConversionFlag>(context->thisObject());
+ return QScriptValue(engine, qtscript_QTextCodec_ConversionFlag_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QTextCodec_ConversionFlag_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QTextCodec_ConversionFlag,
+ qtscript_QTextCodec_ConversionFlag_valueOf, qtscript_QTextCodec_ConversionFlag_toString);
+ qScriptRegisterMetaType<QTextCodec::ConversionFlag>(engine, qtscript_QTextCodec_ConversionFlag_toScriptValue,
+ qtscript_QTextCodec_ConversionFlag_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 4; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QTextCodec_ConversionFlag_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QTextCodec_ConversionFlag_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QTextCodec::ConversionFlags
+//
+
+static QScriptValue qtscript_QTextCodec_ConversionFlags_toScriptValue(QScriptEngine *engine, const QTextCodec::ConversionFlags &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_QTextCodec_ConversionFlags_fromScriptValue(const QScriptValue &value, QTextCodec::ConversionFlags &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<QTextCodec::ConversionFlags>())
+ out = qvariant_cast<QTextCodec::ConversionFlags>(var);
+ else if (var.userType() == qMetaTypeId<QTextCodec::ConversionFlag>())
+ out = qvariant_cast<QTextCodec::ConversionFlag>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_QTextCodec_ConversionFlags(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextCodec::ConversionFlags result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<QTextCodec::ConversionFlags>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<QTextCodec::ConversionFlag>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("ConversionFlags(): argument %0 is not of type ConversionFlag").arg(i));
+ }
+ result |= qvariant_cast<QTextCodec::ConversionFlag>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_QTextCodec_ConversionFlags_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextCodec::ConversionFlags value = qscriptvalue_cast<QTextCodec::ConversionFlags>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QTextCodec_ConversionFlags_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextCodec::ConversionFlags value = qscriptvalue_cast<QTextCodec::ConversionFlags>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 4; ++i) {
+ if ((value & qtscript_QTextCodec_ConversionFlag_values[i]) == qtscript_QTextCodec_ConversionFlag_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_QTextCodec_ConversionFlag_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_QTextCodec_ConversionFlags_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<QTextCodec::ConversionFlags>() == otherObj.value<QTextCodec::ConversionFlags>())));
+}
+
+static QScriptValue qtscript_create_QTextCodec_ConversionFlags_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_QTextCodec_ConversionFlags, qtscript_QTextCodec_ConversionFlags_valueOf,
+ qtscript_QTextCodec_ConversionFlags_toString, qtscript_QTextCodec_ConversionFlags_equals);
+ qScriptRegisterMetaType<QTextCodec::ConversionFlags>(engine, qtscript_QTextCodec_ConversionFlags_toScriptValue,
+ qtscript_QTextCodec_ConversionFlags_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// QTextCodec
+//
+
+static QScriptValue qtscript_QTextCodec_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 8;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QTextCodec* _q_self = qscriptvalue_cast<QTextCodec*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QTextCodec.%0(): this object is not a QTextCodec")
+ .arg(qtscript_QTextCodec_function_names[_id+11]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ QList<QByteArray> _q_result = _q_self->aliases();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QChar>() == context->argument(0).toVariant().userType())) {
+ QChar _q_arg0 = qscriptvalue_cast<QChar>(context->argument(0));
+ bool _q_result = _q_self->canEncode(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->canEncode(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QByteArray _q_result = _q_self->fromUnicode(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QTextDecoder* _q_result = _q_self->makeDecoder();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ QTextEncoder* _q_result = _q_self->makeEncoder();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->mibEnum();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->name();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QString _q_result = _q_self->toUnicode(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8: {
+ QString result = QString::fromLatin1("QTextCodec");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTextCodec_throw_ambiguity_error_helper(context,
+ qtscript_QTextCodec_function_names[_id+11],
+ qtscript_QTextCodec_function_signatures[_id+11]);
+}
+
+static QScriptValue qtscript_QTextCodec_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QTextCodec cannot be constructed"));
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QList<QByteArray> _q_result = QTextCodec::availableCodecs();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QList<int> _q_result = QTextCodec::availableMibs();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QTextCodec* _q_result = QTextCodec::codecForCStrings();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QTextCodec* _q_result = QTextCodec::codecForHtml(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QTextCodec* _q_arg1 = qscriptvalue_cast<QTextCodec*>(context->argument(1));
+ QTextCodec* _q_result = QTextCodec::codecForHtml(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QTextCodec* _q_result = QTextCodec::codecForLocale();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QTextCodec* _q_result = QTextCodec::codecForMib(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QTextCodec* _q_result = QTextCodec::codecForName(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ } else if (qscriptvalue_cast<char*>(context->argument(0))) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ QTextCodec* _q_result = QTextCodec::codecForName(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 1) {
+ QTextCodec* _q_arg0 = qscriptvalue_cast<QTextCodec*>(context->argument(0));
+ QTextCodec::setCodecForCStrings(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 1) {
+ QTextCodec* _q_arg0 = qscriptvalue_cast<QTextCodec*>(context->argument(0));
+ QTextCodec::setCodecForLocale(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 1) {
+ QTextCodec* _q_arg0 = qscriptvalue_cast<QTextCodec*>(context->argument(0));
+ QTextCodec::setCodecForTr(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTextCodec_throw_ambiguity_error_helper(context,
+ qtscript_QTextCodec_function_names[_id],
+ qtscript_QTextCodec_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QTextCodec_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 0
+ // static
+ , 0
+ , 0
+ , 0
+ , 2
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ // prototype
+ , 0
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QTextCodec*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QTextCodec*)0));
+ for (int i = 0; i < 9; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QTextCodec_prototype_call, function_lengths[i+11]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QTextCodec_function_names[i+11]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QTextCodec*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QTextCodec_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 10; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QTextCodec_static_call,
+ function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_QTextCodec_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ ctor.setProperty(QString::fromLatin1("ConversionFlag"),
+ qtscript_create_QTextCodec_ConversionFlag_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ConversionFlags"),
+ qtscript_create_QTextCodec_ConversionFlags_class(engine));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QTextCodecPlugin.cpp b/qtbindings/com_nokia_qt_core/qtscript_QTextCodecPlugin.cpp
new file mode 100644
index 0000000..2c3b098
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QTextCodecPlugin.cpp
@@ -0,0 +1,250 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qtextcodecplugin.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qstringlist.h>
+#include <qtextcodec.h>
+
+#include "qtscriptshell_QTextCodecPlugin.h"
+
+static const char * const qtscript_QTextCodecPlugin_function_names[] = {
+ "QTextCodecPlugin"
+ // static
+ // prototype
+ , "aliases"
+ , "createForMib"
+ , "createForName"
+ , "mibEnums"
+ , "names"
+ , "toString"
+};
+
+static const char * const qtscript_QTextCodecPlugin_function_signatures[] = {
+ "QObject parent"
+ // static
+ // prototype
+ , ""
+ , "int mib"
+ , "QByteArray name"
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QTextCodecPlugin_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QTextCodecPlugin::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QTextCodecPlugin*)
+Q_DECLARE_METATYPE(QtScriptShell_QTextCodecPlugin*)
+Q_DECLARE_METATYPE(QList<QByteArray>)
+Q_DECLARE_METATYPE(QTextCodec*)
+Q_DECLARE_METATYPE(QList<int>)
+
+//
+// QTextCodecPlugin
+//
+
+static QScriptValue qtscript_QTextCodecPlugin_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 5;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QTextCodecPlugin* _q_self = qscriptvalue_cast<QTextCodecPlugin*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QTextCodecPlugin.%0(): this object is not a QTextCodecPlugin")
+ .arg(qtscript_QTextCodecPlugin_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ QList<QByteArray> _q_result = _q_self->aliases();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QTextCodec* _q_result = _q_self->createForMib(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QTextCodec* _q_result = _q_self->createForName(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QList<int> _q_result = _q_self->mibEnums();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ QList<QByteArray> _q_result = _q_self->names();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 5: {
+ QString result = QString::fromLatin1("QTextCodecPlugin");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTextCodecPlugin_throw_ambiguity_error_helper(context,
+ qtscript_QTextCodecPlugin_function_names[_id+1],
+ qtscript_QTextCodecPlugin_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QTextCodecPlugin_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QTextCodecPlugin(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QTextCodecPlugin* _q_cpp_result = new QtScriptShell_QTextCodecPlugin();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QTextCodecPlugin*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QtScriptShell_QTextCodecPlugin* _q_cpp_result = new QtScriptShell_QTextCodecPlugin(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QTextCodecPlugin*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTextCodecPlugin_throw_ambiguity_error_helper(context,
+ qtscript_QTextCodecPlugin_function_names[_id],
+ qtscript_QTextCodecPlugin_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QTextCodecPlugin_toScriptValue(QScriptEngine *engine, QTextCodecPlugin* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QTextCodecPlugin_fromScriptValue(const QScriptValue &value, QTextCodecPlugin* &out)
+{
+ out = qobject_cast<QTextCodecPlugin*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QTextCodecPlugin_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 0
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QTextCodecPlugin*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QTextCodecPlugin*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
+ for (int i = 0; i < 6; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QTextCodecPlugin_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QTextCodecPlugin_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<QTextCodecPlugin*>(engine, qtscript_QTextCodecPlugin_toScriptValue,
+ qtscript_QTextCodecPlugin_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QTextCodecPlugin_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QTextDecoder.cpp b/qtbindings/com_nokia_qt_core/qtscript_QTextDecoder.cpp
new file mode 100644
index 0000000..c766bc5
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QTextDecoder.cpp
@@ -0,0 +1,192 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qtextcodec.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qtextcodec.h>
+
+static const char * const qtscript_QTextDecoder_function_names[] = {
+ "QTextDecoder"
+ // static
+ // prototype
+ , "hasFailure"
+ , "toUnicode"
+ , "toString"
+};
+
+static const char * const qtscript_QTextDecoder_function_signatures[] = {
+ "QTextCodec codec"
+ // static
+ // prototype
+ , ""
+ , "QByteArray ba"
+""
+};
+
+static QScriptValue qtscript_QTextDecoder_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QTextDecoder::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QTextDecoder*)
+Q_DECLARE_METATYPE(QTextCodec*)
+
+//
+// QTextDecoder
+//
+
+static QScriptValue qtscript_QTextDecoder_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 2;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QTextDecoder* _q_self = qscriptvalue_cast<QTextDecoder*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QTextDecoder.%0(): this object is not a QTextDecoder")
+ .arg(qtscript_QTextDecoder_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->hasFailure();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QString _q_result = _q_self->toUnicode(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2: {
+ QString result = QString::fromLatin1("QTextDecoder");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTextDecoder_throw_ambiguity_error_helper(context,
+ qtscript_QTextDecoder_function_names[_id+1],
+ qtscript_QTextDecoder_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QTextDecoder_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QTextDecoder(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 1) {
+ QTextCodec* _q_arg0 = qscriptvalue_cast<QTextCodec*>(context->argument(0));
+ QTextDecoder* _q_cpp_result = new QTextDecoder(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTextDecoder_throw_ambiguity_error_helper(context,
+ qtscript_QTextDecoder_function_names[_id],
+ qtscript_QTextDecoder_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QTextDecoder_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 0
+ , 1
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QTextDecoder*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QTextDecoder*)0));
+ for (int i = 0; i < 3; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QTextDecoder_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QTextDecoder_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QTextDecoder*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QTextDecoder_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QTextEncoder.cpp b/qtbindings/com_nokia_qt_core/qtscript_QTextEncoder.cpp
new file mode 100644
index 0000000..1cadd48
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QTextEncoder.cpp
@@ -0,0 +1,192 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qtextcodec.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qtextcodec.h>
+
+static const char * const qtscript_QTextEncoder_function_names[] = {
+ "QTextEncoder"
+ // static
+ // prototype
+ , "fromUnicode"
+ , "hasFailure"
+ , "toString"
+};
+
+static const char * const qtscript_QTextEncoder_function_signatures[] = {
+ "QTextCodec codec"
+ // static
+ // prototype
+ , "String str"
+ , ""
+""
+};
+
+static QScriptValue qtscript_QTextEncoder_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QTextEncoder::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QTextEncoder*)
+Q_DECLARE_METATYPE(QTextCodec*)
+
+//
+// QTextEncoder
+//
+
+static QScriptValue qtscript_QTextEncoder_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 2;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QTextEncoder* _q_self = qscriptvalue_cast<QTextEncoder*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QTextEncoder.%0(): this object is not a QTextEncoder")
+ .arg(qtscript_QTextEncoder_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QByteArray _q_result = _q_self->fromUnicode(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->hasFailure();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2: {
+ QString result = QString::fromLatin1("QTextEncoder");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTextEncoder_throw_ambiguity_error_helper(context,
+ qtscript_QTextEncoder_function_names[_id+1],
+ qtscript_QTextEncoder_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QTextEncoder_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QTextEncoder(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 1) {
+ QTextCodec* _q_arg0 = qscriptvalue_cast<QTextCodec*>(context->argument(0));
+ QTextEncoder* _q_cpp_result = new QTextEncoder(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTextEncoder_throw_ambiguity_error_helper(context,
+ qtscript_QTextEncoder_function_names[_id],
+ qtscript_QTextEncoder_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QTextEncoder_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 1
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QTextEncoder*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QTextEncoder*)0));
+ for (int i = 0; i < 3; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QTextEncoder_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QTextEncoder_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QTextEncoder*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QTextEncoder_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QTextStream.cpp b/qtbindings/com_nokia_qt_core/qtscript_QTextStream.cpp
new file mode 100644
index 0000000..6501c67
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QTextStream.cpp
@@ -0,0 +1,1208 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qtextstream.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qiodevice.h>
+#include <qlocale.h>
+#include <qtextcodec.h>
+#include <qtextstream.h>
+
+#include "qtscriptshell_QTextStream.h"
+
+static const char * const qtscript_QTextStream_function_names[] = {
+ "QTextStream"
+ // static
+ // prototype
+ , "atEnd"
+ , "autoDetectUnicode"
+ , "codec"
+ , "device"
+ , "fieldAlignment"
+ , "fieldWidth"
+ , "flush"
+ , "generateByteOrderMark"
+ , "integerBase"
+ , "locale"
+ , "numberFlags"
+ , "padChar"
+ , "pos"
+ , "read"
+ , "readAll"
+ , "readByte"
+ , "readDouble"
+ , "readFloat"
+ , "readInt"
+ , "readLine"
+ , "readLongLong"
+ , "readShort"
+ , "readUInt"
+ , "readUShort"
+ , "realNumberNotation"
+ , "realNumberPrecision"
+ , "reset"
+ , "resetStatus"
+ , "seek"
+ , "setAutoDetectUnicode"
+ , "setCodec"
+ , "setDevice"
+ , "setFieldAlignment"
+ , "setFieldWidth"
+ , "setGenerateByteOrderMark"
+ , "setIntegerBase"
+ , "setLocale"
+ , "setNumberFlags"
+ , "setPadChar"
+ , "setRealNumberNotation"
+ , "setRealNumberPrecision"
+ , "setStatus"
+ , "skipWhiteSpace"
+ , "status"
+ , "writeBoolean"
+ , "writeByte"
+ , "writeByteArray"
+ , "writeDouble"
+ , "writeFloat"
+ , "writeInt"
+ , "writeShort"
+ , "writeString"
+ , "toString"
+};
+
+static const char * const qtscript_QTextStream_function_signatures[] = {
+ "\nQIODevice device\nQByteArray array, OpenMode openMode"
+ // static
+ // prototype
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "qint64 maxlen"
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "qint64 maxlen"
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "qint64 pos"
+ , "bool enabled"
+ , "QTextCodec codec\nchar codecName"
+ , "QIODevice device"
+ , "FieldAlignment alignment"
+ , "int width"
+ , "bool generate"
+ , "int base"
+ , "QLocale locale"
+ , "NumberFlags flags"
+ , "char ch"
+ , "RealNumberNotation notation"
+ , "int precision"
+ , "Status status"
+ , ""
+ , ""
+ , "QBool b"
+ , "char ch"
+ , "QByteArray array"
+ , "double f"
+ , "float f"
+ , "signed int i"
+ , "signed short i"
+ , "String s"
+""
+};
+
+static QScriptValue qtscript_QTextStream_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QTextStream::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QTextStream*)
+Q_DECLARE_METATYPE(QtScriptShell_QTextStream*)
+Q_DECLARE_METATYPE(QTextStream::RealNumberNotation)
+Q_DECLARE_METATYPE(QTextStream::NumberFlag)
+Q_DECLARE_METATYPE(QFlags<QTextStream::NumberFlag>)
+Q_DECLARE_METATYPE(QTextStream::FieldAlignment)
+Q_DECLARE_METATYPE(QTextStream::Status)
+Q_DECLARE_METATYPE(QTextCodec*)
+Q_DECLARE_METATYPE(QIODevice*)
+Q_DECLARE_METATYPE(signed int)
+Q_DECLARE_METATYPE(signed short)
+Q_DECLARE_METATYPE(QFlags<QIODevice::OpenModeFlag>)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+static QScriptValue qtscript_create_flags_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString,
+ QScriptEngine::FunctionSignature equals)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("equals"),
+ engine->newFunction(equals), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto);
+}
+
+//
+// QTextStream::RealNumberNotation
+//
+
+static const QTextStream::RealNumberNotation qtscript_QTextStream_RealNumberNotation_values[] = {
+ QTextStream::SmartNotation
+ , QTextStream::FixedNotation
+ , QTextStream::ScientificNotation
+};
+
+static const char * const qtscript_QTextStream_RealNumberNotation_keys[] = {
+ "SmartNotation"
+ , "FixedNotation"
+ , "ScientificNotation"
+};
+
+static QString qtscript_QTextStream_RealNumberNotation_toStringHelper(QTextStream::RealNumberNotation value)
+{
+ if ((value >= QTextStream::SmartNotation) && (value <= QTextStream::ScientificNotation))
+ return qtscript_QTextStream_RealNumberNotation_keys[static_cast<int>(value)-static_cast<int>(QTextStream::SmartNotation)];
+ return QString();
+}
+
+static QScriptValue qtscript_QTextStream_RealNumberNotation_toScriptValue(QScriptEngine *engine, const QTextStream::RealNumberNotation &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QTextStream"));
+ return clazz.property(qtscript_QTextStream_RealNumberNotation_toStringHelper(value));
+}
+
+static void qtscript_QTextStream_RealNumberNotation_fromScriptValue(const QScriptValue &value, QTextStream::RealNumberNotation &out)
+{
+ out = qvariant_cast<QTextStream::RealNumberNotation>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QTextStream_RealNumberNotation(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QTextStream::SmartNotation) && (arg <= QTextStream::ScientificNotation))
+ return qScriptValueFromValue(engine, static_cast<QTextStream::RealNumberNotation>(arg));
+ return context->throwError(QString::fromLatin1("RealNumberNotation(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QTextStream_RealNumberNotation_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextStream::RealNumberNotation value = qscriptvalue_cast<QTextStream::RealNumberNotation>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QTextStream_RealNumberNotation_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextStream::RealNumberNotation value = qscriptvalue_cast<QTextStream::RealNumberNotation>(context->thisObject());
+ return QScriptValue(engine, qtscript_QTextStream_RealNumberNotation_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QTextStream_RealNumberNotation_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QTextStream_RealNumberNotation,
+ qtscript_QTextStream_RealNumberNotation_valueOf, qtscript_QTextStream_RealNumberNotation_toString);
+ qScriptRegisterMetaType<QTextStream::RealNumberNotation>(engine, qtscript_QTextStream_RealNumberNotation_toScriptValue,
+ qtscript_QTextStream_RealNumberNotation_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QTextStream_RealNumberNotation_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QTextStream_RealNumberNotation_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QTextStream::NumberFlag
+//
+
+static const QTextStream::NumberFlag qtscript_QTextStream_NumberFlag_values[] = {
+ QTextStream::ShowBase
+ , QTextStream::ForcePoint
+ , QTextStream::ForceSign
+ , QTextStream::UppercaseBase
+ , QTextStream::UppercaseDigits
+};
+
+static const char * const qtscript_QTextStream_NumberFlag_keys[] = {
+ "ShowBase"
+ , "ForcePoint"
+ , "ForceSign"
+ , "UppercaseBase"
+ , "UppercaseDigits"
+};
+
+static QString qtscript_QTextStream_NumberFlag_toStringHelper(QTextStream::NumberFlag value)
+{
+ for (int i = 0; i < 5; ++i) {
+ if (qtscript_QTextStream_NumberFlag_values[i] == value)
+ return QString::fromLatin1(qtscript_QTextStream_NumberFlag_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_QTextStream_NumberFlag_toScriptValue(QScriptEngine *engine, const QTextStream::NumberFlag &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QTextStream"));
+ return clazz.property(qtscript_QTextStream_NumberFlag_toStringHelper(value));
+}
+
+static void qtscript_QTextStream_NumberFlag_fromScriptValue(const QScriptValue &value, QTextStream::NumberFlag &out)
+{
+ out = qvariant_cast<QTextStream::NumberFlag>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QTextStream_NumberFlag(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 5; ++i) {
+ if (qtscript_QTextStream_NumberFlag_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<QTextStream::NumberFlag>(arg));
+ }
+ return context->throwError(QString::fromLatin1("NumberFlag(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QTextStream_NumberFlag_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextStream::NumberFlag value = qscriptvalue_cast<QTextStream::NumberFlag>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QTextStream_NumberFlag_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextStream::NumberFlag value = qscriptvalue_cast<QTextStream::NumberFlag>(context->thisObject());
+ return QScriptValue(engine, qtscript_QTextStream_NumberFlag_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QTextStream_NumberFlag_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QTextStream_NumberFlag,
+ qtscript_QTextStream_NumberFlag_valueOf, qtscript_QTextStream_NumberFlag_toString);
+ qScriptRegisterMetaType<QTextStream::NumberFlag>(engine, qtscript_QTextStream_NumberFlag_toScriptValue,
+ qtscript_QTextStream_NumberFlag_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 5; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QTextStream_NumberFlag_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QTextStream_NumberFlag_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QTextStream::NumberFlags
+//
+
+static QScriptValue qtscript_QTextStream_NumberFlags_toScriptValue(QScriptEngine *engine, const QTextStream::NumberFlags &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_QTextStream_NumberFlags_fromScriptValue(const QScriptValue &value, QTextStream::NumberFlags &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<QTextStream::NumberFlags>())
+ out = qvariant_cast<QTextStream::NumberFlags>(var);
+ else if (var.userType() == qMetaTypeId<QTextStream::NumberFlag>())
+ out = qvariant_cast<QTextStream::NumberFlag>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_QTextStream_NumberFlags(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextStream::NumberFlags result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<QTextStream::NumberFlags>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<QTextStream::NumberFlag>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("NumberFlags(): argument %0 is not of type NumberFlag").arg(i));
+ }
+ result |= qvariant_cast<QTextStream::NumberFlag>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_QTextStream_NumberFlags_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextStream::NumberFlags value = qscriptvalue_cast<QTextStream::NumberFlags>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QTextStream_NumberFlags_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextStream::NumberFlags value = qscriptvalue_cast<QTextStream::NumberFlags>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 5; ++i) {
+ if ((value & qtscript_QTextStream_NumberFlag_values[i]) == qtscript_QTextStream_NumberFlag_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_QTextStream_NumberFlag_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_QTextStream_NumberFlags_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<QTextStream::NumberFlags>() == otherObj.value<QTextStream::NumberFlags>())));
+}
+
+static QScriptValue qtscript_create_QTextStream_NumberFlags_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_QTextStream_NumberFlags, qtscript_QTextStream_NumberFlags_valueOf,
+ qtscript_QTextStream_NumberFlags_toString, qtscript_QTextStream_NumberFlags_equals);
+ qScriptRegisterMetaType<QTextStream::NumberFlags>(engine, qtscript_QTextStream_NumberFlags_toScriptValue,
+ qtscript_QTextStream_NumberFlags_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// QTextStream::FieldAlignment
+//
+
+static const QTextStream::FieldAlignment qtscript_QTextStream_FieldAlignment_values[] = {
+ QTextStream::AlignLeft
+ , QTextStream::AlignRight
+ , QTextStream::AlignCenter
+ , QTextStream::AlignAccountingStyle
+};
+
+static const char * const qtscript_QTextStream_FieldAlignment_keys[] = {
+ "AlignLeft"
+ , "AlignRight"
+ , "AlignCenter"
+ , "AlignAccountingStyle"
+};
+
+static QString qtscript_QTextStream_FieldAlignment_toStringHelper(QTextStream::FieldAlignment value)
+{
+ if ((value >= QTextStream::AlignLeft) && (value <= QTextStream::AlignAccountingStyle))
+ return qtscript_QTextStream_FieldAlignment_keys[static_cast<int>(value)-static_cast<int>(QTextStream::AlignLeft)];
+ return QString();
+}
+
+static QScriptValue qtscript_QTextStream_FieldAlignment_toScriptValue(QScriptEngine *engine, const QTextStream::FieldAlignment &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QTextStream"));
+ return clazz.property(qtscript_QTextStream_FieldAlignment_toStringHelper(value));
+}
+
+static void qtscript_QTextStream_FieldAlignment_fromScriptValue(const QScriptValue &value, QTextStream::FieldAlignment &out)
+{
+ out = qvariant_cast<QTextStream::FieldAlignment>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QTextStream_FieldAlignment(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QTextStream::AlignLeft) && (arg <= QTextStream::AlignAccountingStyle))
+ return qScriptValueFromValue(engine, static_cast<QTextStream::FieldAlignment>(arg));
+ return context->throwError(QString::fromLatin1("FieldAlignment(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QTextStream_FieldAlignment_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextStream::FieldAlignment value = qscriptvalue_cast<QTextStream::FieldAlignment>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QTextStream_FieldAlignment_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextStream::FieldAlignment value = qscriptvalue_cast<QTextStream::FieldAlignment>(context->thisObject());
+ return QScriptValue(engine, qtscript_QTextStream_FieldAlignment_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QTextStream_FieldAlignment_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QTextStream_FieldAlignment,
+ qtscript_QTextStream_FieldAlignment_valueOf, qtscript_QTextStream_FieldAlignment_toString);
+ qScriptRegisterMetaType<QTextStream::FieldAlignment>(engine, qtscript_QTextStream_FieldAlignment_toScriptValue,
+ qtscript_QTextStream_FieldAlignment_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 4; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QTextStream_FieldAlignment_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QTextStream_FieldAlignment_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QTextStream::Status
+//
+
+static const QTextStream::Status qtscript_QTextStream_Status_values[] = {
+ QTextStream::Ok
+ , QTextStream::ReadPastEnd
+ , QTextStream::ReadCorruptData
+};
+
+static const char * const qtscript_QTextStream_Status_keys[] = {
+ "Ok"
+ , "ReadPastEnd"
+ , "ReadCorruptData"
+};
+
+static QString qtscript_QTextStream_Status_toStringHelper(QTextStream::Status value)
+{
+ if ((value >= QTextStream::Ok) && (value <= QTextStream::ReadCorruptData))
+ return qtscript_QTextStream_Status_keys[static_cast<int>(value)-static_cast<int>(QTextStream::Ok)];
+ return QString();
+}
+
+static QScriptValue qtscript_QTextStream_Status_toScriptValue(QScriptEngine *engine, const QTextStream::Status &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QTextStream"));
+ return clazz.property(qtscript_QTextStream_Status_toStringHelper(value));
+}
+
+static void qtscript_QTextStream_Status_fromScriptValue(const QScriptValue &value, QTextStream::Status &out)
+{
+ out = qvariant_cast<QTextStream::Status>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QTextStream_Status(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QTextStream::Ok) && (arg <= QTextStream::ReadCorruptData))
+ return qScriptValueFromValue(engine, static_cast<QTextStream::Status>(arg));
+ return context->throwError(QString::fromLatin1("Status(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QTextStream_Status_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextStream::Status value = qscriptvalue_cast<QTextStream::Status>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QTextStream_Status_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QTextStream::Status value = qscriptvalue_cast<QTextStream::Status>(context->thisObject());
+ return QScriptValue(engine, qtscript_QTextStream_Status_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QTextStream_Status_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QTextStream_Status,
+ qtscript_QTextStream_Status_valueOf, qtscript_QTextStream_Status_toString);
+ qScriptRegisterMetaType<QTextStream::Status>(engine, qtscript_QTextStream_Status_toScriptValue,
+ qtscript_QTextStream_Status_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QTextStream_Status_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QTextStream_Status_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QTextStream
+//
+
+static QScriptValue qtscript_QTextStream_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 52;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QTextStream* _q_self = qscriptvalue_cast<QTextStream*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QTextStream.%0(): this object is not a QTextStream")
+ .arg(qtscript_QTextStream_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->atEnd();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->autoDetectUnicode();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QTextCodec* _q_result = _q_self->codec();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QIODevice* _q_result = _q_self->device();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ QTextStream::FieldAlignment _q_result = _q_self->fieldAlignment();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->fieldWidth();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ _q_self->flush();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->generateByteOrderMark();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->integerBase();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 0) {
+ QLocale _q_result = _q_self->locale();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 0) {
+ QFlags<QTextStream::NumberFlag> _q_result = _q_self->numberFlags();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 0) {
+ QChar _q_result = _q_self->padChar();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 0) {
+ qint64 _q_result = _q_self->pos();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 1) {
+ qint64 _q_arg0 = qscriptvalue_cast<qint64>(context->argument(0));
+ QString _q_result = _q_self->read(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->readAll();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 0) {
+
+ char __result;
+ char & _q_arg0 = __result;
+ _q_self->operator>>(_q_arg0);
+
+ int _q_convertedResult = __result;
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 0) {
+
+ double __result;
+ double & _q_arg0 = __result;
+ _q_self->operator>>(_q_arg0);
+
+ double _q_convertedResult = __result;
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 0) {
+
+ float __result;
+ float & _q_arg0 = __result;
+ _q_self->operator>>(_q_arg0);
+
+ float _q_convertedResult = __result;
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 0) {
+
+ int __result;
+ int & _q_arg0 = __result;
+ _q_self->operator>>(_q_arg0);
+
+ int _q_convertedResult = __result;
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->readLine();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ qint64 _q_arg0 = qscriptvalue_cast<qint64>(context->argument(0));
+ QString _q_result = _q_self->readLine(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 0) {
+
+ qlonglong __result;
+ qlonglong & _q_arg0 = __result;
+ _q_self->operator>>(_q_arg0);
+
+ qlonglong _q_convertedResult = __result;
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 21:
+ if (context->argumentCount() == 0) {
+
+ short __result;
+ short & _q_arg0 = __result;
+ _q_self->operator>>(_q_arg0);
+
+ short _q_convertedResult = __result;
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 22:
+ if (context->argumentCount() == 0) {
+
+ unsigned int __result;
+ unsigned int & _q_arg0 = __result;
+ _q_self->operator>>(_q_arg0);
+
+ unsigned int _q_convertedResult = __result;
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 23:
+ if (context->argumentCount() == 0) {
+
+ unsigned short __result;
+ unsigned short & _q_arg0 = __result;
+ _q_self->operator>>(_q_arg0);
+
+ unsigned short _q_convertedResult = __result;
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 24:
+ if (context->argumentCount() == 0) {
+ QTextStream::RealNumberNotation _q_result = _q_self->realNumberNotation();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 25:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->realNumberPrecision();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 26:
+ if (context->argumentCount() == 0) {
+ _q_self->reset();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 27:
+ if (context->argumentCount() == 0) {
+ _q_self->resetStatus();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 28:
+ if (context->argumentCount() == 1) {
+ qint64 _q_arg0 = qscriptvalue_cast<qint64>(context->argument(0));
+ bool _q_result = _q_self->seek(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 29:
+ if (context->argumentCount() == 1) {
+ bool _q_arg0 = context->argument(0).toBoolean();
+ _q_self->setAutoDetectUnicode(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 30:
+ if (context->argumentCount() == 1) {
+ if (qscriptvalue_cast<QTextCodec*>(context->argument(0))) {
+ QTextCodec* _q_arg0 = qscriptvalue_cast<QTextCodec*>(context->argument(0));
+ _q_self->setCodec(_q_arg0);
+ return context->engine()->undefinedValue();
+ } else if (context->argument(0).isString()) {
+
+ // TEMPLATE - core.convert_string_arg_to_char* - START
+ QByteArray tmp__q_arg0 = context->argument(0).toString().toLatin1();
+ const char * _q_arg0 = tmp__q_arg0.constData();
+ // TEMPLATE - core.convert_string_arg_to_char* - END
+ _q_self->setCodec(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ }
+ break;
+
+ case 31:
+ if (context->argumentCount() == 1) {
+ QIODevice* _q_arg0 = qscriptvalue_cast<QIODevice*>(context->argument(0));
+ _q_self->setDevice(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 32:
+ if (context->argumentCount() == 1) {
+ QTextStream::FieldAlignment _q_arg0 = qscriptvalue_cast<QTextStream::FieldAlignment>(context->argument(0));
+ _q_self->setFieldAlignment(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 33:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setFieldWidth(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 34:
+ if (context->argumentCount() == 1) {
+ bool _q_arg0 = context->argument(0).toBoolean();
+ _q_self->setGenerateByteOrderMark(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 35:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setIntegerBase(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 36:
+ if (context->argumentCount() == 1) {
+ QLocale _q_arg0 = qscriptvalue_cast<QLocale>(context->argument(0));
+ _q_self->setLocale(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 37:
+ if (context->argumentCount() == 1) {
+ QFlags<QTextStream::NumberFlag> _q_arg0 = qscriptvalue_cast<QFlags<QTextStream::NumberFlag> >(context->argument(0));
+ _q_self->setNumberFlags(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 38:
+ if (context->argumentCount() == 1) {
+ QChar _q_arg0 = qscriptvalue_cast<QChar>(context->argument(0));
+ _q_self->setPadChar(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 39:
+ if (context->argumentCount() == 1) {
+ QTextStream::RealNumberNotation _q_arg0 = qscriptvalue_cast<QTextStream::RealNumberNotation>(context->argument(0));
+ _q_self->setRealNumberNotation(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 40:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setRealNumberPrecision(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 41:
+ if (context->argumentCount() == 1) {
+ QTextStream::Status _q_arg0 = qscriptvalue_cast<QTextStream::Status>(context->argument(0));
+ _q_self->setStatus(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 42:
+ if (context->argumentCount() == 0) {
+ _q_self->skipWhiteSpace();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 43:
+ if (context->argumentCount() == 0) {
+ QTextStream::Status _q_result = _q_self->status();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 44:
+ if (context->argumentCount() == 1) {
+ bool _q_arg0 = context->argument(0).toBoolean();
+ _q_self->operator<<(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 45:
+ if (context->argumentCount() == 1) {
+ char _q_arg0 = qscriptvalue_cast<char>(context->argument(0));
+ _q_self->operator<<(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 46:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ _q_self->operator<<(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 47:
+ if (context->argumentCount() == 1) {
+ double _q_arg0 = context->argument(0).toNumber();
+ _q_self->operator<<(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 48:
+ if (context->argumentCount() == 1) {
+ float _q_arg0 = qscriptvalue_cast<float>(context->argument(0));
+ _q_self->operator<<(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 49:
+ if (context->argumentCount() == 1) {
+ signed int _q_arg0 = qscriptvalue_cast<signed int>(context->argument(0));
+ _q_self->operator<<(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 50:
+ if (context->argumentCount() == 1) {
+ signed short _q_arg0 = qscriptvalue_cast<signed short>(context->argument(0));
+ _q_self->operator<<(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 51:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->operator<<(_q_arg0);
+ return context->thisObject();
+ }
+ break;
+
+ case 52: {
+ QString result = QString::fromLatin1("QTextStream");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTextStream_throw_ambiguity_error_helper(context,
+ qtscript_QTextStream_function_names[_id+1],
+ qtscript_QTextStream_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QTextStream_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QTextStream(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QTextStream* _q_cpp_result = new QtScriptShell_QTextStream();
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QTextStream*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ if (qscriptvalue_cast<QIODevice*>(context->argument(0))) {
+ QIODevice* _q_arg0 = qscriptvalue_cast<QIODevice*>(context->argument(0));
+ QtScriptShell_QTextStream* _q_cpp_result = new QtScriptShell_QTextStream(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QTextStream*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QtScriptShell_QTextStream* _q_cpp_result = new QtScriptShell_QTextStream(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QTextStream*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 2) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QFlags<QIODevice::OpenModeFlag> _q_arg1 = qscriptvalue_cast<QFlags<QIODevice::OpenModeFlag> >(context->argument(1));
+ QtScriptShell_QTextStream* _q_cpp_result = new QtScriptShell_QTextStream(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QTextStream*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTextStream_throw_ambiguity_error_helper(context,
+ qtscript_QTextStream_function_names[_id],
+ qtscript_QTextStream_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QTextStream_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 2
+ // static
+ // prototype
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 0
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QTextStream*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QTextStream*)0));
+ for (int i = 0; i < 53; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QTextStream_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QTextStream_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QTextStream*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QTextStream_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ ctor.setProperty(QString::fromLatin1("RealNumberNotation"),
+ qtscript_create_QTextStream_RealNumberNotation_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("NumberFlag"),
+ qtscript_create_QTextStream_NumberFlag_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("NumberFlags"),
+ qtscript_create_QTextStream_NumberFlags_class(engine));
+ ctor.setProperty(QString::fromLatin1("FieldAlignment"),
+ qtscript_create_QTextStream_FieldAlignment_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("Status"),
+ qtscript_create_QTextStream_Status_class(engine, ctor));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QThreadPool.cpp b/qtbindings/com_nokia_qt_core/qtscript_QThreadPool.cpp
new file mode 100644
index 0000000..406a403
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QThreadPool.cpp
@@ -0,0 +1,271 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qthreadpool.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qrunnable.h>
+#include <qthreadpool.h>
+
+#include "qtscriptshell_QThreadPool.h"
+
+static const char * const qtscript_QThreadPool_function_names[] = {
+ "QThreadPool"
+ // static
+ , "globalInstance"
+ // prototype
+ , "releaseThread"
+ , "reserveThread"
+ , "start"
+ , "tryStart"
+ , "waitForDone"
+ , "toString"
+};
+
+static const char * const qtscript_QThreadPool_function_signatures[] = {
+ "QObject parent"
+ // static
+ , ""
+ // prototype
+ , ""
+ , ""
+ , "QRunnable runnable, int priority"
+ , "QRunnable runnable"
+ , ""
+""
+};
+
+static QScriptValue qtscript_QThreadPool_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QThreadPool::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QThreadPool*)
+Q_DECLARE_METATYPE(QtScriptShell_QThreadPool*)
+Q_DECLARE_METATYPE(QRunnable*)
+
+//
+// QThreadPool
+//
+
+static QScriptValue qtscript_QThreadPool_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 5;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QThreadPool* _q_self = qscriptvalue_cast<QThreadPool*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QThreadPool.%0(): this object is not a QThreadPool")
+ .arg(qtscript_QThreadPool_function_names[_id+2]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ _q_self->releaseThread();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ _q_self->reserveThread();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QRunnable* _q_arg0 = qscriptvalue_cast<QRunnable*>(context->argument(0));
+ _q_self->start(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ QRunnable* _q_arg0 = qscriptvalue_cast<QRunnable*>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ _q_self->start(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ QRunnable* _q_arg0 = qscriptvalue_cast<QRunnable*>(context->argument(0));
+ bool _q_result = _q_self->tryStart(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ _q_self->waitForDone();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 5: {
+ QString result = QString::fromLatin1("QThreadPool");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QThreadPool_throw_ambiguity_error_helper(context,
+ qtscript_QThreadPool_function_names[_id+2],
+ qtscript_QThreadPool_function_signatures[_id+2]);
+}
+
+static QScriptValue qtscript_QThreadPool_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QThreadPool(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QThreadPool* _q_cpp_result = new QtScriptShell_QThreadPool();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QThreadPool*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QtScriptShell_QThreadPool* _q_cpp_result = new QtScriptShell_QThreadPool(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QThreadPool*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QThreadPool* _q_result = QThreadPool::globalInstance();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QThreadPool_throw_ambiguity_error_helper(context,
+ qtscript_QThreadPool_function_names[_id],
+ qtscript_QThreadPool_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QThreadPool_toScriptValue(QScriptEngine *engine, QThreadPool* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QThreadPool_fromScriptValue(const QScriptValue &value, QThreadPool* &out)
+{
+ out = qobject_cast<QThreadPool*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QThreadPool_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ , 0
+ // prototype
+ , 0
+ , 0
+ , 2
+ , 1
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QThreadPool*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QThreadPool*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
+ for (int i = 0; i < 6; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QThreadPool_prototype_call, function_lengths[i+2]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QThreadPool_function_names[i+2]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<QThreadPool*>(engine, qtscript_QThreadPool_toScriptValue,
+ qtscript_QThreadPool_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QThreadPool_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 1; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QThreadPool_static_call,
+ function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_QThreadPool_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QTime.cpp b/qtbindings/com_nokia_qt_core/qtscript_QTime.cpp
new file mode 100644
index 0000000..d07c482
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QTime.cpp
@@ -0,0 +1,469 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qdatetime.h>
+#include <QVariant>
+#include <qdatastream.h>
+#include <qdatetime.h>
+
+static const char * const qtscript_QTime_function_names[] = {
+ "QTime"
+ // static
+ , "currentTime"
+ , "fromString"
+ , "isValid"
+ // prototype
+ , "addMSecs"
+ , "addSecs"
+ , "elapsed"
+ , "hour"
+ , "isNull"
+ , "isValid"
+ , "minute"
+ , "msec"
+ , "msecsTo"
+ , "equals"
+ , "operator_less"
+ , "readFrom"
+ , "restart"
+ , "second"
+ , "secsTo"
+ , "setHMS"
+ , "start"
+ , "toString"
+ , "writeTo"
+};
+
+static const char * const qtscript_QTime_function_signatures[] = {
+ "\nint h, int m, int s, int ms"
+ // static
+ , ""
+ , "String s, DateFormat f\nString s, String format"
+ , "int h, int m, int s, int ms"
+ // prototype
+ , "int ms"
+ , "int secs"
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "QTime arg__1"
+ , "QTime other"
+ , "QTime other"
+ , "QDataStream arg__1"
+ , ""
+ , ""
+ , "QTime arg__1"
+ , "int h, int m, int s, int ms"
+ , ""
+ , "DateFormat f\nString format"
+ , "QDataStream arg__1"
+};
+
+static QScriptValue qtscript_QTime_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QTime::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QTime*)
+Q_DECLARE_METATYPE(QDataStream*)
+Q_DECLARE_METATYPE(Qt::DateFormat)
+
+//
+// QTime
+//
+
+static QScriptValue qtscript_QTime_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 19;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QTime* _q_self = qscriptvalue_cast<QTime*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QTime.%0(): this object is not a QTime")
+ .arg(qtscript_QTime_function_names[_id+4]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QTime _q_result = _q_self->addMSecs(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QTime _q_result = _q_self->addSecs(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->elapsed();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->hour();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isNull();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isValid();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->minute();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->msec();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 1) {
+ QTime _q_arg0 = qscriptvalue_cast<QTime>(context->argument(0));
+ int _q_result = _q_self->msecsTo(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 1) {
+ QTime _q_arg0 = qscriptvalue_cast<QTime>(context->argument(0));
+ bool _q_result = _q_self->operator==(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 1) {
+ QTime _q_arg0 = qscriptvalue_cast<QTime>(context->argument(0));
+ bool _q_result = _q_self->operator<(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator>>(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->restart();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->second();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 1) {
+ QTime _q_arg0 = qscriptvalue_cast<QTime>(context->argument(0));
+ int _q_result = _q_self->secsTo(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 3) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_arg2 = context->argument(2).toInt32();
+ bool _q_result = _q_self->setHMS(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 4) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_arg2 = context->argument(2).toInt32();
+ int _q_arg3 = context->argument(3).toInt32();
+ bool _q_result = _q_self->setHMS(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 0) {
+ _q_self->start();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->toString();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<Qt::DateFormat>() == context->argument(0).toVariant().userType())) {
+ Qt::DateFormat _q_arg0 = qscriptvalue_cast<Qt::DateFormat>(context->argument(0));
+ QString _q_result = _q_self->toString(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_result = _q_self->toString(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator<<(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTime_throw_ambiguity_error_helper(context,
+ qtscript_QTime_function_names[_id+4],
+ qtscript_QTime_function_signatures[_id+4]);
+}
+
+static QScriptValue qtscript_QTime_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QTime(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QTime _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ QTime _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 3) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_arg2 = context->argument(2).toInt32();
+ QTime _q_cpp_result(_q_arg0, _q_arg1, _q_arg2);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 4) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_arg2 = context->argument(2).toInt32();
+ int _q_arg3 = context->argument(3).toInt32();
+ QTime _q_cpp_result(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QTime _q_result = QTime::currentTime();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QTime _q_result = QTime::fromString(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ if (context->argument(0).isString()
+ && (qMetaTypeId<Qt::DateFormat>() == context->argument(1).toVariant().userType())) {
+ QString _q_arg0 = context->argument(0).toString();
+ Qt::DateFormat _q_arg1 = qscriptvalue_cast<Qt::DateFormat>(context->argument(1));
+ QTime _q_result = QTime::fromString(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ } else if (context->argument(0).isString()
+ && context->argument(1).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QTime _q_result = QTime::fromString(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 3) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_arg2 = context->argument(2).toInt32();
+ bool _q_result = QTime::isValid(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 4) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_arg2 = context->argument(2).toInt32();
+ int _q_arg3 = context->argument(3).toInt32();
+ bool _q_result = QTime::isValid(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTime_throw_ambiguity_error_helper(context,
+ qtscript_QTime_function_names[_id],
+ qtscript_QTime_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QTime_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 4
+ // static
+ , 0
+ , 2
+ , 4
+ // prototype
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 0
+ , 0
+ , 1
+ , 4
+ , 0
+ , 1
+ , 1
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QTime*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QTime*)0));
+ for (int i = 0; i < 19; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QTime_prototype_call, function_lengths[i+4]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QTime_function_names[i+4]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QTime>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QTime*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QTime_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 3; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QTime_static_call,
+ function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_QTime_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QTimeLine.cpp b/qtbindings/com_nokia_qt_core/qtscript_QTimeLine.cpp
new file mode 100644
index 0000000..01cb938
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QTimeLine.cpp
@@ -0,0 +1,541 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qtimeline.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qtimeline.h>
+
+#include "qtscriptshell_QTimeLine.h"
+
+static const char * const qtscript_QTimeLine_function_names[] = {
+ "QTimeLine"
+ // static
+ // prototype
+ , "currentFrame"
+ , "currentValue"
+ , "endFrame"
+ , "frameForTime"
+ , "setEndFrame"
+ , "setFrameRange"
+ , "setStartFrame"
+ , "startFrame"
+ , "state"
+ , "valueForTime"
+ , "toString"
+};
+
+static const char * const qtscript_QTimeLine_function_signatures[] = {
+ "int duration, QObject parent"
+ // static
+ // prototype
+ , ""
+ , ""
+ , ""
+ , "int msec"
+ , "int frame"
+ , "int startFrame, int endFrame"
+ , "int frame"
+ , ""
+ , ""
+ , "int msec"
+""
+};
+
+static QScriptValue qtscript_QTimeLine_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QTimeLine::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QTimeLine*)
+Q_DECLARE_METATYPE(QtScriptShell_QTimeLine*)
+Q_DECLARE_METATYPE(QTimeLine::Direction)
+Q_DECLARE_METATYPE(QTimeLine::CurveShape)
+Q_DECLARE_METATYPE(QTimeLine::State)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// QTimeLine::Direction
+//
+
+static const QTimeLine::Direction qtscript_QTimeLine_Direction_values[] = {
+ QTimeLine::Forward
+ , QTimeLine::Backward
+};
+
+static const char * const qtscript_QTimeLine_Direction_keys[] = {
+ "Forward"
+ , "Backward"
+};
+
+static QString qtscript_QTimeLine_Direction_toStringHelper(QTimeLine::Direction value)
+{
+ if ((value >= QTimeLine::Forward) && (value <= QTimeLine::Backward))
+ return qtscript_QTimeLine_Direction_keys[static_cast<int>(value)-static_cast<int>(QTimeLine::Forward)];
+ return QString();
+}
+
+static QScriptValue qtscript_QTimeLine_Direction_toScriptValue(QScriptEngine *engine, const QTimeLine::Direction &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QTimeLine"));
+ return clazz.property(qtscript_QTimeLine_Direction_toStringHelper(value));
+}
+
+static void qtscript_QTimeLine_Direction_fromScriptValue(const QScriptValue &value, QTimeLine::Direction &out)
+{
+ out = qvariant_cast<QTimeLine::Direction>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QTimeLine_Direction(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QTimeLine::Forward) && (arg <= QTimeLine::Backward))
+ return qScriptValueFromValue(engine, static_cast<QTimeLine::Direction>(arg));
+ return context->throwError(QString::fromLatin1("Direction(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QTimeLine_Direction_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QTimeLine::Direction value = qscriptvalue_cast<QTimeLine::Direction>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QTimeLine_Direction_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QTimeLine::Direction value = qscriptvalue_cast<QTimeLine::Direction>(context->thisObject());
+ return QScriptValue(engine, qtscript_QTimeLine_Direction_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QTimeLine_Direction_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QTimeLine_Direction,
+ qtscript_QTimeLine_Direction_valueOf, qtscript_QTimeLine_Direction_toString);
+ qScriptRegisterMetaType<QTimeLine::Direction>(engine, qtscript_QTimeLine_Direction_toScriptValue,
+ qtscript_QTimeLine_Direction_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QTimeLine_Direction_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QTimeLine_Direction_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QTimeLine::CurveShape
+//
+
+static const QTimeLine::CurveShape qtscript_QTimeLine_CurveShape_values[] = {
+ QTimeLine::EaseInCurve
+ , QTimeLine::EaseOutCurve
+ , QTimeLine::EaseInOutCurve
+ , QTimeLine::LinearCurve
+ , QTimeLine::SineCurve
+ , QTimeLine::CosineCurve
+};
+
+static const char * const qtscript_QTimeLine_CurveShape_keys[] = {
+ "EaseInCurve"
+ , "EaseOutCurve"
+ , "EaseInOutCurve"
+ , "LinearCurve"
+ , "SineCurve"
+ , "CosineCurve"
+};
+
+static QString qtscript_QTimeLine_CurveShape_toStringHelper(QTimeLine::CurveShape value)
+{
+ if ((value >= QTimeLine::EaseInCurve) && (value <= QTimeLine::CosineCurve))
+ return qtscript_QTimeLine_CurveShape_keys[static_cast<int>(value)-static_cast<int>(QTimeLine::EaseInCurve)];
+ return QString();
+}
+
+static QScriptValue qtscript_QTimeLine_CurveShape_toScriptValue(QScriptEngine *engine, const QTimeLine::CurveShape &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QTimeLine"));
+ return clazz.property(qtscript_QTimeLine_CurveShape_toStringHelper(value));
+}
+
+static void qtscript_QTimeLine_CurveShape_fromScriptValue(const QScriptValue &value, QTimeLine::CurveShape &out)
+{
+ out = qvariant_cast<QTimeLine::CurveShape>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QTimeLine_CurveShape(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QTimeLine::EaseInCurve) && (arg <= QTimeLine::CosineCurve))
+ return qScriptValueFromValue(engine, static_cast<QTimeLine::CurveShape>(arg));
+ return context->throwError(QString::fromLatin1("CurveShape(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QTimeLine_CurveShape_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QTimeLine::CurveShape value = qscriptvalue_cast<QTimeLine::CurveShape>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QTimeLine_CurveShape_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QTimeLine::CurveShape value = qscriptvalue_cast<QTimeLine::CurveShape>(context->thisObject());
+ return QScriptValue(engine, qtscript_QTimeLine_CurveShape_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QTimeLine_CurveShape_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QTimeLine_CurveShape,
+ qtscript_QTimeLine_CurveShape_valueOf, qtscript_QTimeLine_CurveShape_toString);
+ qScriptRegisterMetaType<QTimeLine::CurveShape>(engine, qtscript_QTimeLine_CurveShape_toScriptValue,
+ qtscript_QTimeLine_CurveShape_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 6; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QTimeLine_CurveShape_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QTimeLine_CurveShape_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QTimeLine::State
+//
+
+static const QTimeLine::State qtscript_QTimeLine_State_values[] = {
+ QTimeLine::NotRunning
+ , QTimeLine::Paused
+ , QTimeLine::Running
+};
+
+static const char * const qtscript_QTimeLine_State_keys[] = {
+ "NotRunning"
+ , "Paused"
+ , "Running"
+};
+
+static QString qtscript_QTimeLine_State_toStringHelper(QTimeLine::State value)
+{
+ if ((value >= QTimeLine::NotRunning) && (value <= QTimeLine::Running))
+ return qtscript_QTimeLine_State_keys[static_cast<int>(value)-static_cast<int>(QTimeLine::NotRunning)];
+ return QString();
+}
+
+static QScriptValue qtscript_QTimeLine_State_toScriptValue(QScriptEngine *engine, const QTimeLine::State &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QTimeLine"));
+ return clazz.property(qtscript_QTimeLine_State_toStringHelper(value));
+}
+
+static void qtscript_QTimeLine_State_fromScriptValue(const QScriptValue &value, QTimeLine::State &out)
+{
+ out = qvariant_cast<QTimeLine::State>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QTimeLine_State(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QTimeLine::NotRunning) && (arg <= QTimeLine::Running))
+ return qScriptValueFromValue(engine, static_cast<QTimeLine::State>(arg));
+ return context->throwError(QString::fromLatin1("State(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QTimeLine_State_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QTimeLine::State value = qscriptvalue_cast<QTimeLine::State>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QTimeLine_State_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QTimeLine::State value = qscriptvalue_cast<QTimeLine::State>(context->thisObject());
+ return QScriptValue(engine, qtscript_QTimeLine_State_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QTimeLine_State_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QTimeLine_State,
+ qtscript_QTimeLine_State_valueOf, qtscript_QTimeLine_State_toString);
+ qScriptRegisterMetaType<QTimeLine::State>(engine, qtscript_QTimeLine_State_toScriptValue,
+ qtscript_QTimeLine_State_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QTimeLine_State_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QTimeLine_State_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QTimeLine
+//
+
+static QScriptValue qtscript_QTimeLine_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 10;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QTimeLine* _q_self = qscriptvalue_cast<QTimeLine*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QTimeLine.%0(): this object is not a QTimeLine")
+ .arg(qtscript_QTimeLine_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->currentFrame();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ qreal _q_result = _q_self->currentValue();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->endFrame();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_result = _q_self->frameForTime(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setEndFrame(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ _q_self->setFrameRange(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setStartFrame(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->startFrame();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 0) {
+ QTimeLine::State _q_result = _q_self->state();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ qreal _q_result = _q_self->valueForTime(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10: {
+ QString result = QString::fromLatin1("QTimeLine");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTimeLine_throw_ambiguity_error_helper(context,
+ qtscript_QTimeLine_function_names[_id+1],
+ qtscript_QTimeLine_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QTimeLine_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QTimeLine(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QTimeLine* _q_cpp_result = new QtScriptShell_QTimeLine();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QTimeLine*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QtScriptShell_QTimeLine* _q_cpp_result = new QtScriptShell_QTimeLine(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QTimeLine*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QObject* _q_arg1 = context->argument(1).toQObject();
+ QtScriptShell_QTimeLine* _q_cpp_result = new QtScriptShell_QTimeLine(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QTimeLine*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTimeLine_throw_ambiguity_error_helper(context,
+ qtscript_QTimeLine_function_names[_id],
+ qtscript_QTimeLine_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QTimeLine_toScriptValue(QScriptEngine *engine, QTimeLine* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QTimeLine_fromScriptValue(const QScriptValue &value, QTimeLine* &out)
+{
+ out = qobject_cast<QTimeLine*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QTimeLine_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 2
+ // static
+ // prototype
+ , 0
+ , 0
+ , 0
+ , 1
+ , 1
+ , 2
+ , 1
+ , 0
+ , 0
+ , 1
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QTimeLine*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QTimeLine*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
+ for (int i = 0; i < 11; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QTimeLine_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QTimeLine_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<QTimeLine*>(engine, qtscript_QTimeLine_toScriptValue,
+ qtscript_QTimeLine_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QTimeLine_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ ctor.setProperty(QString::fromLatin1("Direction"),
+ qtscript_create_QTimeLine_Direction_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("CurveShape"),
+ qtscript_create_QTimeLine_CurveShape_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("State"),
+ qtscript_create_QTimeLine_State_class(engine, ctor));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QTimer.cpp b/qtbindings/com_nokia_qt_core/qtscript_QTimer.cpp
new file mode 100644
index 0000000..49e5747
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QTimer.cpp
@@ -0,0 +1,204 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qtimer.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qtimer.h>
+
+#include "qtscriptshell_QTimer.h"
+
+static const char * const qtscript_QTimer_function_names[] = {
+ "QTimer"
+ // static
+ // prototype
+ , "timerId"
+ , "toString"
+};
+
+static const char * const qtscript_QTimer_function_signatures[] = {
+ "QObject parent"
+ // static
+ // prototype
+ , ""
+""
+};
+
+static QScriptValue qtscript_QTimer_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QTimer::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QTimer*)
+Q_DECLARE_METATYPE(QtScriptShell_QTimer*)
+
+//
+// QTimer
+//
+
+static QScriptValue qtscript_QTimer_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 1;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QTimer* _q_self = qscriptvalue_cast<QTimer*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QTimer.%0(): this object is not a QTimer")
+ .arg(qtscript_QTimer_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->timerId();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1: {
+ QString result = QString::fromLatin1("QTimer");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTimer_throw_ambiguity_error_helper(context,
+ qtscript_QTimer_function_names[_id+1],
+ qtscript_QTimer_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QTimer_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QTimer(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QTimer* _q_cpp_result = new QtScriptShell_QTimer();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QTimer*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QtScriptShell_QTimer* _q_cpp_result = new QtScriptShell_QTimer(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QTimer*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTimer_throw_ambiguity_error_helper(context,
+ qtscript_QTimer_function_names[_id],
+ qtscript_QTimer_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QTimer_toScriptValue(QScriptEngine *engine, QTimer* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QTimer_fromScriptValue(const QScriptValue &value, QTimer* &out)
+{
+ out = qobject_cast<QTimer*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QTimer_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QTimer*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QTimer*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
+ for (int i = 0; i < 2; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QTimer_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QTimer_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<QTimer*>(engine, qtscript_QTimer_toScriptValue,
+ qtscript_QTimer_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QTimer_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QTimerEvent.cpp b/qtbindings/com_nokia_qt_core/qtscript_QTimerEvent.cpp
new file mode 100644
index 0000000..25cf017
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QTimerEvent.cpp
@@ -0,0 +1,184 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qcoreevent.h>
+#include <QVariant>
+
+#include "qtscriptshell_QTimerEvent.h"
+
+static const char * const qtscript_QTimerEvent_function_names[] = {
+ "QTimerEvent"
+ // static
+ // prototype
+ , "timerId"
+ , "toString"
+};
+
+static const char * const qtscript_QTimerEvent_function_signatures[] = {
+ "int timerId"
+ // static
+ // prototype
+ , ""
+""
+};
+
+static QScriptValue qtscript_QTimerEvent_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QTimerEvent::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QTimerEvent*)
+Q_DECLARE_METATYPE(QtScriptShell_QTimerEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+
+//
+// QTimerEvent
+//
+
+static QScriptValue qtscript_QTimerEvent_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 1;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QTimerEvent* _q_self = qscriptvalue_cast<QTimerEvent*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QTimerEvent.%0(): this object is not a QTimerEvent")
+ .arg(qtscript_QTimerEvent_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->timerId();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1: {
+ QString result = QString::fromLatin1("QTimerEvent");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTimerEvent_throw_ambiguity_error_helper(context,
+ qtscript_QTimerEvent_function_names[_id+1],
+ qtscript_QTimerEvent_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QTimerEvent_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QTimerEvent(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QtScriptShell_QTimerEvent* _q_cpp_result = new QtScriptShell_QTimerEvent(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QTimerEvent*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTimerEvent_throw_ambiguity_error_helper(context,
+ qtscript_QTimerEvent_function_names[_id],
+ qtscript_QTimerEvent_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QTimerEvent_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QTimerEvent*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QTimerEvent*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QEvent*>()));
+ for (int i = 0; i < 2; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QTimerEvent_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QTimerEvent_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QTimerEvent*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QTimerEvent_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QTranslator.cpp b/qtbindings/com_nokia_qt_core/qtscript_QTranslator.cpp
new file mode 100644
index 0000000..ff8e381
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QTranslator.cpp
@@ -0,0 +1,266 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qtranslator.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qtranslator.h>
+
+#include "qtscriptshell_QTranslator.h"
+
+static const char * const qtscript_QTranslator_function_names[] = {
+ "QTranslator"
+ // static
+ // prototype
+ , "isEmpty"
+ , "load"
+ , "translate"
+ , "toString"
+};
+
+static const char * const qtscript_QTranslator_function_signatures[] = {
+ "QObject parent"
+ // static
+ // prototype
+ , ""
+ , "String filename, String directory, String search_delimiters, String suffix\nuchar data, int len"
+ , "char context, char sourceText, char disambiguation"
+""
+};
+
+static QScriptValue qtscript_QTranslator_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QTranslator::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QTranslator*)
+Q_DECLARE_METATYPE(QtScriptShell_QTranslator*)
+Q_DECLARE_METATYPE(uchar*)
+Q_DECLARE_METATYPE(char*)
+
+//
+// QTranslator
+//
+
+static QScriptValue qtscript_QTranslator_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 3;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QTranslator* _q_self = qscriptvalue_cast<QTranslator*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QTranslator.%0(): this object is not a QTranslator")
+ .arg(qtscript_QTranslator_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isEmpty();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->load(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ if (context->argument(0).isString()
+ && context->argument(1).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ bool _q_result = _q_self->load(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (qscriptvalue_cast<uchar*>(context->argument(0))
+ && context->argument(1).isNumber()) {
+ uchar* _q_arg0 = qscriptvalue_cast<uchar*>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ bool _q_result = _q_self->load(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 3) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QString _q_arg2 = context->argument(2).toString();
+ bool _q_result = _q_self->load(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 4) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QString _q_arg2 = context->argument(2).toString();
+ QString _q_arg3 = context->argument(3).toString();
+ bool _q_result = _q_self->load(_q_arg0, _q_arg1, _q_arg2, _q_arg3);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 2) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ char* _q_arg1 = qscriptvalue_cast<char*>(context->argument(1));
+ QString _q_result = _q_self->translate(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ char* _q_arg0 = qscriptvalue_cast<char*>(context->argument(0));
+ char* _q_arg1 = qscriptvalue_cast<char*>(context->argument(1));
+ char* _q_arg2 = qscriptvalue_cast<char*>(context->argument(2));
+ QString _q_result = _q_self->translate(_q_arg0, _q_arg1, _q_arg2);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3: {
+ QString result = QString::fromLatin1("QTranslator");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTranslator_throw_ambiguity_error_helper(context,
+ qtscript_QTranslator_function_names[_id+1],
+ qtscript_QTranslator_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QTranslator_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QTranslator(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QTranslator* _q_cpp_result = new QtScriptShell_QTranslator();
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QTranslator*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QObject* _q_arg0 = context->argument(0).toQObject();
+ QtScriptShell_QTranslator* _q_cpp_result = new QtScriptShell_QTranslator(_q_arg0);
+ QScriptValue _q_result = context->engine()->newQObject(context->thisObject(), (QTranslator*)_q_cpp_result, QScriptEngine::AutoOwnership);
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QTranslator_throw_ambiguity_error_helper(context,
+ qtscript_QTranslator_function_names[_id],
+ qtscript_QTranslator_function_signatures[_id]);
+}
+
+static QScriptValue qtscript_QTranslator_toScriptValue(QScriptEngine *engine, QTranslator* const &in)
+{
+ return engine->newQObject(in, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+static void qtscript_QTranslator_fromScriptValue(const QScriptValue &value, QTranslator* &out)
+{
+ out = qobject_cast<QTranslator*>(value.toQObject());
+}
+
+QScriptValue qtscript_create_QTranslator_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 0
+ , 4
+ , 3
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QTranslator*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QTranslator*)0));
+ proto.setPrototype(engine->defaultPrototype(qMetaTypeId<QObject*>()));
+ for (int i = 0; i < 4; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QTranslator_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QTranslator_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ qScriptRegisterMetaType<QTranslator*>(engine, qtscript_QTranslator_toScriptValue,
+ qtscript_QTranslator_fromScriptValue, proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QTranslator_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QUrl.cpp b/qtbindings/com_nokia_qt_core/qtscript_QUrl.cpp
new file mode 100644
index 0000000..3ed4d13
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QUrl.cpp
@@ -0,0 +1,1359 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qurl.h>
+#include <QStringList>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qdatastream.h>
+#include <qlist.h>
+#include <qpair.h>
+#include <qstringlist.h>
+#include <qurl.h>
+
+static const char * const qtscript_QUrl_function_names[] = {
+ "QUrl"
+ // static
+ , "fromAce"
+ , "fromEncoded"
+ , "fromLocalFile"
+ , "fromPercentEncoding"
+ , "idnWhitelist"
+ , "setIdnWhitelist"
+ , "toAce"
+ , "toPercentEncoding"
+ // prototype
+ , "addEncodedQueryItem"
+ , "addQueryItem"
+ , "allEncodedQueryItemValues"
+ , "allQueryItemValues"
+ , "authority"
+ , "clear"
+ , "encodedFragment"
+ , "encodedHost"
+ , "encodedPassword"
+ , "encodedPath"
+ , "encodedQuery"
+ , "encodedQueryItemValue"
+ , "encodedQueryItems"
+ , "encodedUserName"
+ , "errorString"
+ , "fragment"
+ , "hasEncodedQueryItem"
+ , "hasFragment"
+ , "hasQuery"
+ , "hasQueryItem"
+ , "host"
+ , "isEmpty"
+ , "isParentOf"
+ , "isRelative"
+ , "isValid"
+ , "equals"
+ , "operator_less"
+ , "password"
+ , "path"
+ , "port"
+ , "queryItemValue"
+ , "queryItems"
+ , "queryPairDelimiter"
+ , "queryValueDelimiter"
+ , "readFrom"
+ , "removeAllEncodedQueryItems"
+ , "removeAllQueryItems"
+ , "removeEncodedQueryItem"
+ , "removeQueryItem"
+ , "resolved"
+ , "scheme"
+ , "setAuthority"
+ , "setEncodedFragment"
+ , "setEncodedHost"
+ , "setEncodedPassword"
+ , "setEncodedPath"
+ , "setEncodedQuery"
+ , "setEncodedQueryItems"
+ , "setEncodedUrl"
+ , "setEncodedUserName"
+ , "setFragment"
+ , "setHost"
+ , "setPassword"
+ , "setPath"
+ , "setPort"
+ , "setQueryDelimiters"
+ , "setQueryItems"
+ , "setScheme"
+ , "setUrl"
+ , "setUserInfo"
+ , "setUserName"
+ , "toEncoded"
+ , "toLocalFile"
+ , "toString"
+ , "userInfo"
+ , "userName"
+ , "writeTo"
+};
+
+static const char * const qtscript_QUrl_function_signatures[] = {
+ "\nString url\nString url, ParsingMode mode\nQUrl copy"
+ // static
+ , "QByteArray arg__1"
+ , "QByteArray url\nQByteArray url, ParsingMode mode"
+ , "String localfile"
+ , "QByteArray arg__1"
+ , ""
+ , "List arg__1"
+ , "String arg__1"
+ , "String arg__1, QByteArray exclude, QByteArray include"
+ // prototype
+ , "QByteArray key, QByteArray value"
+ , "String key, String value"
+ , "QByteArray key"
+ , "String key"
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "QByteArray key"
+ , ""
+ , ""
+ , ""
+ , ""
+ , "QByteArray key"
+ , ""
+ , ""
+ , "String key"
+ , ""
+ , ""
+ , "QUrl url"
+ , ""
+ , ""
+ , "QUrl url"
+ , "QUrl url"
+ , ""
+ , ""
+ , "\nint defaultPort"
+ , "String key"
+ , ""
+ , ""
+ , ""
+ , "QDataStream arg__1"
+ , "QByteArray key"
+ , "String key"
+ , "QByteArray key"
+ , "String key"
+ , "QUrl relative"
+ , ""
+ , "String authority"
+ , "QByteArray fragment"
+ , "QByteArray host"
+ , "QByteArray password"
+ , "QByteArray path"
+ , "QByteArray query"
+ , "List query"
+ , "QByteArray url\nQByteArray url, ParsingMode mode"
+ , "QByteArray userName"
+ , "String fragment"
+ , "String host"
+ , "String password"
+ , "String path"
+ , "int port"
+ , "char valueDelimiter, char pairDelimiter"
+ , "List query"
+ , "String scheme"
+ , "String url\nString url, ParsingMode mode"
+ , "String userInfo"
+ , "String userName"
+ , "FormattingOptions options"
+ , ""
+ , "FormattingOptions options"
+ , ""
+ , ""
+ , "QDataStream arg__1"
+};
+
+static QScriptValue qtscript_QUrl_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QUrl::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QUrl*)
+Q_DECLARE_METATYPE(QUrl::ParsingMode)
+Q_DECLARE_METATYPE(QUrl::FormattingOption)
+Q_DECLARE_METATYPE(QFlags<QUrl::FormattingOption>)
+Q_DECLARE_METATYPE(QList<QByteArray>)
+template <> \
+struct QMetaTypeId< QPair<QByteArray,QByteArray> > \
+{ \
+ enum { Defined = 1 }; \
+ static int qt_metatype_id() \
+ { \
+ static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
+ if (!metatype_id) \
+ metatype_id = qRegisterMetaType< QPair<QByteArray,QByteArray> >("QPair<QByteArray,QByteArray>"); \
+ return metatype_id; \
+ } \
+};
+template <> \
+struct QMetaTypeId< QList<QPair<QByteArray,QByteArray> > > \
+{ \
+ enum { Defined = 1 }; \
+ static int qt_metatype_id() \
+ { \
+ static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
+ if (!metatype_id) \
+ metatype_id = qRegisterMetaType< QList<QPair<QByteArray,QByteArray> > >("QList<QPair<QByteArray,QByteArray> >"); \
+ return metatype_id; \
+ } \
+};
+template <> \
+struct QMetaTypeId< QPair<QString,QString> > \
+{ \
+ enum { Defined = 1 }; \
+ static int qt_metatype_id() \
+ { \
+ static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
+ if (!metatype_id) \
+ metatype_id = qRegisterMetaType< QPair<QString,QString> >("QPair<QString,QString>"); \
+ return metatype_id; \
+ } \
+};
+template <> \
+struct QMetaTypeId< QList<QPair<QString,QString> > > \
+{ \
+ enum { Defined = 1 }; \
+ static int qt_metatype_id() \
+ { \
+ static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
+ if (!metatype_id) \
+ metatype_id = qRegisterMetaType< QList<QPair<QString,QString> > >("QList<QPair<QString,QString> >"); \
+ return metatype_id; \
+ } \
+};
+Q_DECLARE_METATYPE(QDataStream*)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+static QScriptValue qtscript_create_flags_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString,
+ QScriptEngine::FunctionSignature equals)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("equals"),
+ engine->newFunction(equals), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto);
+}
+
+//
+// QUrl::ParsingMode
+//
+
+static const QUrl::ParsingMode qtscript_QUrl_ParsingMode_values[] = {
+ QUrl::TolerantMode
+ , QUrl::StrictMode
+};
+
+static const char * const qtscript_QUrl_ParsingMode_keys[] = {
+ "TolerantMode"
+ , "StrictMode"
+};
+
+static QString qtscript_QUrl_ParsingMode_toStringHelper(QUrl::ParsingMode value)
+{
+ if ((value >= QUrl::TolerantMode) && (value <= QUrl::StrictMode))
+ return qtscript_QUrl_ParsingMode_keys[static_cast<int>(value)-static_cast<int>(QUrl::TolerantMode)];
+ return QString();
+}
+
+static QScriptValue qtscript_QUrl_ParsingMode_toScriptValue(QScriptEngine *engine, const QUrl::ParsingMode &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QUrl"));
+ return clazz.property(qtscript_QUrl_ParsingMode_toStringHelper(value));
+}
+
+static void qtscript_QUrl_ParsingMode_fromScriptValue(const QScriptValue &value, QUrl::ParsingMode &out)
+{
+ out = qvariant_cast<QUrl::ParsingMode>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QUrl_ParsingMode(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QUrl::TolerantMode) && (arg <= QUrl::StrictMode))
+ return qScriptValueFromValue(engine, static_cast<QUrl::ParsingMode>(arg));
+ return context->throwError(QString::fromLatin1("ParsingMode(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QUrl_ParsingMode_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QUrl::ParsingMode value = qscriptvalue_cast<QUrl::ParsingMode>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QUrl_ParsingMode_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QUrl::ParsingMode value = qscriptvalue_cast<QUrl::ParsingMode>(context->thisObject());
+ return QScriptValue(engine, qtscript_QUrl_ParsingMode_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QUrl_ParsingMode_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QUrl_ParsingMode,
+ qtscript_QUrl_ParsingMode_valueOf, qtscript_QUrl_ParsingMode_toString);
+ qScriptRegisterMetaType<QUrl::ParsingMode>(engine, qtscript_QUrl_ParsingMode_toScriptValue,
+ qtscript_QUrl_ParsingMode_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QUrl_ParsingMode_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QUrl_ParsingMode_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QUrl::FormattingOption
+//
+
+static const QUrl::FormattingOption qtscript_QUrl_FormattingOption_values[] = {
+ QUrl::None
+ , QUrl::RemoveScheme
+ , QUrl::RemovePassword
+ , QUrl::RemoveUserInfo
+ , QUrl::RemovePort
+ , QUrl::RemoveAuthority
+ , QUrl::RemovePath
+ , QUrl::RemoveQuery
+ , QUrl::RemoveFragment
+ , QUrl::StripTrailingSlash
+};
+
+static const char * const qtscript_QUrl_FormattingOption_keys[] = {
+ "None"
+ , "RemoveScheme"
+ , "RemovePassword"
+ , "RemoveUserInfo"
+ , "RemovePort"
+ , "RemoveAuthority"
+ , "RemovePath"
+ , "RemoveQuery"
+ , "RemoveFragment"
+ , "StripTrailingSlash"
+};
+
+static QString qtscript_QUrl_FormattingOption_toStringHelper(QUrl::FormattingOption value)
+{
+ for (int i = 0; i < 10; ++i) {
+ if (qtscript_QUrl_FormattingOption_values[i] == value)
+ return QString::fromLatin1(qtscript_QUrl_FormattingOption_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_QUrl_FormattingOption_toScriptValue(QScriptEngine *engine, const QUrl::FormattingOption &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QUrl"));
+ return clazz.property(qtscript_QUrl_FormattingOption_toStringHelper(value));
+}
+
+static void qtscript_QUrl_FormattingOption_fromScriptValue(const QScriptValue &value, QUrl::FormattingOption &out)
+{
+ out = qvariant_cast<QUrl::FormattingOption>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QUrl_FormattingOption(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 10; ++i) {
+ if (qtscript_QUrl_FormattingOption_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<QUrl::FormattingOption>(arg));
+ }
+ return context->throwError(QString::fromLatin1("FormattingOption(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QUrl_FormattingOption_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QUrl::FormattingOption value = qscriptvalue_cast<QUrl::FormattingOption>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QUrl_FormattingOption_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QUrl::FormattingOption value = qscriptvalue_cast<QUrl::FormattingOption>(context->thisObject());
+ return QScriptValue(engine, qtscript_QUrl_FormattingOption_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QUrl_FormattingOption_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QUrl_FormattingOption,
+ qtscript_QUrl_FormattingOption_valueOf, qtscript_QUrl_FormattingOption_toString);
+ qScriptRegisterMetaType<QUrl::FormattingOption>(engine, qtscript_QUrl_FormattingOption_toScriptValue,
+ qtscript_QUrl_FormattingOption_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 10; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QUrl_FormattingOption_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QUrl_FormattingOption_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QUrl::FormattingOptions
+//
+
+static QScriptValue qtscript_QUrl_FormattingOptions_toScriptValue(QScriptEngine *engine, const QUrl::FormattingOptions &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_QUrl_FormattingOptions_fromScriptValue(const QScriptValue &value, QUrl::FormattingOptions &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<QUrl::FormattingOptions>())
+ out = qvariant_cast<QUrl::FormattingOptions>(var);
+ else if (var.userType() == qMetaTypeId<QUrl::FormattingOption>())
+ out = qvariant_cast<QUrl::FormattingOption>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_QUrl_FormattingOptions(QScriptContext *context, QScriptEngine *engine)
+{
+ QUrl::FormattingOptions result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<QUrl::FormattingOptions>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<QUrl::FormattingOption>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("FormattingOptions(): argument %0 is not of type FormattingOption").arg(i));
+ }
+ result |= qvariant_cast<QUrl::FormattingOption>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_QUrl_FormattingOptions_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QUrl::FormattingOptions value = qscriptvalue_cast<QUrl::FormattingOptions>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QUrl_FormattingOptions_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QUrl::FormattingOptions value = qscriptvalue_cast<QUrl::FormattingOptions>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 10; ++i) {
+ if ((value & qtscript_QUrl_FormattingOption_values[i]) == qtscript_QUrl_FormattingOption_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_QUrl_FormattingOption_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_QUrl_FormattingOptions_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<QUrl::FormattingOptions>() == otherObj.value<QUrl::FormattingOptions>())));
+}
+
+static QScriptValue qtscript_create_QUrl_FormattingOptions_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_QUrl_FormattingOptions, qtscript_QUrl_FormattingOptions_valueOf,
+ qtscript_QUrl_FormattingOptions_toString, qtscript_QUrl_FormattingOptions_equals);
+ qScriptRegisterMetaType<QUrl::FormattingOptions>(engine, qtscript_QUrl_FormattingOptions_toScriptValue,
+ qtscript_QUrl_FormattingOptions_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// QUrl
+//
+
+static QScriptValue qtscript_QUrl_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 67;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QUrl* _q_self = qscriptvalue_cast<QUrl*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QUrl.%0(): this object is not a QUrl")
+ .arg(qtscript_QUrl_function_names[_id+9]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 2) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QByteArray _q_arg1 = qscriptvalue_cast<QByteArray>(context->argument(1));
+ _q_self->addEncodedQueryItem(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ _q_self->addQueryItem(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QList<QByteArray> _q_result = _q_self->allEncodedQueryItemValues(_q_arg0);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QStringList _q_result = _q_self->allQueryItemValues(_q_arg0);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->authority();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ _q_self->clear();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->encodedFragment();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->encodedHost();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->encodedPassword();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->encodedPath();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->encodedQuery();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QByteArray _q_result = _q_self->encodedQueryItemValue(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 0) {
+ QList<QPair<QByteArray,QByteArray> > _q_result = _q_self->encodedQueryItems();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->encodedUserName();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->errorString();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->fragment();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ bool _q_result = _q_self->hasEncodedQueryItem(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->hasFragment();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->hasQuery();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->hasQueryItem(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->host();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 21:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isEmpty();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 22:
+ if (context->argumentCount() == 1) {
+ QUrl _q_arg0 = qscriptvalue_cast<QUrl>(context->argument(0));
+ bool _q_result = _q_self->isParentOf(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 23:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isRelative();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 24:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isValid();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 25:
+ if (context->argumentCount() == 1) {
+ QUrl _q_arg0 = qscriptvalue_cast<QUrl>(context->argument(0));
+ bool _q_result = _q_self->operator==(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 26:
+ if (context->argumentCount() == 1) {
+ QUrl _q_arg0 = qscriptvalue_cast<QUrl>(context->argument(0));
+ bool _q_result = _q_self->operator<(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 27:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->password();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 28:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->path();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 29:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->port();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_result = _q_self->port(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 30:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_result = _q_self->queryItemValue(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 31:
+ if (context->argumentCount() == 0) {
+ QList<QPair<QString,QString> > _q_result = _q_self->queryItems();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 32:
+ if (context->argumentCount() == 0) {
+ char _q_result = _q_self->queryPairDelimiter();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 33:
+ if (context->argumentCount() == 0) {
+ char _q_result = _q_self->queryValueDelimiter();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 34:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator>>(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 35:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ _q_self->removeAllEncodedQueryItems(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 36:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->removeAllQueryItems(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 37:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ _q_self->removeEncodedQueryItem(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 38:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->removeQueryItem(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 39:
+ if (context->argumentCount() == 1) {
+ QUrl _q_arg0 = qscriptvalue_cast<QUrl>(context->argument(0));
+ QUrl _q_result = _q_self->resolved(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 40:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->scheme();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 41:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setAuthority(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 42:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ _q_self->setEncodedFragment(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 43:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ _q_self->setEncodedHost(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 44:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ _q_self->setEncodedPassword(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 45:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ _q_self->setEncodedPath(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 46:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ _q_self->setEncodedQuery(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 47:
+ if (context->argumentCount() == 1) {
+ QList<QPair<QByteArray,QByteArray> > _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ _q_self->setEncodedQueryItems(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 48:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ _q_self->setEncodedUrl(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QUrl::ParsingMode _q_arg1 = qscriptvalue_cast<QUrl::ParsingMode>(context->argument(1));
+ _q_self->setEncodedUrl(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 49:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ _q_self->setEncodedUserName(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 50:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setFragment(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 51:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setHost(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 52:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setPassword(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 53:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setPath(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 54:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setPort(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 55:
+ if (context->argumentCount() == 2) {
+ char _q_arg0 = qscriptvalue_cast<char>(context->argument(0));
+ char _q_arg1 = qscriptvalue_cast<char>(context->argument(1));
+ _q_self->setQueryDelimiters(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 56:
+ if (context->argumentCount() == 1) {
+ QList<QPair<QString,QString> > _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ _q_self->setQueryItems(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 57:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setScheme(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 58:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setUrl(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QUrl::ParsingMode _q_arg1 = qscriptvalue_cast<QUrl::ParsingMode>(context->argument(1));
+ _q_self->setUrl(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 59:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setUserInfo(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 60:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->setUserName(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 61:
+ if (context->argumentCount() == 0) {
+ QByteArray _q_result = _q_self->toEncoded();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QFlags<QUrl::FormattingOption> _q_arg0 = qscriptvalue_cast<QFlags<QUrl::FormattingOption> >(context->argument(0));
+ QByteArray _q_result = _q_self->toEncoded(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 62:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->toLocalFile();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 63:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->toString();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QFlags<QUrl::FormattingOption> _q_arg0 = qscriptvalue_cast<QFlags<QUrl::FormattingOption> >(context->argument(0));
+ QString _q_result = _q_self->toString(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 64:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->userInfo();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 65:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->userName();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 66:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator<<(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QUrl_throw_ambiguity_error_helper(context,
+ qtscript_QUrl_function_names[_id+9],
+ qtscript_QUrl_function_signatures[_id+9]);
+}
+
+static QScriptValue qtscript_QUrl_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QUrl(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QUrl _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QUrl _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if ((qMetaTypeId<QUrl>() == context->argument(0).toVariant().userType())) {
+ QUrl _q_arg0 = qscriptvalue_cast<QUrl>(context->argument(0));
+ QUrl _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ } else if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QUrl::ParsingMode _q_arg1 = qscriptvalue_cast<QUrl::ParsingMode>(context->argument(1));
+ QUrl _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QString _q_result = QUrl::fromAce(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QUrl _q_result = QUrl::fromEncoded(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QUrl::ParsingMode _q_arg1 = qscriptvalue_cast<QUrl::ParsingMode>(context->argument(1));
+ QUrl _q_result = QUrl::fromEncoded(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QUrl _q_result = QUrl::fromLocalFile(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QString _q_result = QUrl::fromPercentEncoding(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QStringList _q_result = QUrl::idnWhitelist();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 1) {
+ QStringList _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ QUrl::setIdnWhitelist(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QByteArray _q_result = QUrl::toAce(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QByteArray _q_result = QUrl::toPercentEncoding(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QByteArray _q_arg1 = qscriptvalue_cast<QByteArray>(context->argument(1));
+ QByteArray _q_result = QUrl::toPercentEncoding(_q_arg0, _q_arg1);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 3) {
+ QString _q_arg0 = context->argument(0).toString();
+ QByteArray _q_arg1 = qscriptvalue_cast<QByteArray>(context->argument(1));
+ QByteArray _q_arg2 = qscriptvalue_cast<QByteArray>(context->argument(2));
+ QByteArray _q_result = QUrl::toPercentEncoding(_q_arg0, _q_arg1, _q_arg2);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QUrl_throw_ambiguity_error_helper(context,
+ qtscript_QUrl_function_names[_id],
+ qtscript_QUrl_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QUrl_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 2
+ // static
+ , 1
+ , 2
+ , 1
+ , 1
+ , 0
+ , 1
+ , 1
+ , 3
+ // prototype
+ , 2
+ , 2
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 1
+ , 1
+ , 0
+ , 0
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 2
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 2
+ , 1
+ , 1
+ , 2
+ , 1
+ , 1
+ , 1
+ , 0
+ , 1
+ , 0
+ , 0
+ , 1
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QUrl*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QUrl*)0));
+ for (int i = 0; i < 67; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QUrl_prototype_call, function_lengths[i+9]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QUrl_function_names[i+9]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QUrl>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QUrl*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QUrl_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 8; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QUrl_static_call,
+ function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_QUrl_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ ctor.setProperty(QString::fromLatin1("ParsingMode"),
+ qtscript_create_QUrl_ParsingMode_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("FormattingOption"),
+ qtscript_create_QUrl_FormattingOption_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("FormattingOptions"),
+ qtscript_create_QUrl_FormattingOptions_class(engine));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QUuid.cpp b/qtbindings/com_nokia_qt_core/qtscript_QUuid.cpp
new file mode 100644
index 0000000..bbd8aea
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QUuid.cpp
@@ -0,0 +1,466 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <quuid.h>
+#include <QVariant>
+#include <qdatastream.h>
+#include <quuid.h>
+
+#include "qtscriptshell_QUuid.h"
+
+static const char * const qtscript_QUuid_function_names[] = {
+ "QUuid"
+ // static
+ , "createUuid"
+ // prototype
+ , "isNull"
+ , "equals"
+ , "operator_less"
+ , "readFrom"
+ , "toString"
+ , "variant"
+ , "version"
+ , "writeTo"
+};
+
+static const char * const qtscript_QUuid_function_signatures[] = {
+ "\nString arg__1\nuint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8"
+ // static
+ , ""
+ // prototype
+ , ""
+ , "QUuid orig"
+ , "QUuid other"
+ , "QDataStream arg__1"
+ , ""
+ , ""
+ , ""
+ , "QDataStream arg__1"
+};
+
+static QScriptValue qtscript_QUuid_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QUuid::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QUuid)
+Q_DECLARE_METATYPE(QUuid*)
+Q_DECLARE_METATYPE(QtScriptShell_QUuid)
+Q_DECLARE_METATYPE(QtScriptShell_QUuid*)
+Q_DECLARE_METATYPE(QUuid::Variant)
+Q_DECLARE_METATYPE(QUuid::Version)
+Q_DECLARE_METATYPE(QDataStream*)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// QUuid::Variant
+//
+
+static const QUuid::Variant qtscript_QUuid_Variant_values[] = {
+ QUuid::VarUnknown
+ , QUuid::NCS
+ , QUuid::DCE
+ , QUuid::Microsoft
+ , QUuid::Reserved
+};
+
+static const char * const qtscript_QUuid_Variant_keys[] = {
+ "VarUnknown"
+ , "NCS"
+ , "DCE"
+ , "Microsoft"
+ , "Reserved"
+};
+
+static QString qtscript_QUuid_Variant_toStringHelper(QUuid::Variant value)
+{
+ for (int i = 0; i < 5; ++i) {
+ if (qtscript_QUuid_Variant_values[i] == value)
+ return QString::fromLatin1(qtscript_QUuid_Variant_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_QUuid_Variant_toScriptValue(QScriptEngine *engine, const QUuid::Variant &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QUuid"));
+ return clazz.property(qtscript_QUuid_Variant_toStringHelper(value));
+}
+
+static void qtscript_QUuid_Variant_fromScriptValue(const QScriptValue &value, QUuid::Variant &out)
+{
+ out = qvariant_cast<QUuid::Variant>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QUuid_Variant(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 5; ++i) {
+ if (qtscript_QUuid_Variant_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<QUuid::Variant>(arg));
+ }
+ return context->throwError(QString::fromLatin1("Variant(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QUuid_Variant_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QUuid::Variant value = qscriptvalue_cast<QUuid::Variant>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QUuid_Variant_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QUuid::Variant value = qscriptvalue_cast<QUuid::Variant>(context->thisObject());
+ return QScriptValue(engine, qtscript_QUuid_Variant_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QUuid_Variant_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QUuid_Variant,
+ qtscript_QUuid_Variant_valueOf, qtscript_QUuid_Variant_toString);
+ qScriptRegisterMetaType<QUuid::Variant>(engine, qtscript_QUuid_Variant_toScriptValue,
+ qtscript_QUuid_Variant_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 5; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QUuid_Variant_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QUuid_Variant_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QUuid::Version
+//
+
+static const QUuid::Version qtscript_QUuid_Version_values[] = {
+ QUuid::VerUnknown
+ , QUuid::Time
+ , QUuid::EmbeddedPOSIX
+ , QUuid::Name
+ , QUuid::Random
+};
+
+static const char * const qtscript_QUuid_Version_keys[] = {
+ "VerUnknown"
+ , "Time"
+ , "EmbeddedPOSIX"
+ , "Name"
+ , "Random"
+};
+
+static QString qtscript_QUuid_Version_toStringHelper(QUuid::Version value)
+{
+ for (int i = 0; i < 5; ++i) {
+ if (qtscript_QUuid_Version_values[i] == value)
+ return QString::fromLatin1(qtscript_QUuid_Version_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_QUuid_Version_toScriptValue(QScriptEngine *engine, const QUuid::Version &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QUuid"));
+ return clazz.property(qtscript_QUuid_Version_toStringHelper(value));
+}
+
+static void qtscript_QUuid_Version_fromScriptValue(const QScriptValue &value, QUuid::Version &out)
+{
+ out = qvariant_cast<QUuid::Version>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QUuid_Version(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 5; ++i) {
+ if (qtscript_QUuid_Version_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<QUuid::Version>(arg));
+ }
+ return context->throwError(QString::fromLatin1("Version(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QUuid_Version_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QUuid::Version value = qscriptvalue_cast<QUuid::Version>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QUuid_Version_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QUuid::Version value = qscriptvalue_cast<QUuid::Version>(context->thisObject());
+ return QScriptValue(engine, qtscript_QUuid_Version_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QUuid_Version_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QUuid_Version,
+ qtscript_QUuid_Version_valueOf, qtscript_QUuid_Version_toString);
+ qScriptRegisterMetaType<QUuid::Version>(engine, qtscript_QUuid_Version_toScriptValue,
+ qtscript_QUuid_Version_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 5; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QUuid_Version_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QUuid_Version_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QUuid
+//
+
+static QScriptValue qtscript_QUuid_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 8;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QUuid* _q_self = qscriptvalue_cast<QUuid*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QUuid.%0(): this object is not a QUuid")
+ .arg(qtscript_QUuid_function_names[_id+2]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isNull();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QUuid _q_arg0 = qscriptvalue_cast<QUuid>(context->argument(0));
+ bool _q_result = _q_self->operator==(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QUuid _q_arg0 = qscriptvalue_cast<QUuid>(context->argument(0));
+ bool _q_result = _q_self->operator<(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator>>(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->toString();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QUuid::Variant _q_result = _q_self->variant();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ QUuid::Version _q_result = _q_self->version();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 1) {
+ QDataStream* _q_arg0 = qscriptvalue_cast<QDataStream*>(context->argument(0));
+ operator<<(*_q_arg0, *_q_self);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QUuid_throw_ambiguity_error_helper(context,
+ qtscript_QUuid_function_names[_id+2],
+ qtscript_QUuid_function_signatures[_id+2]);
+}
+
+static QScriptValue qtscript_QUuid_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QUuid(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QUuid _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QUuid)_q_cpp_result));
+ _q_cpp_result.__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QtScriptShell_QUuid _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QUuid)_q_cpp_result));
+ _q_cpp_result.__qtscript_self = _q_result;
+ return _q_result;
+ } else if (context->argumentCount() == 11) {
+ uint _q_arg0 = context->argument(0).toUInt32();
+ ushort _q_arg1 = qscriptvalue_cast<ushort>(context->argument(1));
+ ushort _q_arg2 = qscriptvalue_cast<ushort>(context->argument(2));
+ uchar _q_arg3 = qscriptvalue_cast<uchar>(context->argument(3));
+ uchar _q_arg4 = qscriptvalue_cast<uchar>(context->argument(4));
+ uchar _q_arg5 = qscriptvalue_cast<uchar>(context->argument(5));
+ uchar _q_arg6 = qscriptvalue_cast<uchar>(context->argument(6));
+ uchar _q_arg7 = qscriptvalue_cast<uchar>(context->argument(7));
+ uchar _q_arg8 = qscriptvalue_cast<uchar>(context->argument(8));
+ uchar _q_arg9 = qscriptvalue_cast<uchar>(context->argument(9));
+ uchar _q_arg10 = qscriptvalue_cast<uchar>(context->argument(10));
+ QtScriptShell_QUuid _q_cpp_result(_q_arg0, _q_arg1, _q_arg2, _q_arg3, _q_arg4, _q_arg5, _q_arg6, _q_arg7, _q_arg8, _q_arg9, _q_arg10);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QUuid)_q_cpp_result));
+ _q_cpp_result.__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QUuid _q_result = QUuid::createUuid();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QUuid_throw_ambiguity_error_helper(context,
+ qtscript_QUuid_function_names[_id],
+ qtscript_QUuid_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QUuid_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 11
+ // static
+ , 0
+ // prototype
+ , 0
+ , 1
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ , 1
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QUuid*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QUuid*)0));
+ for (int i = 0; i < 8; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QUuid_prototype_call, function_lengths[i+2]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QUuid_function_names[i+2]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QUuid>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QUuid*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QUuid_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 1; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QUuid_static_call,
+ function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_QUuid_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ ctor.setProperty(QString::fromLatin1("Variant"),
+ qtscript_create_QUuid_Variant_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("Version"),
+ qtscript_create_QUuid_Version_class(engine, ctor));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QWaitCondition.cpp b/qtbindings/com_nokia_qt_core/qtscript_QWaitCondition.cpp
new file mode 100644
index 0000000..5f64d60
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QWaitCondition.cpp
@@ -0,0 +1,224 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qwaitcondition.h>
+#include <QVariant>
+#include <qmutex.h>
+#include <qreadwritelock.h>
+#include <qwaitcondition.h>
+
+static const char * const qtscript_QWaitCondition_function_names[] = {
+ "QWaitCondition"
+ // static
+ // prototype
+ , "wait"
+ , "wakeAll"
+ , "wakeOne"
+ , "toString"
+};
+
+static const char * const qtscript_QWaitCondition_function_signatures[] = {
+ ""
+ // static
+ // prototype
+ , "QMutex mutex, unsigned long time\nQReadWriteLock readWriteLock, unsigned long time"
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QWaitCondition_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QWaitCondition::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QWaitCondition*)
+Q_DECLARE_METATYPE(QMutex*)
+Q_DECLARE_METATYPE(QReadWriteLock*)
+
+//
+// QWaitCondition
+//
+
+static QScriptValue qtscript_QWaitCondition_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 3;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QWaitCondition* _q_self = qscriptvalue_cast<QWaitCondition*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QWaitCondition.%0(): this object is not a QWaitCondition")
+ .arg(qtscript_QWaitCondition_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ if (qscriptvalue_cast<QMutex*>(context->argument(0))) {
+ QMutex* _q_arg0 = qscriptvalue_cast<QMutex*>(context->argument(0));
+ bool _q_result = _q_self->wait(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (qscriptvalue_cast<QReadWriteLock*>(context->argument(0))) {
+ QReadWriteLock* _q_arg0 = qscriptvalue_cast<QReadWriteLock*>(context->argument(0));
+ bool _q_result = _q_self->wait(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ if (context->argumentCount() == 2) {
+ if (qscriptvalue_cast<QMutex*>(context->argument(0))
+ && (qMetaTypeId<ulong>() == context->argument(1).toVariant().userType())) {
+ QMutex* _q_arg0 = qscriptvalue_cast<QMutex*>(context->argument(0));
+ ulong _q_arg1 = qscriptvalue_cast<ulong>(context->argument(1));
+ bool _q_result = _q_self->wait(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ } else if (qscriptvalue_cast<QReadWriteLock*>(context->argument(0))
+ && (qMetaTypeId<ulong>() == context->argument(1).toVariant().userType())) {
+ QReadWriteLock* _q_arg0 = qscriptvalue_cast<QReadWriteLock*>(context->argument(0));
+ ulong _q_arg1 = qscriptvalue_cast<ulong>(context->argument(1));
+ bool _q_result = _q_self->wait(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ _q_self->wakeAll();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ _q_self->wakeOne();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 3: {
+ QString result = QString::fromLatin1("QWaitCondition");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QWaitCondition_throw_ambiguity_error_helper(context,
+ qtscript_QWaitCondition_function_names[_id+1],
+ qtscript_QWaitCondition_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QWaitCondition_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QWaitCondition(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QWaitCondition* _q_cpp_result = new QWaitCondition();
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QWaitCondition_throw_ambiguity_error_helper(context,
+ qtscript_QWaitCondition_function_names[_id],
+ qtscript_QWaitCondition_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QWaitCondition_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 0
+ // static
+ // prototype
+ , 2
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QWaitCondition*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QWaitCondition*)0));
+ for (int i = 0; i < 4; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QWaitCondition_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QWaitCondition_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QWaitCondition*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QWaitCondition_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamAttribute.cpp b/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamAttribute.cpp
new file mode 100644
index 0000000..6093d2a
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamAttribute.cpp
@@ -0,0 +1,280 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qxmlstream.h>
+#include <QVariant>
+#include <qxmlstream.h>
+
+static const char * const qtscript_QXmlStreamAttribute_function_names[] = {
+ "QXmlStreamAttribute"
+ // static
+ // prototype
+ , "isDefault"
+ , "name"
+ , "namespaceUri"
+ , "equals"
+ , "prefix"
+ , "qualifiedName"
+ , "value"
+ , "toString"
+};
+
+static const char * const qtscript_QXmlStreamAttribute_function_signatures[] = {
+ "\nString namespaceUri, String name, String value\nString qualifiedName, String value\nQXmlStreamAttribute arg__1"
+ // static
+ // prototype
+ , ""
+ , ""
+ , ""
+ , "QXmlStreamAttribute other"
+ , ""
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QXmlStreamAttribute_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QXmlStreamAttribute::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QXmlStreamAttribute)
+Q_DECLARE_METATYPE(QXmlStreamAttribute*)
+Q_DECLARE_METATYPE(QStringRef)
+
+//
+// QXmlStreamAttribute
+//
+
+static QScriptValue qtscript_QXmlStreamAttribute_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 7;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QXmlStreamAttribute* _q_self = qscriptvalue_cast<QXmlStreamAttribute*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QXmlStreamAttribute.%0(): this object is not a QXmlStreamAttribute")
+ .arg(qtscript_QXmlStreamAttribute_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isDefault();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->name();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->namespaceUri();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 1) {
+ QXmlStreamAttribute _q_arg0 = qscriptvalue_cast<QXmlStreamAttribute>(context->argument(0));
+ bool _q_result = _q_self->operator==(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->prefix();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->qualifiedName();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->value();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 7: {
+ QString result = QString::fromLatin1("QXmlStreamAttribute");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QXmlStreamAttribute_throw_ambiguity_error_helper(context,
+ qtscript_QXmlStreamAttribute_function_names[_id+1],
+ qtscript_QXmlStreamAttribute_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QXmlStreamAttribute_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QXmlStreamAttribute(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QXmlStreamAttribute _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QXmlStreamAttribute _q_arg0 = qscriptvalue_cast<QXmlStreamAttribute>(context->argument(0));
+ QXmlStreamAttribute _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QXmlStreamAttribute _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 3) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QString _q_arg2 = context->argument(2).toString();
+ QXmlStreamAttribute _q_cpp_result(_q_arg0, _q_arg1, _q_arg2);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QXmlStreamAttribute_throw_ambiguity_error_helper(context,
+ qtscript_QXmlStreamAttribute_function_names[_id],
+ qtscript_QXmlStreamAttribute_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QXmlStreamAttribute_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 3
+ // static
+ // prototype
+ , 0
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamAttribute*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QXmlStreamAttribute*)0));
+ for (int i = 0; i < 8; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QXmlStreamAttribute_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QXmlStreamAttribute_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamAttribute>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamAttribute*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QXmlStreamAttribute_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamAttributes.cpp b/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamAttributes.cpp
new file mode 100644
index 0000000..c1f6ad6
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamAttributes.cpp
@@ -0,0 +1,568 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qxmlstream.h>
+#include <QVariant>
+#include <qlist.h>
+#include <qvector.h>
+#include <qxmlstream.h>
+
+#include "qtscriptshell_QXmlStreamAttributes.h"
+
+static const char * const qtscript_QXmlStreamAttributes_function_names[] = {
+ "QXmlStreamAttributes"
+ // static
+ , "fromList"
+ // prototype
+ , "append"
+ , "at"
+ , "capacity"
+ , "clear"
+ , "contains"
+ , "count"
+ , "empty"
+ , "endsWith"
+ , "fill"
+ , "first"
+ , "hasAttribute"
+ , "indexOf"
+ , "isEmpty"
+ , "last"
+ , "lastIndexOf"
+ , "mid"
+ , "equals"
+ , "prepend"
+ , "remove"
+ , "replace"
+ , "reserve"
+ , "resize"
+ , "setSharable"
+ , "size"
+ , "squeeze"
+ , "startsWith"
+ , "toList"
+ , "value"
+ , "toString"
+};
+
+static const char * const qtscript_QXmlStreamAttributes_function_signatures[] = {
+ ""
+ // static
+ , "List list"
+ // prototype
+ , "String namespaceUri, String name, String value\nString qualifiedName, String value\nQXmlStreamAttribute attribute"
+ , "int i"
+ , ""
+ , ""
+ , "QXmlStreamAttribute t"
+ , "\nQXmlStreamAttribute t"
+ , ""
+ , "QXmlStreamAttribute t"
+ , "QXmlStreamAttribute t, int size"
+ , ""
+ , "String namespaceUri, String name\nString qualifiedName"
+ , "QXmlStreamAttribute t, int from"
+ , ""
+ , ""
+ , "QXmlStreamAttribute t, int from"
+ , "int pos, int length"
+ , "List v"
+ , "QXmlStreamAttribute t"
+ , "int i\nint i, int n"
+ , "int i, QXmlStreamAttribute t"
+ , "int size"
+ , "int size"
+ , "bool sharable"
+ , ""
+ , ""
+ , "QXmlStreamAttribute t"
+ , ""
+ , "String namespaceUri, String name\nString qualifiedName"
+""
+};
+
+static QScriptValue qtscript_QXmlStreamAttributes_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QXmlStreamAttributes::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QXmlStreamAttributes)
+Q_DECLARE_METATYPE(QXmlStreamAttributes*)
+Q_DECLARE_METATYPE(QtScriptShell_QXmlStreamAttributes)
+Q_DECLARE_METATYPE(QtScriptShell_QXmlStreamAttributes*)
+Q_DECLARE_METATYPE(QXmlStreamAttribute)
+Q_DECLARE_METATYPE(QVector<QXmlStreamAttribute>)
+Q_DECLARE_METATYPE(QList<QXmlStreamAttribute>)
+Q_DECLARE_METATYPE(QStringRef)
+
+//
+// QXmlStreamAttributes
+//
+
+static QScriptValue qtscript_QXmlStreamAttributes_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 28;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QXmlStreamAttributes* _q_self = qscriptvalue_cast<QXmlStreamAttributes*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QXmlStreamAttributes.%0(): this object is not a QXmlStreamAttributes")
+ .arg(qtscript_QXmlStreamAttributes_function_names[_id+2]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ QXmlStreamAttribute _q_arg0 = qscriptvalue_cast<QXmlStreamAttribute>(context->argument(0));
+ _q_self->append(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ _q_self->append(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 3) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QString _q_arg2 = context->argument(2).toString();
+ _q_self->append(_q_arg0, _q_arg1, _q_arg2);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QXmlStreamAttribute _q_result = _q_self->at(_q_arg0);
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->capacity();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ _q_self->clear();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ QXmlStreamAttribute _q_arg0 = qscriptvalue_cast<QXmlStreamAttribute>(context->argument(0));
+ bool _q_result = _q_self->contains(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->count();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 1) {
+ QXmlStreamAttribute _q_arg0 = qscriptvalue_cast<QXmlStreamAttribute>(context->argument(0));
+ int _q_result = _q_self->count(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->empty();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 1) {
+ QXmlStreamAttribute _q_arg0 = qscriptvalue_cast<QXmlStreamAttribute>(context->argument(0));
+ bool _q_result = _q_self->endsWith(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 1) {
+ QXmlStreamAttribute _q_arg0 = qscriptvalue_cast<QXmlStreamAttribute>(context->argument(0));
+ QVector<QXmlStreamAttribute> _q_result = _q_self->fill(_q_arg0);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ QXmlStreamAttribute _q_arg0 = qscriptvalue_cast<QXmlStreamAttribute>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ QVector<QXmlStreamAttribute> _q_result = _q_self->fill(_q_arg0, _q_arg1);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 0) {
+ QXmlStreamAttribute _q_result = _q_self->first();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_result = _q_self->hasAttribute(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ bool _q_result = _q_self->hasAttribute(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 1) {
+ QXmlStreamAttribute _q_arg0 = qscriptvalue_cast<QXmlStreamAttribute>(context->argument(0));
+ int _q_result = _q_self->indexOf(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ QXmlStreamAttribute _q_arg0 = qscriptvalue_cast<QXmlStreamAttribute>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_result = _q_self->indexOf(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isEmpty();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 0) {
+ QXmlStreamAttribute _q_result = _q_self->last();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 1) {
+ QXmlStreamAttribute _q_arg0 = qscriptvalue_cast<QXmlStreamAttribute>(context->argument(0));
+ int _q_result = _q_self->lastIndexOf(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ QXmlStreamAttribute _q_arg0 = qscriptvalue_cast<QXmlStreamAttribute>(context->argument(0));
+ int _q_arg1 = context->argument(1).toInt32();
+ int _q_result = _q_self->lastIndexOf(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QVector<QXmlStreamAttribute> _q_result = _q_self->mid(_q_arg0);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ QVector<QXmlStreamAttribute> _q_result = _q_self->mid(_q_arg0, _q_arg1);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 1) {
+ QVector<QXmlStreamAttribute> _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ bool _q_result = _q_self->operator==(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 1) {
+ QXmlStreamAttribute _q_arg0 = qscriptvalue_cast<QXmlStreamAttribute>(context->argument(0));
+ _q_self->prepend(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->remove(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ int _q_arg1 = context->argument(1).toInt32();
+ _q_self->remove(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 2) {
+ int _q_arg0 = context->argument(0).toInt32();
+ QXmlStreamAttribute _q_arg1 = qscriptvalue_cast<QXmlStreamAttribute>(context->argument(1));
+ _q_self->replace(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->reserve(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 21:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->resize(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 22:
+ if (context->argumentCount() == 1) {
+ bool _q_arg0 = context->argument(0).toBoolean();
+ _q_self->setSharable(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 23:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->size();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 24:
+ if (context->argumentCount() == 0) {
+ _q_self->squeeze();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 25:
+ if (context->argumentCount() == 1) {
+ QXmlStreamAttribute _q_arg0 = qscriptvalue_cast<QXmlStreamAttribute>(context->argument(0));
+ bool _q_result = _q_self->startsWith(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 26:
+ if (context->argumentCount() == 0) {
+ QList<QXmlStreamAttribute> _q_result = _q_self->toList();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 27:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QStringRef _q_result = _q_self->value(_q_arg0);
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QStringRef _q_result = _q_self->value(_q_arg0, _q_arg1);
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 28: {
+ QString result = QString::fromLatin1("QXmlStreamAttributes");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QXmlStreamAttributes_throw_ambiguity_error_helper(context,
+ qtscript_QXmlStreamAttributes_function_names[_id+2],
+ qtscript_QXmlStreamAttributes_function_signatures[_id+2]);
+}
+
+static QScriptValue qtscript_QXmlStreamAttributes_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QXmlStreamAttributes(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QXmlStreamAttributes _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QXmlStreamAttributes)_q_cpp_result));
+ _q_cpp_result.__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QList<QXmlStreamAttribute> _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ QVector<QXmlStreamAttribute> _q_result = QXmlStreamAttributes::fromList(_q_arg0);
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QXmlStreamAttributes_throw_ambiguity_error_helper(context,
+ qtscript_QXmlStreamAttributes_function_names[_id],
+ qtscript_QXmlStreamAttributes_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QXmlStreamAttributes_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 0
+ // static
+ , 1
+ // prototype
+ , 3
+ , 1
+ , 0
+ , 0
+ , 1
+ , 1
+ , 0
+ , 1
+ , 2
+ , 0
+ , 2
+ , 2
+ , 0
+ , 0
+ , 2
+ , 2
+ , 1
+ , 1
+ , 2
+ , 2
+ , 1
+ , 1
+ , 1
+ , 0
+ , 0
+ , 1
+ , 0
+ , 2
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamAttributes*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QXmlStreamAttributes*)0));
+ for (int i = 0; i < 29; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QXmlStreamAttributes_prototype_call, function_lengths[i+2]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QXmlStreamAttributes_function_names[i+2]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamAttributes>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamAttributes*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QXmlStreamAttributes_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+ for (int i = 0; i < 1; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QXmlStreamAttributes_static_call,
+ function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i+1)));
+ ctor.setProperty(QString::fromLatin1(qtscript_QXmlStreamAttributes_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamEntityDeclaration.cpp b/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamEntityDeclaration.cpp
new file mode 100644
index 0000000..8c0ee8e
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamEntityDeclaration.cpp
@@ -0,0 +1,257 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qxmlstream.h>
+#include <QVariant>
+#include <qxmlstream.h>
+
+static const char * const qtscript_QXmlStreamEntityDeclaration_function_names[] = {
+ "QXmlStreamEntityDeclaration"
+ // static
+ // prototype
+ , "name"
+ , "notationName"
+ , "equals"
+ , "publicId"
+ , "systemId"
+ , "value"
+ , "toString"
+};
+
+static const char * const qtscript_QXmlStreamEntityDeclaration_function_signatures[] = {
+ "\nQXmlStreamEntityDeclaration arg__1"
+ // static
+ // prototype
+ , ""
+ , ""
+ , "QXmlStreamEntityDeclaration other"
+ , ""
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QXmlStreamEntityDeclaration_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QXmlStreamEntityDeclaration::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QXmlStreamEntityDeclaration)
+Q_DECLARE_METATYPE(QXmlStreamEntityDeclaration*)
+Q_DECLARE_METATYPE(QStringRef)
+
+//
+// QXmlStreamEntityDeclaration
+//
+
+static QScriptValue qtscript_QXmlStreamEntityDeclaration_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 6;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QXmlStreamEntityDeclaration* _q_self = qscriptvalue_cast<QXmlStreamEntityDeclaration*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QXmlStreamEntityDeclaration.%0(): this object is not a QXmlStreamEntityDeclaration")
+ .arg(qtscript_QXmlStreamEntityDeclaration_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->name();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->notationName();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QXmlStreamEntityDeclaration _q_arg0 = qscriptvalue_cast<QXmlStreamEntityDeclaration>(context->argument(0));
+ bool _q_result = _q_self->operator==(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->publicId();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->systemId();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->value();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 6: {
+ QString result = QString::fromLatin1("QXmlStreamEntityDeclaration");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QXmlStreamEntityDeclaration_throw_ambiguity_error_helper(context,
+ qtscript_QXmlStreamEntityDeclaration_function_names[_id+1],
+ qtscript_QXmlStreamEntityDeclaration_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QXmlStreamEntityDeclaration_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QXmlStreamEntityDeclaration(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QXmlStreamEntityDeclaration _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QXmlStreamEntityDeclaration _q_arg0 = qscriptvalue_cast<QXmlStreamEntityDeclaration>(context->argument(0));
+ QXmlStreamEntityDeclaration _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QXmlStreamEntityDeclaration_throw_ambiguity_error_helper(context,
+ qtscript_QXmlStreamEntityDeclaration_function_names[_id],
+ qtscript_QXmlStreamEntityDeclaration_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QXmlStreamEntityDeclaration_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamEntityDeclaration*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QXmlStreamEntityDeclaration*)0));
+ for (int i = 0; i < 7; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QXmlStreamEntityDeclaration_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QXmlStreamEntityDeclaration_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamEntityDeclaration>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamEntityDeclaration*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QXmlStreamEntityDeclaration_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamEntityResolver.cpp b/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamEntityResolver.cpp
new file mode 100644
index 0000000..9286d4d
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamEntityResolver.cpp
@@ -0,0 +1,194 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qxmlstream.h>
+#include <QVariant>
+
+#include "qtscriptshell_QXmlStreamEntityResolver.h"
+
+static const char * const qtscript_QXmlStreamEntityResolver_function_names[] = {
+ "QXmlStreamEntityResolver"
+ // static
+ // prototype
+ , "resolveEntity"
+ , "resolveUndeclaredEntity"
+ , "toString"
+};
+
+static const char * const qtscript_QXmlStreamEntityResolver_function_signatures[] = {
+ ""
+ // static
+ // prototype
+ , "String publicId, String systemId"
+ , "String name"
+""
+};
+
+static QScriptValue qtscript_QXmlStreamEntityResolver_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QXmlStreamEntityResolver::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QXmlStreamEntityResolver*)
+Q_DECLARE_METATYPE(QtScriptShell_QXmlStreamEntityResolver*)
+
+//
+// QXmlStreamEntityResolver
+//
+
+static QScriptValue qtscript_QXmlStreamEntityResolver_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 2;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QXmlStreamEntityResolver* _q_self = qscriptvalue_cast<QXmlStreamEntityResolver*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QXmlStreamEntityResolver.%0(): this object is not a QXmlStreamEntityResolver")
+ .arg(qtscript_QXmlStreamEntityResolver_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QString _q_result = _q_self->resolveEntity(_q_arg0, _q_arg1);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_result = _q_self->resolveUndeclaredEntity(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2: {
+ QString result = QString::fromLatin1("QXmlStreamEntityResolver");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QXmlStreamEntityResolver_throw_ambiguity_error_helper(context,
+ qtscript_QXmlStreamEntityResolver_function_names[_id+1],
+ qtscript_QXmlStreamEntityResolver_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QXmlStreamEntityResolver_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QXmlStreamEntityResolver(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QtScriptShell_QXmlStreamEntityResolver* _q_cpp_result = new QtScriptShell_QXmlStreamEntityResolver();
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue((QXmlStreamEntityResolver*)_q_cpp_result));
+ _q_cpp_result->__qtscript_self = _q_result;
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QXmlStreamEntityResolver_throw_ambiguity_error_helper(context,
+ qtscript_QXmlStreamEntityResolver_function_names[_id],
+ qtscript_QXmlStreamEntityResolver_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QXmlStreamEntityResolver_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 0
+ // static
+ // prototype
+ , 2
+ , 1
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamEntityResolver*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QXmlStreamEntityResolver*)0));
+ for (int i = 0; i < 3; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QXmlStreamEntityResolver_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QXmlStreamEntityResolver_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamEntityResolver*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QXmlStreamEntityResolver_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamNamespaceDeclaration.cpp b/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamNamespaceDeclaration.cpp
new file mode 100644
index 0000000..801b05e
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamNamespaceDeclaration.cpp
@@ -0,0 +1,221 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qxmlstream.h>
+#include <QVariant>
+#include <qxmlstream.h>
+
+static const char * const qtscript_QXmlStreamNamespaceDeclaration_function_names[] = {
+ "QXmlStreamNamespaceDeclaration"
+ // static
+ // prototype
+ , "namespaceUri"
+ , "equals"
+ , "prefix"
+ , "toString"
+};
+
+static const char * const qtscript_QXmlStreamNamespaceDeclaration_function_signatures[] = {
+ "\nString prefix, String namespaceUri\nQXmlStreamNamespaceDeclaration arg__1"
+ // static
+ // prototype
+ , ""
+ , "QXmlStreamNamespaceDeclaration other"
+ , ""
+""
+};
+
+static QScriptValue qtscript_QXmlStreamNamespaceDeclaration_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QXmlStreamNamespaceDeclaration::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QXmlStreamNamespaceDeclaration)
+Q_DECLARE_METATYPE(QXmlStreamNamespaceDeclaration*)
+Q_DECLARE_METATYPE(QStringRef)
+
+//
+// QXmlStreamNamespaceDeclaration
+//
+
+static QScriptValue qtscript_QXmlStreamNamespaceDeclaration_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 3;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QXmlStreamNamespaceDeclaration* _q_self = qscriptvalue_cast<QXmlStreamNamespaceDeclaration*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QXmlStreamNamespaceDeclaration.%0(): this object is not a QXmlStreamNamespaceDeclaration")
+ .arg(qtscript_QXmlStreamNamespaceDeclaration_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->namespaceUri();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QXmlStreamNamespaceDeclaration _q_arg0 = qscriptvalue_cast<QXmlStreamNamespaceDeclaration>(context->argument(0));
+ bool _q_result = _q_self->operator==(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->prefix();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 3: {
+ QString result = QString::fromLatin1("QXmlStreamNamespaceDeclaration");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QXmlStreamNamespaceDeclaration_throw_ambiguity_error_helper(context,
+ qtscript_QXmlStreamNamespaceDeclaration_function_names[_id+1],
+ qtscript_QXmlStreamNamespaceDeclaration_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QXmlStreamNamespaceDeclaration_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QXmlStreamNamespaceDeclaration(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QXmlStreamNamespaceDeclaration _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QXmlStreamNamespaceDeclaration _q_arg0 = qscriptvalue_cast<QXmlStreamNamespaceDeclaration>(context->argument(0));
+ QXmlStreamNamespaceDeclaration _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QXmlStreamNamespaceDeclaration _q_cpp_result(_q_arg0, _q_arg1);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QXmlStreamNamespaceDeclaration_throw_ambiguity_error_helper(context,
+ qtscript_QXmlStreamNamespaceDeclaration_function_names[_id],
+ qtscript_QXmlStreamNamespaceDeclaration_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QXmlStreamNamespaceDeclaration_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 2
+ // static
+ // prototype
+ , 0
+ , 1
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamNamespaceDeclaration*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QXmlStreamNamespaceDeclaration*)0));
+ for (int i = 0; i < 4; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QXmlStreamNamespaceDeclaration_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QXmlStreamNamespaceDeclaration_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamNamespaceDeclaration>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamNamespaceDeclaration*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QXmlStreamNamespaceDeclaration_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamNotationDeclaration.cpp b/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamNotationDeclaration.cpp
new file mode 100644
index 0000000..284adc5
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamNotationDeclaration.cpp
@@ -0,0 +1,229 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qxmlstream.h>
+#include <QVariant>
+#include <qxmlstream.h>
+
+static const char * const qtscript_QXmlStreamNotationDeclaration_function_names[] = {
+ "QXmlStreamNotationDeclaration"
+ // static
+ // prototype
+ , "name"
+ , "equals"
+ , "publicId"
+ , "systemId"
+ , "toString"
+};
+
+static const char * const qtscript_QXmlStreamNotationDeclaration_function_signatures[] = {
+ "\nQXmlStreamNotationDeclaration arg__1"
+ // static
+ // prototype
+ , ""
+ , "QXmlStreamNotationDeclaration other"
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QXmlStreamNotationDeclaration_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QXmlStreamNotationDeclaration::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QXmlStreamNotationDeclaration)
+Q_DECLARE_METATYPE(QXmlStreamNotationDeclaration*)
+Q_DECLARE_METATYPE(QStringRef)
+
+//
+// QXmlStreamNotationDeclaration
+//
+
+static QScriptValue qtscript_QXmlStreamNotationDeclaration_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 4;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QXmlStreamNotationDeclaration* _q_self = qscriptvalue_cast<QXmlStreamNotationDeclaration*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QXmlStreamNotationDeclaration.%0(): this object is not a QXmlStreamNotationDeclaration")
+ .arg(qtscript_QXmlStreamNotationDeclaration_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->name();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QXmlStreamNotationDeclaration _q_arg0 = qscriptvalue_cast<QXmlStreamNotationDeclaration>(context->argument(0));
+ bool _q_result = _q_self->operator==(_q_arg0);
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->publicId();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->systemId();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 4: {
+ QString result = QString::fromLatin1("QXmlStreamNotationDeclaration");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QXmlStreamNotationDeclaration_throw_ambiguity_error_helper(context,
+ qtscript_QXmlStreamNotationDeclaration_function_names[_id+1],
+ qtscript_QXmlStreamNotationDeclaration_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QXmlStreamNotationDeclaration_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QXmlStreamNotationDeclaration(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QXmlStreamNotationDeclaration _q_cpp_result;
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ QXmlStreamNotationDeclaration _q_arg0 = qscriptvalue_cast<QXmlStreamNotationDeclaration>(context->argument(0));
+ QXmlStreamNotationDeclaration _q_cpp_result(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QXmlStreamNotationDeclaration_throw_ambiguity_error_helper(context,
+ qtscript_QXmlStreamNotationDeclaration_function_names[_id],
+ qtscript_QXmlStreamNotationDeclaration_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QXmlStreamNotationDeclaration_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 0
+ , 1
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamNotationDeclaration*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QXmlStreamNotationDeclaration*)0));
+ for (int i = 0; i < 5; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QXmlStreamNotationDeclaration_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QXmlStreamNotationDeclaration_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamNotationDeclaration>(), proto);
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamNotationDeclaration*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QXmlStreamNotationDeclaration_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamReader.cpp b/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamReader.cpp
new file mode 100644
index 0000000..6159912
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamReader.cpp
@@ -0,0 +1,942 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qxmlstream.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qiodevice.h>
+#include <qvector.h>
+#include <qxmlstream.h>
+
+static const char * const qtscript_QXmlStreamReader_function_names[] = {
+ "QXmlStreamReader"
+ // static
+ // prototype
+ , "addData"
+ , "addExtraNamespaceDeclaration"
+ , "addExtraNamespaceDeclarations"
+ , "atEnd"
+ , "attributes"
+ , "characterOffset"
+ , "clear"
+ , "columnNumber"
+ , "device"
+ , "documentEncoding"
+ , "documentVersion"
+ , "dtdName"
+ , "dtdPublicId"
+ , "dtdSystemId"
+ , "entityDeclarations"
+ , "entityResolver"
+ , "error"
+ , "errorString"
+ , "hasError"
+ , "isCDATA"
+ , "isCharacters"
+ , "isComment"
+ , "isDTD"
+ , "isEndDocument"
+ , "isEndElement"
+ , "isEntityReference"
+ , "isProcessingInstruction"
+ , "isStandaloneDocument"
+ , "isStartDocument"
+ , "isStartElement"
+ , "isWhitespace"
+ , "lineNumber"
+ , "name"
+ , "namespaceDeclarations"
+ , "namespaceProcessing"
+ , "namespaceUri"
+ , "notationDeclarations"
+ , "prefix"
+ , "processingInstructionData"
+ , "processingInstructionTarget"
+ , "qualifiedName"
+ , "raiseError"
+ , "readElementText"
+ , "readNext"
+ , "setDevice"
+ , "setEntityResolver"
+ , "setNamespaceProcessing"
+ , "text"
+ , "tokenString"
+ , "tokenType"
+ , "toString"
+};
+
+static const char * const qtscript_QXmlStreamReader_function_signatures[] = {
+ "\nQIODevice device\nQByteArray data\nString data"
+ // static
+ // prototype
+ , "QByteArray data\nString data"
+ , "QXmlStreamNamespaceDeclaration extraNamespaceDeclaraction"
+ , "List extraNamespaceDeclaractions"
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , ""
+ , "String message"
+ , ""
+ , ""
+ , "QIODevice device"
+ , "QXmlStreamEntityResolver resolver"
+ , "bool arg__1"
+ , ""
+ , ""
+ , ""
+""
+};
+
+static QScriptValue qtscript_QXmlStreamReader_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QXmlStreamReader::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QXmlStreamReader*)
+Q_DECLARE_METATYPE(QXmlStreamReader::Error)
+Q_DECLARE_METATYPE(QXmlStreamReader::TokenType)
+Q_DECLARE_METATYPE(QXmlStreamNamespaceDeclaration)
+Q_DECLARE_METATYPE(QVector<QXmlStreamNamespaceDeclaration>)
+Q_DECLARE_METATYPE(QXmlStreamAttributes)
+Q_DECLARE_METATYPE(QIODevice*)
+Q_DECLARE_METATYPE(QStringRef)
+Q_DECLARE_METATYPE(QXmlStreamEntityDeclaration)
+Q_DECLARE_METATYPE(QVector<QXmlStreamEntityDeclaration>)
+Q_DECLARE_METATYPE(QXmlStreamEntityResolver*)
+Q_DECLARE_METATYPE(QXmlStreamNotationDeclaration)
+Q_DECLARE_METATYPE(QVector<QXmlStreamNotationDeclaration>)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+//
+// QXmlStreamReader::Error
+//
+
+static const QXmlStreamReader::Error qtscript_QXmlStreamReader_Error_values[] = {
+ QXmlStreamReader::NoError
+ , QXmlStreamReader::UnexpectedElementError
+ , QXmlStreamReader::CustomError
+ , QXmlStreamReader::NotWellFormedError
+ , QXmlStreamReader::PrematureEndOfDocumentError
+};
+
+static const char * const qtscript_QXmlStreamReader_Error_keys[] = {
+ "NoError"
+ , "UnexpectedElementError"
+ , "CustomError"
+ , "NotWellFormedError"
+ , "PrematureEndOfDocumentError"
+};
+
+static QString qtscript_QXmlStreamReader_Error_toStringHelper(QXmlStreamReader::Error value)
+{
+ if ((value >= QXmlStreamReader::NoError) && (value <= QXmlStreamReader::PrematureEndOfDocumentError))
+ return qtscript_QXmlStreamReader_Error_keys[static_cast<int>(value)-static_cast<int>(QXmlStreamReader::NoError)];
+ return QString();
+}
+
+static QScriptValue qtscript_QXmlStreamReader_Error_toScriptValue(QScriptEngine *engine, const QXmlStreamReader::Error &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QXmlStreamReader"));
+ return clazz.property(qtscript_QXmlStreamReader_Error_toStringHelper(value));
+}
+
+static void qtscript_QXmlStreamReader_Error_fromScriptValue(const QScriptValue &value, QXmlStreamReader::Error &out)
+{
+ out = qvariant_cast<QXmlStreamReader::Error>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QXmlStreamReader_Error(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QXmlStreamReader::NoError) && (arg <= QXmlStreamReader::PrematureEndOfDocumentError))
+ return qScriptValueFromValue(engine, static_cast<QXmlStreamReader::Error>(arg));
+ return context->throwError(QString::fromLatin1("Error(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QXmlStreamReader_Error_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QXmlStreamReader::Error value = qscriptvalue_cast<QXmlStreamReader::Error>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QXmlStreamReader_Error_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QXmlStreamReader::Error value = qscriptvalue_cast<QXmlStreamReader::Error>(context->thisObject());
+ return QScriptValue(engine, qtscript_QXmlStreamReader_Error_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QXmlStreamReader_Error_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QXmlStreamReader_Error,
+ qtscript_QXmlStreamReader_Error_valueOf, qtscript_QXmlStreamReader_Error_toString);
+ qScriptRegisterMetaType<QXmlStreamReader::Error>(engine, qtscript_QXmlStreamReader_Error_toScriptValue,
+ qtscript_QXmlStreamReader_Error_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 5; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QXmlStreamReader_Error_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QXmlStreamReader_Error_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QXmlStreamReader::TokenType
+//
+
+static const QXmlStreamReader::TokenType qtscript_QXmlStreamReader_TokenType_values[] = {
+ QXmlStreamReader::NoToken
+ , QXmlStreamReader::Invalid
+ , QXmlStreamReader::StartDocument
+ , QXmlStreamReader::EndDocument
+ , QXmlStreamReader::StartElement
+ , QXmlStreamReader::EndElement
+ , QXmlStreamReader::Characters
+ , QXmlStreamReader::Comment
+ , QXmlStreamReader::DTD
+ , QXmlStreamReader::EntityReference
+ , QXmlStreamReader::ProcessingInstruction
+};
+
+static const char * const qtscript_QXmlStreamReader_TokenType_keys[] = {
+ "NoToken"
+ , "Invalid"
+ , "StartDocument"
+ , "EndDocument"
+ , "StartElement"
+ , "EndElement"
+ , "Characters"
+ , "Comment"
+ , "DTD"
+ , "EntityReference"
+ , "ProcessingInstruction"
+};
+
+static QString qtscript_QXmlStreamReader_TokenType_toStringHelper(QXmlStreamReader::TokenType value)
+{
+ if ((value >= QXmlStreamReader::NoToken) && (value <= QXmlStreamReader::ProcessingInstruction))
+ return qtscript_QXmlStreamReader_TokenType_keys[static_cast<int>(value)-static_cast<int>(QXmlStreamReader::NoToken)];
+ return QString();
+}
+
+static QScriptValue qtscript_QXmlStreamReader_TokenType_toScriptValue(QScriptEngine *engine, const QXmlStreamReader::TokenType &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("QXmlStreamReader"));
+ return clazz.property(qtscript_QXmlStreamReader_TokenType_toStringHelper(value));
+}
+
+static void qtscript_QXmlStreamReader_TokenType_fromScriptValue(const QScriptValue &value, QXmlStreamReader::TokenType &out)
+{
+ out = qvariant_cast<QXmlStreamReader::TokenType>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_QXmlStreamReader_TokenType(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= QXmlStreamReader::NoToken) && (arg <= QXmlStreamReader::ProcessingInstruction))
+ return qScriptValueFromValue(engine, static_cast<QXmlStreamReader::TokenType>(arg));
+ return context->throwError(QString::fromLatin1("TokenType(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_QXmlStreamReader_TokenType_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ QXmlStreamReader::TokenType value = qscriptvalue_cast<QXmlStreamReader::TokenType>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_QXmlStreamReader_TokenType_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ QXmlStreamReader::TokenType value = qscriptvalue_cast<QXmlStreamReader::TokenType>(context->thisObject());
+ return QScriptValue(engine, qtscript_QXmlStreamReader_TokenType_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_QXmlStreamReader_TokenType_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_QXmlStreamReader_TokenType,
+ qtscript_QXmlStreamReader_TokenType_valueOf, qtscript_QXmlStreamReader_TokenType_toString);
+ qScriptRegisterMetaType<QXmlStreamReader::TokenType>(engine, qtscript_QXmlStreamReader_TokenType_toScriptValue,
+ qtscript_QXmlStreamReader_TokenType_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 11; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_QXmlStreamReader_TokenType_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_QXmlStreamReader_TokenType_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// QXmlStreamReader
+//
+
+static QScriptValue qtscript_QXmlStreamReader_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 50;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QXmlStreamReader* _q_self = qscriptvalue_cast<QXmlStreamReader*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QXmlStreamReader.%0(): this object is not a QXmlStreamReader")
+ .arg(qtscript_QXmlStreamReader_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 1) {
+ if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ _q_self->addData(_q_arg0);
+ return context->engine()->undefinedValue();
+ } else if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->addData(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 1) {
+ QXmlStreamNamespaceDeclaration _q_arg0 = qscriptvalue_cast<QXmlStreamNamespaceDeclaration>(context->argument(0));
+ _q_self->addExtraNamespaceDeclaration(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 1) {
+ QVector<QXmlStreamNamespaceDeclaration> _q_arg0;
+ qScriptValueToSequence(context->argument(0), _q_arg0);
+ _q_self->addExtraNamespaceDeclarations(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->atEnd();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 0) {
+ QXmlStreamAttributes _q_result = _q_self->attributes();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 0) {
+ qint64 _q_result = _q_self->characterOffset();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 0) {
+ _q_self->clear();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 0) {
+ qint64 _q_result = _q_self->columnNumber();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 0) {
+ QIODevice* _q_result = _q_self->device();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->documentEncoding();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->documentVersion();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->dtdName();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->dtdPublicId();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->dtdSystemId();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 0) {
+ QVector<QXmlStreamEntityDeclaration> _q_result = _q_self->entityDeclarations();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 0) {
+ QXmlStreamEntityResolver* _q_result = _q_self->entityResolver();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 0) {
+ QXmlStreamReader::Error _q_result = _q_self->error();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->errorString();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->hasError();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isCDATA();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isCharacters();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 21:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isComment();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 22:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isDTD();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 23:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isEndDocument();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 24:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isEndElement();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 25:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isEntityReference();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 26:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isProcessingInstruction();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 27:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isStandaloneDocument();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 28:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isStartDocument();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 29:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isStartElement();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 30:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->isWhitespace();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 31:
+ if (context->argumentCount() == 0) {
+ qint64 _q_result = _q_self->lineNumber();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 32:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->name();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 33:
+ if (context->argumentCount() == 0) {
+ QVector<QXmlStreamNamespaceDeclaration> _q_result = _q_self->namespaceDeclarations();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 34:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->namespaceProcessing();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 35:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->namespaceUri();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 36:
+ if (context->argumentCount() == 0) {
+ QVector<QXmlStreamNotationDeclaration> _q_result = _q_self->notationDeclarations();
+ return qScriptValueFromSequence(context->engine(), _q_result);
+ }
+ break;
+
+ case 37:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->prefix();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 38:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->processingInstructionData();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 39:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->processingInstructionTarget();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 40:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->qualifiedName();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 41:
+ if (context->argumentCount() == 0) {
+ _q_self->raiseError();
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->raiseError(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 42:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->readElementText();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 43:
+ if (context->argumentCount() == 0) {
+ QXmlStreamReader::TokenType _q_result = _q_self->readNext();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 44:
+ if (context->argumentCount() == 1) {
+ QIODevice* _q_arg0 = qscriptvalue_cast<QIODevice*>(context->argument(0));
+ _q_self->setDevice(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 45:
+ if (context->argumentCount() == 1) {
+ QXmlStreamEntityResolver* _q_arg0 = qscriptvalue_cast<QXmlStreamEntityResolver*>(context->argument(0));
+ _q_self->setEntityResolver(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 46:
+ if (context->argumentCount() == 1) {
+ bool _q_arg0 = context->argument(0).toBoolean();
+ _q_self->setNamespaceProcessing(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 47:
+ if (context->argumentCount() == 0) {
+ QStringRef _q_result = _q_self->text();
+
+ // TEMPLATE - core.convert_stringref_to_string - START
+ QString _q_convertedResult = _q_result.toString();
+ // TEMPLATE - core.convert_stringref_to_string - END
+ return qScriptValueFromValue(context->engine(), _q_convertedResult);
+ }
+ break;
+
+ case 48:
+ if (context->argumentCount() == 0) {
+ QString _q_result = _q_self->tokenString();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 49:
+ if (context->argumentCount() == 0) {
+ QXmlStreamReader::TokenType _q_result = _q_self->tokenType();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 50: {
+ QString result = QString::fromLatin1("QXmlStreamReader");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QXmlStreamReader_throw_ambiguity_error_helper(context,
+ qtscript_QXmlStreamReader_function_names[_id+1],
+ qtscript_QXmlStreamReader_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QXmlStreamReader_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QXmlStreamReader(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QXmlStreamReader* _q_cpp_result = new QXmlStreamReader();
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ if (qscriptvalue_cast<QIODevice*>(context->argument(0))) {
+ QIODevice* _q_arg0 = qscriptvalue_cast<QIODevice*>(context->argument(0));
+ QXmlStreamReader* _q_cpp_result = new QXmlStreamReader(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if ((qMetaTypeId<QByteArray>() == context->argument(0).toVariant().userType())) {
+ QByteArray _q_arg0 = qscriptvalue_cast<QByteArray>(context->argument(0));
+ QXmlStreamReader* _q_cpp_result = new QXmlStreamReader(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argument(0).isString()) {
+ QString _q_arg0 = context->argument(0).toString();
+ QXmlStreamReader* _q_cpp_result = new QXmlStreamReader(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QXmlStreamReader_throw_ambiguity_error_helper(context,
+ qtscript_QXmlStreamReader_function_names[_id],
+ qtscript_QXmlStreamReader_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QXmlStreamReader_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 1
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 0
+ , 0
+ , 1
+ , 1
+ , 1
+ , 0
+ , 0
+ , 0
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamReader*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QXmlStreamReader*)0));
+ for (int i = 0; i < 51; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QXmlStreamReader_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QXmlStreamReader_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamReader*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QXmlStreamReader_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ ctor.setProperty(QString::fromLatin1("Error"),
+ qtscript_create_QXmlStreamReader_Error_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("TokenType"),
+ qtscript_create_QXmlStreamReader_TokenType_class(engine, ctor));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamWriter.cpp b/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamWriter.cpp
new file mode 100644
index 0000000..1d80bf8
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_QXmlStreamWriter.cpp
@@ -0,0 +1,524 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qxmlstream.h>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qiodevice.h>
+#include <qtextcodec.h>
+#include <qxmlstream.h>
+
+static const char * const qtscript_QXmlStreamWriter_function_names[] = {
+ "QXmlStreamWriter"
+ // static
+ // prototype
+ , "autoFormatting"
+ , "autoFormattingIndent"
+ , "codec"
+ , "device"
+ , "setAutoFormatting"
+ , "setAutoFormattingIndent"
+ , "setCodec"
+ , "setDevice"
+ , "writeAttribute"
+ , "writeAttributes"
+ , "writeCDATA"
+ , "writeCharacters"
+ , "writeComment"
+ , "writeCurrentToken"
+ , "writeDTD"
+ , "writeDefaultNamespace"
+ , "writeEmptyElement"
+ , "writeEndDocument"
+ , "writeEndElement"
+ , "writeEntityReference"
+ , "writeNamespace"
+ , "writeProcessingInstruction"
+ , "writeStartDocument"
+ , "writeStartElement"
+ , "writeTextElement"
+ , "toString"
+};
+
+static const char * const qtscript_QXmlStreamWriter_function_signatures[] = {
+ "\nQByteArray array\nQIODevice device"
+ // static
+ // prototype
+ , ""
+ , ""
+ , ""
+ , ""
+ , "bool arg__1"
+ , "int spacesOrTabs"
+ , "QTextCodec codec\nchar codecName"
+ , "QIODevice device"
+ , "String namespaceUri, String name, String value\nString qualifiedName, String value\nQXmlStreamAttribute attribute"
+ , "QXmlStreamAttributes attributes"
+ , "String text"
+ , "String text"
+ , "String text"
+ , "QXmlStreamReader reader"
+ , "String dtd"
+ , "String namespaceUri"
+ , "String namespaceUri, String name\nString qualifiedName"
+ , ""
+ , ""
+ , "String name"
+ , "String namespaceUri, String prefix"
+ , "String target, String data"
+ , "\nString version\nString version, bool standalone"
+ , "String namespaceUri, String name\nString qualifiedName"
+ , "String namespaceUri, String name, String text\nString qualifiedName, String text"
+""
+};
+
+static QScriptValue qtscript_QXmlStreamWriter_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("QXmlStreamWriter::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+Q_DECLARE_METATYPE(QXmlStreamWriter*)
+Q_DECLARE_METATYPE(QTextCodec*)
+Q_DECLARE_METATYPE(QIODevice*)
+Q_DECLARE_METATYPE(QXmlStreamAttribute)
+Q_DECLARE_METATYPE(QXmlStreamAttributes)
+Q_DECLARE_METATYPE(QXmlStreamReader*)
+Q_DECLARE_METATYPE(QByteArray*)
+
+//
+// QXmlStreamWriter
+//
+
+static QScriptValue qtscript_QXmlStreamWriter_prototype_call(QScriptContext *context, QScriptEngine *)
+{
+#if QT_VERSION > 0x040400
+ Q_ASSERT(context->callee().isFunction());
+ uint _id = context->callee().data().toUInt32();
+#else
+ uint _id;
+ if (context->callee().isFunction())
+ _id = context->callee().data().toUInt32();
+ else
+ _id = 0xBABE0000 + 25;
+#endif
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ QXmlStreamWriter* _q_self = qscriptvalue_cast<QXmlStreamWriter*>(context->thisObject());
+ if (!_q_self) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("QXmlStreamWriter.%0(): this object is not a QXmlStreamWriter")
+ .arg(qtscript_QXmlStreamWriter_function_names[_id+1]));
+ }
+
+ switch (_id) {
+ case 0:
+ if (context->argumentCount() == 0) {
+ bool _q_result = _q_self->autoFormatting();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 1:
+ if (context->argumentCount() == 0) {
+ int _q_result = _q_self->autoFormattingIndent();
+ return QScriptValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 2:
+ if (context->argumentCount() == 0) {
+ QTextCodec* _q_result = _q_self->codec();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 3:
+ if (context->argumentCount() == 0) {
+ QIODevice* _q_result = _q_self->device();
+ return qScriptValueFromValue(context->engine(), _q_result);
+ }
+ break;
+
+ case 4:
+ if (context->argumentCount() == 1) {
+ bool _q_arg0 = context->argument(0).toBoolean();
+ _q_self->setAutoFormatting(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 5:
+ if (context->argumentCount() == 1) {
+ int _q_arg0 = context->argument(0).toInt32();
+ _q_self->setAutoFormattingIndent(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 6:
+ if (context->argumentCount() == 1) {
+ if (qscriptvalue_cast<QTextCodec*>(context->argument(0))) {
+ QTextCodec* _q_arg0 = qscriptvalue_cast<QTextCodec*>(context->argument(0));
+ _q_self->setCodec(_q_arg0);
+ return context->engine()->undefinedValue();
+ } else if (context->argument(0).isString()) {
+
+ // TEMPLATE - core.convert_string_arg_to_char* - START
+ QByteArray tmp__q_arg0 = context->argument(0).toString().toLatin1();
+ const char * _q_arg0 = tmp__q_arg0.constData();
+ // TEMPLATE - core.convert_string_arg_to_char* - END
+ _q_self->setCodec(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ }
+ break;
+
+ case 7:
+ if (context->argumentCount() == 1) {
+ QIODevice* _q_arg0 = qscriptvalue_cast<QIODevice*>(context->argument(0));
+ _q_self->setDevice(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 8:
+ if (context->argumentCount() == 1) {
+ QXmlStreamAttribute _q_arg0 = qscriptvalue_cast<QXmlStreamAttribute>(context->argument(0));
+ _q_self->writeAttribute(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ _q_self->writeAttribute(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 3) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QString _q_arg2 = context->argument(2).toString();
+ _q_self->writeAttribute(_q_arg0, _q_arg1, _q_arg2);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 9:
+ if (context->argumentCount() == 1) {
+ QXmlStreamAttributes _q_arg0 = qscriptvalue_cast<QXmlStreamAttributes>(context->argument(0));
+ _q_self->writeAttributes(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 10:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->writeCDATA(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 11:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->writeCharacters(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 12:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->writeComment(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 13:
+ if (context->argumentCount() == 1) {
+
+ QXmlStreamReader & _q_arg0 = *qscriptvalue_cast<QXmlStreamReader*>(context->argument(0));
+ _q_self->writeCurrentToken(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 14:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->writeDTD(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 15:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->writeDefaultNamespace(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 16:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->writeEmptyElement(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ _q_self->writeEmptyElement(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 17:
+ if (context->argumentCount() == 0) {
+ _q_self->writeEndDocument();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 18:
+ if (context->argumentCount() == 0) {
+ _q_self->writeEndElement();
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 19:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->writeEntityReference(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 20:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->writeNamespace(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ _q_self->writeNamespace(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 21:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->writeProcessingInstruction(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ _q_self->writeProcessingInstruction(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 22:
+ if (context->argumentCount() == 0) {
+ _q_self->writeStartDocument();
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->writeStartDocument(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ bool _q_arg1 = context->argument(1).toBoolean();
+ _q_self->writeStartDocument(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 23:
+ if (context->argumentCount() == 1) {
+ QString _q_arg0 = context->argument(0).toString();
+ _q_self->writeStartElement(_q_arg0);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ _q_self->writeStartElement(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 24:
+ if (context->argumentCount() == 2) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ _q_self->writeTextElement(_q_arg0, _q_arg1);
+ return context->engine()->undefinedValue();
+ }
+ if (context->argumentCount() == 3) {
+ QString _q_arg0 = context->argument(0).toString();
+ QString _q_arg1 = context->argument(1).toString();
+ QString _q_arg2 = context->argument(2).toString();
+ _q_self->writeTextElement(_q_arg0, _q_arg1, _q_arg2);
+ return context->engine()->undefinedValue();
+ }
+ break;
+
+ case 25: {
+ QString result = QString::fromLatin1("QXmlStreamWriter");
+ return QScriptValue(context->engine(), result);
+ }
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QXmlStreamWriter_throw_ambiguity_error_helper(context,
+ qtscript_QXmlStreamWriter_function_names[_id+1],
+ qtscript_QXmlStreamWriter_function_signatures[_id+1]);
+}
+
+static QScriptValue qtscript_QXmlStreamWriter_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ if (context->thisObject().strictlyEquals(context->engine()->globalObject())) {
+ return context->throwError(QString::fromLatin1("QXmlStreamWriter(): Did you forget to construct with 'new'?"));
+ }
+ if (context->argumentCount() == 0) {
+ QXmlStreamWriter* _q_cpp_result = new QXmlStreamWriter();
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (context->argumentCount() == 1) {
+ if (qscriptvalue_cast<QByteArray*>(context->argument(0))) {
+ QByteArray* _q_arg0 = qscriptvalue_cast<QByteArray*>(context->argument(0));
+ QXmlStreamWriter* _q_cpp_result = new QXmlStreamWriter(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ } else if (qscriptvalue_cast<QIODevice*>(context->argument(0))) {
+ QIODevice* _q_arg0 = qscriptvalue_cast<QIODevice*>(context->argument(0));
+ QXmlStreamWriter* _q_cpp_result = new QXmlStreamWriter(_q_arg0);
+ QScriptValue _q_result = context->engine()->newVariant(context->thisObject(), qVariantFromValue(_q_cpp_result));
+ return _q_result;
+ }
+ }
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_QXmlStreamWriter_throw_ambiguity_error_helper(context,
+ qtscript_QXmlStreamWriter_function_names[_id],
+ qtscript_QXmlStreamWriter_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_QXmlStreamWriter_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 1
+ // static
+ // prototype
+ , 0
+ , 0
+ , 0
+ , 0
+ , 1
+ , 1
+ , 1
+ , 1
+ , 3
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 1
+ , 2
+ , 0
+ , 0
+ , 1
+ , 2
+ , 2
+ , 2
+ , 2
+ , 3
+ , 0
+ };
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamWriter*>(), QScriptValue());
+ QScriptValue proto = engine->newVariant(qVariantFromValue((QXmlStreamWriter*)0));
+ for (int i = 0; i < 26; ++i) {
+ QScriptValue fun = engine->newFunction(qtscript_QXmlStreamWriter_prototype_call, function_lengths[i+1]);
+ fun.setData(QScriptValue(engine, uint(0xBABE0000 + i)));
+ proto.setProperty(QString::fromLatin1(qtscript_QXmlStreamWriter_function_names[i+1]),
+ fun, QScriptValue::SkipInEnumeration);
+ }
+
+ engine->setDefaultPrototype(qMetaTypeId<QXmlStreamWriter*>(), proto);
+
+ QScriptValue ctor = engine->newFunction(qtscript_QXmlStreamWriter_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscript_Qt.cpp b/qtbindings/com_nokia_qt_core/qtscript_Qt.cpp
new file mode 100644
index 0000000..5be9246
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscript_Qt.cpp
@@ -0,0 +1,7259 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtScript/QScriptEngine>
+#include <QtScript/QScriptContext>
+#include <QtScript/QScriptValue>
+#include <QtCore/QStringList>
+#include <QtCore/QDebug>
+#include <qmetaobject.h>
+
+#include <qnamespace.h>
+#include <QTextDocument>
+#include <QVariant>
+
+static const char * const qtscript_Qt_function_names[] = {
+ "Qt"
+ // static
+ // prototype
+ , "toString"
+};
+
+static const char * const qtscript_Qt_function_signatures[] = {
+ ""
+ // static
+ // prototype
+""
+};
+
+static QScriptValue qtscript_Qt_throw_ambiguity_error_helper(
+ QScriptContext *context, const char *functionName, const char *signatures)
+{
+ QStringList lines = QString::fromLatin1(signatures).split(QLatin1Char('\n'));
+ QStringList fullSignatures;
+ for (int i = 0; i < lines.size(); ++i)
+ fullSignatures.append(QString::fromLatin1("%0(%1)").arg(functionName).arg(lines.at(i)));
+ return context->throwError(QString::fromLatin1("Qt::%0(): could not find a function match; candidates are:\n%1")
+ .arg(functionName).arg(fullSignatures.join(QLatin1String("\n"))));
+}
+
+struct qtscript_Qt_metaObject_helper : private QObject
+{
+ static const QMetaObject *get()
+ { return &static_cast<qtscript_Qt_metaObject_helper*>(0)->staticQtMetaObject; }
+};
+
+static const QMetaObject *qtscript_Qt_metaObject()
+{
+ return qtscript_Qt_metaObject_helper::get();
+}
+
+Q_DECLARE_METATYPE(Qt::CursorShape)
+Q_DECLARE_METATYPE(Qt::Corner)
+Q_DECLARE_METATYPE(Qt::Axis)
+Q_DECLARE_METATYPE(Qt::Orientation)
+Q_DECLARE_METATYPE(QFlags<Qt::Orientation>)
+Q_DECLARE_METATYPE(Qt::LayoutDirection)
+Q_DECLARE_METATYPE(Qt::BGMode)
+Q_DECLARE_METATYPE(Qt::AspectRatioMode)
+Q_DECLARE_METATYPE(Qt::TextElideMode)
+Q_DECLARE_METATYPE(Qt::SizeMode)
+Q_DECLARE_METATYPE(Qt::WindowType)
+Q_DECLARE_METATYPE(QFlags<Qt::WindowType>)
+Q_DECLARE_METATYPE(Qt::ItemDataRole)
+Q_DECLARE_METATYPE(Qt::SortOrder)
+Q_DECLARE_METATYPE(Qt::MatchFlag)
+Q_DECLARE_METATYPE(QFlags<Qt::MatchFlag>)
+Q_DECLARE_METATYPE(Qt::PenJoinStyle)
+Q_DECLARE_METATYPE(Qt::CaseSensitivity)
+Q_DECLARE_METATYPE(Qt::BrushStyle)
+Q_DECLARE_METATYPE(Qt::ClipOperation)
+Q_DECLARE_METATYPE(Qt::FocusReason)
+Q_DECLARE_METATYPE(Qt::ToolBarArea)
+Q_DECLARE_METATYPE(QFlags<Qt::ToolBarArea>)
+Q_DECLARE_METATYPE(Qt::KeyboardModifier)
+Q_DECLARE_METATYPE(QFlags<Qt::KeyboardModifier>)
+Q_DECLARE_METATYPE(Qt::WhiteSpaceMode)
+Q_DECLARE_METATYPE(Qt::DayOfWeek)
+Q_DECLARE_METATYPE(Qt::EventPriority)
+Q_DECLARE_METATYPE(Qt::DateFormat)
+Q_DECLARE_METATYPE(Qt::MaskMode)
+Q_DECLARE_METATYPE(Qt::UIEffect)
+Q_DECLARE_METATYPE(Qt::ContextMenuPolicy)
+Q_DECLARE_METATYPE(Qt::AnchorAttribute)
+Q_DECLARE_METATYPE(Qt::ScrollBarPolicy)
+Q_DECLARE_METATYPE(Qt::ToolButtonStyle)
+Q_DECLARE_METATYPE(Qt::TextFlag)
+Q_DECLARE_METATYPE(Qt::ItemSelectionMode)
+Q_DECLARE_METATYPE(Qt::SizeHint)
+Q_DECLARE_METATYPE(Qt::Key)
+Q_DECLARE_METATYPE(Qt::ToolBarAreaSizes)
+Q_DECLARE_METATYPE(Qt::ArrowType)
+Q_DECLARE_METATYPE(Qt::FocusPolicy)
+Q_DECLARE_METATYPE(Qt::WindowFrameSection)
+Q_DECLARE_METATYPE(Qt::InputMethodQuery)
+Q_DECLARE_METATYPE(Qt::DropAction)
+Q_DECLARE_METATYPE(QFlags<Qt::DropAction>)
+Q_DECLARE_METATYPE(Qt::FillRule)
+Q_DECLARE_METATYPE(Qt::GlobalColor)
+Q_DECLARE_METATYPE(Qt::ConnectionType)
+Q_DECLARE_METATYPE(Qt::PenCapStyle)
+Q_DECLARE_METATYPE(Qt::TransformationMode)
+Q_DECLARE_METATYPE(Qt::DockWidgetAreaSizes)
+Q_DECLARE_METATYPE(Qt::ApplicationAttribute)
+Q_DECLARE_METATYPE(Qt::ShortcutContext)
+Q_DECLARE_METATYPE(Qt::TextInteractionFlag)
+Q_DECLARE_METATYPE(QFlags<Qt::TextInteractionFlag>)
+Q_DECLARE_METATYPE(Qt::CheckState)
+Q_DECLARE_METATYPE(Qt::DockWidgetArea)
+Q_DECLARE_METATYPE(QFlags<Qt::DockWidgetArea>)
+Q_DECLARE_METATYPE(Qt::TimeSpec)
+Q_DECLARE_METATYPE(Qt::ImageConversionFlag)
+Q_DECLARE_METATYPE(QFlags<Qt::ImageConversionFlag>)
+Q_DECLARE_METATYPE(Qt::WindowModality)
+Q_DECLARE_METATYPE(Qt::Modifier)
+Q_DECLARE_METATYPE(Qt::AlignmentFlag)
+Q_DECLARE_METATYPE(QFlags<Qt::AlignmentFlag>)
+Q_DECLARE_METATYPE(Qt::WidgetAttribute)
+Q_DECLARE_METATYPE(Qt::TextFormat)
+Q_DECLARE_METATYPE(Qt::MouseButton)
+Q_DECLARE_METATYPE(QFlags<Qt::MouseButton>)
+Q_DECLARE_METATYPE(Qt::WindowState)
+Q_DECLARE_METATYPE(QFlags<Qt::WindowState>)
+Q_DECLARE_METATYPE(Qt::PenStyle)
+Q_DECLARE_METATYPE(Qt::ItemFlag)
+Q_DECLARE_METATYPE(QFlags<Qt::ItemFlag>)
+Q_DECLARE_METATYPE(Qt::HitTestAccuracy)
+
+static QScriptValue qtscript_create_enum_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto, 1);
+}
+
+static QScriptValue qtscript_create_flags_class_helper(
+ QScriptEngine *engine,
+ QScriptEngine::FunctionSignature construct,
+ QScriptEngine::FunctionSignature valueOf,
+ QScriptEngine::FunctionSignature toString,
+ QScriptEngine::FunctionSignature equals)
+{
+ QScriptValue proto = engine->newObject();
+ proto.setProperty(QString::fromLatin1("valueOf"),
+ engine->newFunction(valueOf), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("toString"),
+ engine->newFunction(toString), QScriptValue::SkipInEnumeration);
+ proto.setProperty(QString::fromLatin1("equals"),
+ engine->newFunction(equals), QScriptValue::SkipInEnumeration);
+ return engine->newFunction(construct, proto);
+}
+
+//
+// Qt::CursorShape
+//
+
+static const Qt::CursorShape qtscript_Qt_CursorShape_values[] = {
+ Qt::ArrowCursor
+ , Qt::UpArrowCursor
+ , Qt::CrossCursor
+ , Qt::WaitCursor
+ , Qt::IBeamCursor
+ , Qt::SizeVerCursor
+ , Qt::SizeHorCursor
+ , Qt::SizeBDiagCursor
+ , Qt::SizeFDiagCursor
+ , Qt::SizeAllCursor
+ , Qt::BlankCursor
+ , Qt::SplitVCursor
+ , Qt::SplitHCursor
+ , Qt::PointingHandCursor
+ , Qt::ForbiddenCursor
+ , Qt::WhatsThisCursor
+ , Qt::BusyCursor
+ , Qt::OpenHandCursor
+ , Qt::ClosedHandCursor
+ , Qt::BitmapCursor
+ , Qt::CustomCursor
+};
+
+static const char * const qtscript_Qt_CursorShape_keys[] = {
+ "ArrowCursor"
+ , "UpArrowCursor"
+ , "CrossCursor"
+ , "WaitCursor"
+ , "IBeamCursor"
+ , "SizeVerCursor"
+ , "SizeHorCursor"
+ , "SizeBDiagCursor"
+ , "SizeFDiagCursor"
+ , "SizeAllCursor"
+ , "BlankCursor"
+ , "SplitVCursor"
+ , "SplitHCursor"
+ , "PointingHandCursor"
+ , "ForbiddenCursor"
+ , "WhatsThisCursor"
+ , "BusyCursor"
+ , "OpenHandCursor"
+ , "ClosedHandCursor"
+ , "BitmapCursor"
+ , "CustomCursor"
+};
+
+static QString qtscript_Qt_CursorShape_toStringHelper(Qt::CursorShape value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("CursorShape");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_CursorShape_toScriptValue(QScriptEngine *engine, const Qt::CursorShape &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_CursorShape_toStringHelper(value));
+}
+
+static void qtscript_Qt_CursorShape_fromScriptValue(const QScriptValue &value, Qt::CursorShape &out)
+{
+ out = qvariant_cast<Qt::CursorShape>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_CursorShape(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("CursorShape");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::CursorShape>(arg));
+ return context->throwError(QString::fromLatin1("CursorShape(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_CursorShape_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::CursorShape value = qscriptvalue_cast<Qt::CursorShape>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_CursorShape_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::CursorShape value = qscriptvalue_cast<Qt::CursorShape>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_CursorShape_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_CursorShape_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_CursorShape,
+ qtscript_Qt_CursorShape_valueOf, qtscript_Qt_CursorShape_toString);
+ qScriptRegisterMetaType<Qt::CursorShape>(engine, qtscript_Qt_CursorShape_toScriptValue,
+ qtscript_Qt_CursorShape_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 21; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_CursorShape_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_CursorShape_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::Corner
+//
+
+static const Qt::Corner qtscript_Qt_Corner_values[] = {
+ Qt::TopLeftCorner
+ , Qt::TopRightCorner
+ , Qt::BottomLeftCorner
+ , Qt::BottomRightCorner
+};
+
+static const char * const qtscript_Qt_Corner_keys[] = {
+ "TopLeftCorner"
+ , "TopRightCorner"
+ , "BottomLeftCorner"
+ , "BottomRightCorner"
+};
+
+static QString qtscript_Qt_Corner_toStringHelper(Qt::Corner value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("Corner");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_Corner_toScriptValue(QScriptEngine *engine, const Qt::Corner &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_Corner_toStringHelper(value));
+}
+
+static void qtscript_Qt_Corner_fromScriptValue(const QScriptValue &value, Qt::Corner &out)
+{
+ out = qvariant_cast<Qt::Corner>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_Corner(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("Corner");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::Corner>(arg));
+ return context->throwError(QString::fromLatin1("Corner(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_Corner_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::Corner value = qscriptvalue_cast<Qt::Corner>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_Corner_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::Corner value = qscriptvalue_cast<Qt::Corner>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_Corner_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_Corner_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_Corner,
+ qtscript_Qt_Corner_valueOf, qtscript_Qt_Corner_toString);
+ qScriptRegisterMetaType<Qt::Corner>(engine, qtscript_Qt_Corner_toScriptValue,
+ qtscript_Qt_Corner_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 4; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_Corner_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_Corner_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::Axis
+//
+
+static const Qt::Axis qtscript_Qt_Axis_values[] = {
+ Qt::XAxis
+ , Qt::YAxis
+ , Qt::ZAxis
+};
+
+static const char * const qtscript_Qt_Axis_keys[] = {
+ "XAxis"
+ , "YAxis"
+ , "ZAxis"
+};
+
+static QString qtscript_Qt_Axis_toStringHelper(Qt::Axis value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("Axis");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_Axis_toScriptValue(QScriptEngine *engine, const Qt::Axis &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_Axis_toStringHelper(value));
+}
+
+static void qtscript_Qt_Axis_fromScriptValue(const QScriptValue &value, Qt::Axis &out)
+{
+ out = qvariant_cast<Qt::Axis>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_Axis(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("Axis");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::Axis>(arg));
+ return context->throwError(QString::fromLatin1("Axis(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_Axis_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::Axis value = qscriptvalue_cast<Qt::Axis>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_Axis_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::Axis value = qscriptvalue_cast<Qt::Axis>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_Axis_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_Axis_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_Axis,
+ qtscript_Qt_Axis_valueOf, qtscript_Qt_Axis_toString);
+ qScriptRegisterMetaType<Qt::Axis>(engine, qtscript_Qt_Axis_toScriptValue,
+ qtscript_Qt_Axis_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_Axis_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_Axis_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::Orientation
+//
+
+static const Qt::Orientation qtscript_Qt_Orientation_values[] = {
+ Qt::Horizontal
+ , Qt::Vertical
+};
+
+static const char * const qtscript_Qt_Orientation_keys[] = {
+ "Horizontal"
+ , "Vertical"
+};
+
+static QString qtscript_Qt_Orientation_toStringHelper(Qt::Orientation value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("Orientation");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_Orientation_toScriptValue(QScriptEngine *engine, const Qt::Orientation &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_Orientation_toStringHelper(value));
+}
+
+static void qtscript_Qt_Orientation_fromScriptValue(const QScriptValue &value, Qt::Orientation &out)
+{
+ out = qvariant_cast<Qt::Orientation>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_Orientation(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("Orientation");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::Orientation>(arg));
+ return context->throwError(QString::fromLatin1("Orientation(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_Orientation_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::Orientation value = qscriptvalue_cast<Qt::Orientation>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_Orientation_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::Orientation value = qscriptvalue_cast<Qt::Orientation>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_Orientation_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_Orientation_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_Orientation,
+ qtscript_Qt_Orientation_valueOf, qtscript_Qt_Orientation_toString);
+ qScriptRegisterMetaType<Qt::Orientation>(engine, qtscript_Qt_Orientation_toScriptValue,
+ qtscript_Qt_Orientation_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_Orientation_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_Orientation_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::Orientations
+//
+
+static QScriptValue qtscript_Qt_Orientations_toScriptValue(QScriptEngine *engine, const Qt::Orientations &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_Qt_Orientations_fromScriptValue(const QScriptValue &value, Qt::Orientations &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<Qt::Orientations>())
+ out = qvariant_cast<Qt::Orientations>(var);
+ else if (var.userType() == qMetaTypeId<Qt::Orientation>())
+ out = qvariant_cast<Qt::Orientation>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_Qt_Orientations(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::Orientations result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<Qt::Orientations>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<Qt::Orientation>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("Orientations(): argument %0 is not of type Orientation").arg(i));
+ }
+ result |= qvariant_cast<Qt::Orientation>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_Qt_Orientations_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::Orientations value = qscriptvalue_cast<Qt::Orientations>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_Orientations_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::Orientations value = qscriptvalue_cast<Qt::Orientations>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 2; ++i) {
+ if ((value & qtscript_Qt_Orientation_values[i]) == qtscript_Qt_Orientation_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_Qt_Orientation_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_Qt_Orientations_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<Qt::Orientations>() == otherObj.value<Qt::Orientations>())));
+}
+
+static QScriptValue qtscript_create_Qt_Orientations_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_Qt_Orientations, qtscript_Qt_Orientations_valueOf,
+ qtscript_Qt_Orientations_toString, qtscript_Qt_Orientations_equals);
+ qScriptRegisterMetaType<Qt::Orientations>(engine, qtscript_Qt_Orientations_toScriptValue,
+ qtscript_Qt_Orientations_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// Qt::LayoutDirection
+//
+
+static const Qt::LayoutDirection qtscript_Qt_LayoutDirection_values[] = {
+ Qt::LeftToRight
+ , Qt::RightToLeft
+};
+
+static const char * const qtscript_Qt_LayoutDirection_keys[] = {
+ "LeftToRight"
+ , "RightToLeft"
+};
+
+static QString qtscript_Qt_LayoutDirection_toStringHelper(Qt::LayoutDirection value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("LayoutDirection");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_LayoutDirection_toScriptValue(QScriptEngine *engine, const Qt::LayoutDirection &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_LayoutDirection_toStringHelper(value));
+}
+
+static void qtscript_Qt_LayoutDirection_fromScriptValue(const QScriptValue &value, Qt::LayoutDirection &out)
+{
+ out = qvariant_cast<Qt::LayoutDirection>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_LayoutDirection(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("LayoutDirection");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::LayoutDirection>(arg));
+ return context->throwError(QString::fromLatin1("LayoutDirection(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_LayoutDirection_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::LayoutDirection value = qscriptvalue_cast<Qt::LayoutDirection>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_LayoutDirection_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::LayoutDirection value = qscriptvalue_cast<Qt::LayoutDirection>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_LayoutDirection_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_LayoutDirection_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_LayoutDirection,
+ qtscript_Qt_LayoutDirection_valueOf, qtscript_Qt_LayoutDirection_toString);
+ qScriptRegisterMetaType<Qt::LayoutDirection>(engine, qtscript_Qt_LayoutDirection_toScriptValue,
+ qtscript_Qt_LayoutDirection_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_LayoutDirection_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_LayoutDirection_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::BGMode
+//
+
+static const Qt::BGMode qtscript_Qt_BGMode_values[] = {
+ Qt::TransparentMode
+ , Qt::OpaqueMode
+};
+
+static const char * const qtscript_Qt_BGMode_keys[] = {
+ "TransparentMode"
+ , "OpaqueMode"
+};
+
+static QString qtscript_Qt_BGMode_toStringHelper(Qt::BGMode value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("BGMode");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_BGMode_toScriptValue(QScriptEngine *engine, const Qt::BGMode &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_BGMode_toStringHelper(value));
+}
+
+static void qtscript_Qt_BGMode_fromScriptValue(const QScriptValue &value, Qt::BGMode &out)
+{
+ out = qvariant_cast<Qt::BGMode>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_BGMode(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("BGMode");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::BGMode>(arg));
+ return context->throwError(QString::fromLatin1("BGMode(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_BGMode_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::BGMode value = qscriptvalue_cast<Qt::BGMode>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_BGMode_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::BGMode value = qscriptvalue_cast<Qt::BGMode>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_BGMode_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_BGMode_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_BGMode,
+ qtscript_Qt_BGMode_valueOf, qtscript_Qt_BGMode_toString);
+ qScriptRegisterMetaType<Qt::BGMode>(engine, qtscript_Qt_BGMode_toScriptValue,
+ qtscript_Qt_BGMode_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_BGMode_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_BGMode_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::AspectRatioMode
+//
+
+static const Qt::AspectRatioMode qtscript_Qt_AspectRatioMode_values[] = {
+ Qt::IgnoreAspectRatio
+ , Qt::KeepAspectRatio
+ , Qt::KeepAspectRatioByExpanding
+};
+
+static const char * const qtscript_Qt_AspectRatioMode_keys[] = {
+ "IgnoreAspectRatio"
+ , "KeepAspectRatio"
+ , "KeepAspectRatioByExpanding"
+};
+
+static QString qtscript_Qt_AspectRatioMode_toStringHelper(Qt::AspectRatioMode value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("AspectRatioMode");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_AspectRatioMode_toScriptValue(QScriptEngine *engine, const Qt::AspectRatioMode &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_AspectRatioMode_toStringHelper(value));
+}
+
+static void qtscript_Qt_AspectRatioMode_fromScriptValue(const QScriptValue &value, Qt::AspectRatioMode &out)
+{
+ out = qvariant_cast<Qt::AspectRatioMode>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_AspectRatioMode(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("AspectRatioMode");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::AspectRatioMode>(arg));
+ return context->throwError(QString::fromLatin1("AspectRatioMode(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_AspectRatioMode_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::AspectRatioMode value = qscriptvalue_cast<Qt::AspectRatioMode>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_AspectRatioMode_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::AspectRatioMode value = qscriptvalue_cast<Qt::AspectRatioMode>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_AspectRatioMode_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_AspectRatioMode_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_AspectRatioMode,
+ qtscript_Qt_AspectRatioMode_valueOf, qtscript_Qt_AspectRatioMode_toString);
+ qScriptRegisterMetaType<Qt::AspectRatioMode>(engine, qtscript_Qt_AspectRatioMode_toScriptValue,
+ qtscript_Qt_AspectRatioMode_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_AspectRatioMode_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_AspectRatioMode_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::TextElideMode
+//
+
+static const Qt::TextElideMode qtscript_Qt_TextElideMode_values[] = {
+ Qt::ElideLeft
+ , Qt::ElideRight
+ , Qt::ElideMiddle
+ , Qt::ElideNone
+};
+
+static const char * const qtscript_Qt_TextElideMode_keys[] = {
+ "ElideLeft"
+ , "ElideRight"
+ , "ElideMiddle"
+ , "ElideNone"
+};
+
+static QString qtscript_Qt_TextElideMode_toStringHelper(Qt::TextElideMode value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("TextElideMode");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_TextElideMode_toScriptValue(QScriptEngine *engine, const Qt::TextElideMode &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_TextElideMode_toStringHelper(value));
+}
+
+static void qtscript_Qt_TextElideMode_fromScriptValue(const QScriptValue &value, Qt::TextElideMode &out)
+{
+ out = qvariant_cast<Qt::TextElideMode>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_TextElideMode(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("TextElideMode");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::TextElideMode>(arg));
+ return context->throwError(QString::fromLatin1("TextElideMode(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_TextElideMode_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::TextElideMode value = qscriptvalue_cast<Qt::TextElideMode>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_TextElideMode_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::TextElideMode value = qscriptvalue_cast<Qt::TextElideMode>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_TextElideMode_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_TextElideMode_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_TextElideMode,
+ qtscript_Qt_TextElideMode_valueOf, qtscript_Qt_TextElideMode_toString);
+ qScriptRegisterMetaType<Qt::TextElideMode>(engine, qtscript_Qt_TextElideMode_toScriptValue,
+ qtscript_Qt_TextElideMode_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 4; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_TextElideMode_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_TextElideMode_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::SizeMode
+//
+
+static const Qt::SizeMode qtscript_Qt_SizeMode_values[] = {
+ Qt::AbsoluteSize
+ , Qt::RelativeSize
+};
+
+static const char * const qtscript_Qt_SizeMode_keys[] = {
+ "AbsoluteSize"
+ , "RelativeSize"
+};
+
+static QString qtscript_Qt_SizeMode_toStringHelper(Qt::SizeMode value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("SizeMode");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_SizeMode_toScriptValue(QScriptEngine *engine, const Qt::SizeMode &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_SizeMode_toStringHelper(value));
+}
+
+static void qtscript_Qt_SizeMode_fromScriptValue(const QScriptValue &value, Qt::SizeMode &out)
+{
+ out = qvariant_cast<Qt::SizeMode>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_SizeMode(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("SizeMode");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::SizeMode>(arg));
+ return context->throwError(QString::fromLatin1("SizeMode(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_SizeMode_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::SizeMode value = qscriptvalue_cast<Qt::SizeMode>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_SizeMode_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::SizeMode value = qscriptvalue_cast<Qt::SizeMode>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_SizeMode_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_SizeMode_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_SizeMode,
+ qtscript_Qt_SizeMode_valueOf, qtscript_Qt_SizeMode_toString);
+ qScriptRegisterMetaType<Qt::SizeMode>(engine, qtscript_Qt_SizeMode_toScriptValue,
+ qtscript_Qt_SizeMode_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_SizeMode_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_SizeMode_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::WindowType
+//
+
+static const Qt::WindowType qtscript_Qt_WindowType_values[] = {
+ Qt::Widget
+ , Qt::Window
+ , Qt::Dialog
+ , Qt::Sheet
+ , Qt::Drawer
+ , Qt::Popup
+ , Qt::Tool
+ , Qt::ToolTip
+ , Qt::SplashScreen
+ , Qt::Desktop
+ , Qt::SubWindow
+ , Qt::WindowType_Mask
+ , Qt::MSWindowsFixedSizeDialogHint
+ , Qt::MSWindowsOwnDC
+ , Qt::X11BypassWindowManagerHint
+ , Qt::FramelessWindowHint
+ , Qt::WindowTitleHint
+ , Qt::WindowSystemMenuHint
+ , Qt::WindowMinimizeButtonHint
+ , Qt::WindowMaximizeButtonHint
+ , Qt::WindowMinMaxButtonsHint
+ , Qt::WindowContextHelpButtonHint
+ , Qt::WindowShadeButtonHint
+ , Qt::WindowStaysOnTopHint
+ , Qt::WindowOkButtonHint
+ , Qt::WindowCancelButtonHint
+ , Qt::CustomizeWindowHint
+ , Qt::WindowStaysOnBottomHint
+ , Qt::WindowCloseButtonHint
+ , Qt::MacWindowToolBarButtonHint
+ , Qt::BypassGraphicsProxyWidget
+};
+
+static const char * const qtscript_Qt_WindowType_keys[] = {
+ "Widget"
+ , "Window"
+ , "Dialog"
+ , "Sheet"
+ , "Drawer"
+ , "Popup"
+ , "Tool"
+ , "ToolTip"
+ , "SplashScreen"
+ , "Desktop"
+ , "SubWindow"
+ , "WindowType_Mask"
+ , "MSWindowsFixedSizeDialogHint"
+ , "MSWindowsOwnDC"
+ , "X11BypassWindowManagerHint"
+ , "FramelessWindowHint"
+ , "WindowTitleHint"
+ , "WindowSystemMenuHint"
+ , "WindowMinimizeButtonHint"
+ , "WindowMaximizeButtonHint"
+ , "WindowMinMaxButtonsHint"
+ , "WindowContextHelpButtonHint"
+ , "WindowShadeButtonHint"
+ , "WindowStaysOnTopHint"
+ , "WindowOkButtonHint"
+ , "WindowCancelButtonHint"
+ , "CustomizeWindowHint"
+ , "WindowStaysOnBottomHint"
+ , "WindowCloseButtonHint"
+ , "MacWindowToolBarButtonHint"
+ , "BypassGraphicsProxyWidget"
+};
+
+static QString qtscript_Qt_WindowType_toStringHelper(Qt::WindowType value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("WindowType");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_WindowType_toScriptValue(QScriptEngine *engine, const Qt::WindowType &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_WindowType_toStringHelper(value));
+}
+
+static void qtscript_Qt_WindowType_fromScriptValue(const QScriptValue &value, Qt::WindowType &out)
+{
+ out = qvariant_cast<Qt::WindowType>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_WindowType(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("WindowType");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::WindowType>(arg));
+ return context->throwError(QString::fromLatin1("WindowType(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_WindowType_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::WindowType value = qscriptvalue_cast<Qt::WindowType>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_WindowType_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::WindowType value = qscriptvalue_cast<Qt::WindowType>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_WindowType_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_WindowType_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_WindowType,
+ qtscript_Qt_WindowType_valueOf, qtscript_Qt_WindowType_toString);
+ qScriptRegisterMetaType<Qt::WindowType>(engine, qtscript_Qt_WindowType_toScriptValue,
+ qtscript_Qt_WindowType_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 31; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_WindowType_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_WindowType_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::WindowFlags
+//
+
+static QScriptValue qtscript_Qt_WindowFlags_toScriptValue(QScriptEngine *engine, const Qt::WindowFlags &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_Qt_WindowFlags_fromScriptValue(const QScriptValue &value, Qt::WindowFlags &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<Qt::WindowFlags>())
+ out = qvariant_cast<Qt::WindowFlags>(var);
+ else if (var.userType() == qMetaTypeId<Qt::WindowType>())
+ out = qvariant_cast<Qt::WindowType>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_Qt_WindowFlags(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::WindowFlags result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<Qt::WindowFlags>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<Qt::WindowType>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("WindowFlags(): argument %0 is not of type WindowType").arg(i));
+ }
+ result |= qvariant_cast<Qt::WindowType>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_Qt_WindowFlags_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::WindowFlags value = qscriptvalue_cast<Qt::WindowFlags>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_WindowFlags_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::WindowFlags value = qscriptvalue_cast<Qt::WindowFlags>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 31; ++i) {
+ if ((value & qtscript_Qt_WindowType_values[i]) == qtscript_Qt_WindowType_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_Qt_WindowType_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_Qt_WindowFlags_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<Qt::WindowFlags>() == otherObj.value<Qt::WindowFlags>())));
+}
+
+static QScriptValue qtscript_create_Qt_WindowFlags_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_Qt_WindowFlags, qtscript_Qt_WindowFlags_valueOf,
+ qtscript_Qt_WindowFlags_toString, qtscript_Qt_WindowFlags_equals);
+ qScriptRegisterMetaType<Qt::WindowFlags>(engine, qtscript_Qt_WindowFlags_toScriptValue,
+ qtscript_Qt_WindowFlags_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// Qt::ItemDataRole
+//
+
+static const Qt::ItemDataRole qtscript_Qt_ItemDataRole_values[] = {
+ Qt::DisplayRole
+ , Qt::DecorationRole
+ , Qt::EditRole
+ , Qt::ToolTipRole
+ , Qt::StatusTipRole
+ , Qt::WhatsThisRole
+ , Qt::FontRole
+ , Qt::TextAlignmentRole
+ , Qt::BackgroundColorRole
+ , Qt::TextColorRole
+ , Qt::CheckStateRole
+ , Qt::AccessibleTextRole
+ , Qt::AccessibleDescriptionRole
+ , Qt::SizeHintRole
+ , Qt::DisplayPropertyRole
+ , Qt::DecorationPropertyRole
+ , Qt::ToolTipPropertyRole
+ , Qt::StatusTipPropertyRole
+ , Qt::WhatsThisPropertyRole
+ , Qt::UserRole
+};
+
+static const char * const qtscript_Qt_ItemDataRole_keys[] = {
+ "DisplayRole"
+ , "DecorationRole"
+ , "EditRole"
+ , "ToolTipRole"
+ , "StatusTipRole"
+ , "WhatsThisRole"
+ , "FontRole"
+ , "TextAlignmentRole"
+ , "BackgroundColorRole"
+ , "TextColorRole"
+ , "CheckStateRole"
+ , "AccessibleTextRole"
+ , "AccessibleDescriptionRole"
+ , "SizeHintRole"
+ , "DisplayPropertyRole"
+ , "DecorationPropertyRole"
+ , "ToolTipPropertyRole"
+ , "StatusTipPropertyRole"
+ , "WhatsThisPropertyRole"
+ , "UserRole"
+};
+
+static QString qtscript_Qt_ItemDataRole_toStringHelper(Qt::ItemDataRole value)
+{
+ for (int i = 0; i < 20; ++i) {
+ if (qtscript_Qt_ItemDataRole_values[i] == value)
+ return QString::fromLatin1(qtscript_Qt_ItemDataRole_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_Qt_ItemDataRole_toScriptValue(QScriptEngine *engine, const Qt::ItemDataRole &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_ItemDataRole_toStringHelper(value));
+}
+
+static void qtscript_Qt_ItemDataRole_fromScriptValue(const QScriptValue &value, Qt::ItemDataRole &out)
+{
+ out = qvariant_cast<Qt::ItemDataRole>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_ItemDataRole(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 20; ++i) {
+ if (qtscript_Qt_ItemDataRole_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<Qt::ItemDataRole>(arg));
+ }
+ return context->throwError(QString::fromLatin1("ItemDataRole(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_ItemDataRole_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ItemDataRole value = qscriptvalue_cast<Qt::ItemDataRole>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_ItemDataRole_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ItemDataRole value = qscriptvalue_cast<Qt::ItemDataRole>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_ItemDataRole_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_ItemDataRole_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_ItemDataRole,
+ qtscript_Qt_ItemDataRole_valueOf, qtscript_Qt_ItemDataRole_toString);
+ qScriptRegisterMetaType<Qt::ItemDataRole>(engine, qtscript_Qt_ItemDataRole_toScriptValue,
+ qtscript_Qt_ItemDataRole_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 20; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_ItemDataRole_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_ItemDataRole_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::SortOrder
+//
+
+static const Qt::SortOrder qtscript_Qt_SortOrder_values[] = {
+ Qt::AscendingOrder
+ , Qt::DescendingOrder
+};
+
+static const char * const qtscript_Qt_SortOrder_keys[] = {
+ "AscendingOrder"
+ , "DescendingOrder"
+};
+
+static QString qtscript_Qt_SortOrder_toStringHelper(Qt::SortOrder value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("SortOrder");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_SortOrder_toScriptValue(QScriptEngine *engine, const Qt::SortOrder &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_SortOrder_toStringHelper(value));
+}
+
+static void qtscript_Qt_SortOrder_fromScriptValue(const QScriptValue &value, Qt::SortOrder &out)
+{
+ out = qvariant_cast<Qt::SortOrder>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_SortOrder(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("SortOrder");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::SortOrder>(arg));
+ return context->throwError(QString::fromLatin1("SortOrder(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_SortOrder_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::SortOrder value = qscriptvalue_cast<Qt::SortOrder>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_SortOrder_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::SortOrder value = qscriptvalue_cast<Qt::SortOrder>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_SortOrder_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_SortOrder_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_SortOrder,
+ qtscript_Qt_SortOrder_valueOf, qtscript_Qt_SortOrder_toString);
+ qScriptRegisterMetaType<Qt::SortOrder>(engine, qtscript_Qt_SortOrder_toScriptValue,
+ qtscript_Qt_SortOrder_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_SortOrder_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_SortOrder_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::MatchFlag
+//
+
+static const Qt::MatchFlag qtscript_Qt_MatchFlag_values[] = {
+ Qt::MatchExactly
+ , Qt::MatchContains
+ , Qt::MatchStartsWith
+ , Qt::MatchEndsWith
+ , Qt::MatchRegExp
+ , Qt::MatchWildcard
+ , Qt::MatchFixedString
+ , Qt::MatchCaseSensitive
+ , Qt::MatchWrap
+ , Qt::MatchRecursive
+};
+
+static const char * const qtscript_Qt_MatchFlag_keys[] = {
+ "MatchExactly"
+ , "MatchContains"
+ , "MatchStartsWith"
+ , "MatchEndsWith"
+ , "MatchRegExp"
+ , "MatchWildcard"
+ , "MatchFixedString"
+ , "MatchCaseSensitive"
+ , "MatchWrap"
+ , "MatchRecursive"
+};
+
+static QString qtscript_Qt_MatchFlag_toStringHelper(Qt::MatchFlag value)
+{
+ for (int i = 0; i < 10; ++i) {
+ if (qtscript_Qt_MatchFlag_values[i] == value)
+ return QString::fromLatin1(qtscript_Qt_MatchFlag_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_Qt_MatchFlag_toScriptValue(QScriptEngine *engine, const Qt::MatchFlag &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_MatchFlag_toStringHelper(value));
+}
+
+static void qtscript_Qt_MatchFlag_fromScriptValue(const QScriptValue &value, Qt::MatchFlag &out)
+{
+ out = qvariant_cast<Qt::MatchFlag>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_MatchFlag(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 10; ++i) {
+ if (qtscript_Qt_MatchFlag_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<Qt::MatchFlag>(arg));
+ }
+ return context->throwError(QString::fromLatin1("MatchFlag(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_MatchFlag_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::MatchFlag value = qscriptvalue_cast<Qt::MatchFlag>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_MatchFlag_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::MatchFlag value = qscriptvalue_cast<Qt::MatchFlag>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_MatchFlag_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_MatchFlag_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_MatchFlag,
+ qtscript_Qt_MatchFlag_valueOf, qtscript_Qt_MatchFlag_toString);
+ qScriptRegisterMetaType<Qt::MatchFlag>(engine, qtscript_Qt_MatchFlag_toScriptValue,
+ qtscript_Qt_MatchFlag_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 10; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_MatchFlag_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_MatchFlag_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::MatchFlags
+//
+
+static QScriptValue qtscript_Qt_MatchFlags_toScriptValue(QScriptEngine *engine, const Qt::MatchFlags &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_Qt_MatchFlags_fromScriptValue(const QScriptValue &value, Qt::MatchFlags &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<Qt::MatchFlags>())
+ out = qvariant_cast<Qt::MatchFlags>(var);
+ else if (var.userType() == qMetaTypeId<Qt::MatchFlag>())
+ out = qvariant_cast<Qt::MatchFlag>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_Qt_MatchFlags(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::MatchFlags result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<Qt::MatchFlags>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<Qt::MatchFlag>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("MatchFlags(): argument %0 is not of type MatchFlag").arg(i));
+ }
+ result |= qvariant_cast<Qt::MatchFlag>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_Qt_MatchFlags_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::MatchFlags value = qscriptvalue_cast<Qt::MatchFlags>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_MatchFlags_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::MatchFlags value = qscriptvalue_cast<Qt::MatchFlags>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 10; ++i) {
+ if ((value & qtscript_Qt_MatchFlag_values[i]) == qtscript_Qt_MatchFlag_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_Qt_MatchFlag_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_Qt_MatchFlags_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<Qt::MatchFlags>() == otherObj.value<Qt::MatchFlags>())));
+}
+
+static QScriptValue qtscript_create_Qt_MatchFlags_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_Qt_MatchFlags, qtscript_Qt_MatchFlags_valueOf,
+ qtscript_Qt_MatchFlags_toString, qtscript_Qt_MatchFlags_equals);
+ qScriptRegisterMetaType<Qt::MatchFlags>(engine, qtscript_Qt_MatchFlags_toScriptValue,
+ qtscript_Qt_MatchFlags_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// Qt::PenJoinStyle
+//
+
+static const Qt::PenJoinStyle qtscript_Qt_PenJoinStyle_values[] = {
+ Qt::MiterJoin
+ , Qt::BevelJoin
+ , Qt::RoundJoin
+ , Qt::SvgMiterJoin
+ , Qt::MPenJoinStyle
+};
+
+static const char * const qtscript_Qt_PenJoinStyle_keys[] = {
+ "MiterJoin"
+ , "BevelJoin"
+ , "RoundJoin"
+ , "SvgMiterJoin"
+ , "MPenJoinStyle"
+};
+
+static QString qtscript_Qt_PenJoinStyle_toStringHelper(Qt::PenJoinStyle value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("PenJoinStyle");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_PenJoinStyle_toScriptValue(QScriptEngine *engine, const Qt::PenJoinStyle &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_PenJoinStyle_toStringHelper(value));
+}
+
+static void qtscript_Qt_PenJoinStyle_fromScriptValue(const QScriptValue &value, Qt::PenJoinStyle &out)
+{
+ out = qvariant_cast<Qt::PenJoinStyle>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_PenJoinStyle(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("PenJoinStyle");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::PenJoinStyle>(arg));
+ return context->throwError(QString::fromLatin1("PenJoinStyle(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_PenJoinStyle_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::PenJoinStyle value = qscriptvalue_cast<Qt::PenJoinStyle>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_PenJoinStyle_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::PenJoinStyle value = qscriptvalue_cast<Qt::PenJoinStyle>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_PenJoinStyle_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_PenJoinStyle_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_PenJoinStyle,
+ qtscript_Qt_PenJoinStyle_valueOf, qtscript_Qt_PenJoinStyle_toString);
+ qScriptRegisterMetaType<Qt::PenJoinStyle>(engine, qtscript_Qt_PenJoinStyle_toScriptValue,
+ qtscript_Qt_PenJoinStyle_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 5; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_PenJoinStyle_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_PenJoinStyle_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::CaseSensitivity
+//
+
+static const Qt::CaseSensitivity qtscript_Qt_CaseSensitivity_values[] = {
+ Qt::CaseInsensitive
+ , Qt::CaseSensitive
+};
+
+static const char * const qtscript_Qt_CaseSensitivity_keys[] = {
+ "CaseInsensitive"
+ , "CaseSensitive"
+};
+
+static QString qtscript_Qt_CaseSensitivity_toStringHelper(Qt::CaseSensitivity value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("CaseSensitivity");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_CaseSensitivity_toScriptValue(QScriptEngine *engine, const Qt::CaseSensitivity &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_CaseSensitivity_toStringHelper(value));
+}
+
+static void qtscript_Qt_CaseSensitivity_fromScriptValue(const QScriptValue &value, Qt::CaseSensitivity &out)
+{
+ out = qvariant_cast<Qt::CaseSensitivity>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_CaseSensitivity(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("CaseSensitivity");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::CaseSensitivity>(arg));
+ return context->throwError(QString::fromLatin1("CaseSensitivity(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_CaseSensitivity_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::CaseSensitivity value = qscriptvalue_cast<Qt::CaseSensitivity>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_CaseSensitivity_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::CaseSensitivity value = qscriptvalue_cast<Qt::CaseSensitivity>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_CaseSensitivity_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_CaseSensitivity_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_CaseSensitivity,
+ qtscript_Qt_CaseSensitivity_valueOf, qtscript_Qt_CaseSensitivity_toString);
+ qScriptRegisterMetaType<Qt::CaseSensitivity>(engine, qtscript_Qt_CaseSensitivity_toScriptValue,
+ qtscript_Qt_CaseSensitivity_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_CaseSensitivity_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_CaseSensitivity_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::BrushStyle
+//
+
+static const Qt::BrushStyle qtscript_Qt_BrushStyle_values[] = {
+ Qt::NoBrush
+ , Qt::SolidPattern
+ , Qt::Dense1Pattern
+ , Qt::Dense2Pattern
+ , Qt::Dense3Pattern
+ , Qt::Dense4Pattern
+ , Qt::Dense5Pattern
+ , Qt::Dense6Pattern
+ , Qt::Dense7Pattern
+ , Qt::HorPattern
+ , Qt::VerPattern
+ , Qt::CrossPattern
+ , Qt::BDiagPattern
+ , Qt::FDiagPattern
+ , Qt::DiagCrossPattern
+ , Qt::LinearGradientPattern
+ , Qt::RadialGradientPattern
+ , Qt::ConicalGradientPattern
+ , Qt::TexturePattern
+};
+
+static const char * const qtscript_Qt_BrushStyle_keys[] = {
+ "NoBrush"
+ , "SolidPattern"
+ , "Dense1Pattern"
+ , "Dense2Pattern"
+ , "Dense3Pattern"
+ , "Dense4Pattern"
+ , "Dense5Pattern"
+ , "Dense6Pattern"
+ , "Dense7Pattern"
+ , "HorPattern"
+ , "VerPattern"
+ , "CrossPattern"
+ , "BDiagPattern"
+ , "FDiagPattern"
+ , "DiagCrossPattern"
+ , "LinearGradientPattern"
+ , "RadialGradientPattern"
+ , "ConicalGradientPattern"
+ , "TexturePattern"
+};
+
+static QString qtscript_Qt_BrushStyle_toStringHelper(Qt::BrushStyle value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("BrushStyle");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_BrushStyle_toScriptValue(QScriptEngine *engine, const Qt::BrushStyle &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_BrushStyle_toStringHelper(value));
+}
+
+static void qtscript_Qt_BrushStyle_fromScriptValue(const QScriptValue &value, Qt::BrushStyle &out)
+{
+ out = qvariant_cast<Qt::BrushStyle>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_BrushStyle(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("BrushStyle");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::BrushStyle>(arg));
+ return context->throwError(QString::fromLatin1("BrushStyle(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_BrushStyle_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::BrushStyle value = qscriptvalue_cast<Qt::BrushStyle>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_BrushStyle_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::BrushStyle value = qscriptvalue_cast<Qt::BrushStyle>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_BrushStyle_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_BrushStyle_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_BrushStyle,
+ qtscript_Qt_BrushStyle_valueOf, qtscript_Qt_BrushStyle_toString);
+ qScriptRegisterMetaType<Qt::BrushStyle>(engine, qtscript_Qt_BrushStyle_toScriptValue,
+ qtscript_Qt_BrushStyle_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 19; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_BrushStyle_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_BrushStyle_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::ClipOperation
+//
+
+static const Qt::ClipOperation qtscript_Qt_ClipOperation_values[] = {
+ Qt::NoClip
+ , Qt::ReplaceClip
+ , Qt::IntersectClip
+ , Qt::UniteClip
+};
+
+static const char * const qtscript_Qt_ClipOperation_keys[] = {
+ "NoClip"
+ , "ReplaceClip"
+ , "IntersectClip"
+ , "UniteClip"
+};
+
+static QString qtscript_Qt_ClipOperation_toStringHelper(Qt::ClipOperation value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("ClipOperation");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_ClipOperation_toScriptValue(QScriptEngine *engine, const Qt::ClipOperation &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_ClipOperation_toStringHelper(value));
+}
+
+static void qtscript_Qt_ClipOperation_fromScriptValue(const QScriptValue &value, Qt::ClipOperation &out)
+{
+ out = qvariant_cast<Qt::ClipOperation>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_ClipOperation(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("ClipOperation");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::ClipOperation>(arg));
+ return context->throwError(QString::fromLatin1("ClipOperation(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_ClipOperation_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ClipOperation value = qscriptvalue_cast<Qt::ClipOperation>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_ClipOperation_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ClipOperation value = qscriptvalue_cast<Qt::ClipOperation>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_ClipOperation_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_ClipOperation_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_ClipOperation,
+ qtscript_Qt_ClipOperation_valueOf, qtscript_Qt_ClipOperation_toString);
+ qScriptRegisterMetaType<Qt::ClipOperation>(engine, qtscript_Qt_ClipOperation_toScriptValue,
+ qtscript_Qt_ClipOperation_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 4; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_ClipOperation_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_ClipOperation_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::FocusReason
+//
+
+static const Qt::FocusReason qtscript_Qt_FocusReason_values[] = {
+ Qt::MouseFocusReason
+ , Qt::TabFocusReason
+ , Qt::BacktabFocusReason
+ , Qt::ActiveWindowFocusReason
+ , Qt::PopupFocusReason
+ , Qt::ShortcutFocusReason
+ , Qt::MenuBarFocusReason
+ , Qt::OtherFocusReason
+ , Qt::NoFocusReason
+};
+
+static const char * const qtscript_Qt_FocusReason_keys[] = {
+ "MouseFocusReason"
+ , "TabFocusReason"
+ , "BacktabFocusReason"
+ , "ActiveWindowFocusReason"
+ , "PopupFocusReason"
+ , "ShortcutFocusReason"
+ , "MenuBarFocusReason"
+ , "OtherFocusReason"
+ , "NoFocusReason"
+};
+
+static QString qtscript_Qt_FocusReason_toStringHelper(Qt::FocusReason value)
+{
+ if ((value >= Qt::MouseFocusReason) && (value <= Qt::NoFocusReason))
+ return qtscript_Qt_FocusReason_keys[static_cast<int>(value)-static_cast<int>(Qt::MouseFocusReason)];
+ return QString();
+}
+
+static QScriptValue qtscript_Qt_FocusReason_toScriptValue(QScriptEngine *engine, const Qt::FocusReason &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_FocusReason_toStringHelper(value));
+}
+
+static void qtscript_Qt_FocusReason_fromScriptValue(const QScriptValue &value, Qt::FocusReason &out)
+{
+ out = qvariant_cast<Qt::FocusReason>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_FocusReason(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= Qt::MouseFocusReason) && (arg <= Qt::NoFocusReason))
+ return qScriptValueFromValue(engine, static_cast<Qt::FocusReason>(arg));
+ return context->throwError(QString::fromLatin1("FocusReason(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_FocusReason_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::FocusReason value = qscriptvalue_cast<Qt::FocusReason>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_FocusReason_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::FocusReason value = qscriptvalue_cast<Qt::FocusReason>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_FocusReason_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_FocusReason_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_FocusReason,
+ qtscript_Qt_FocusReason_valueOf, qtscript_Qt_FocusReason_toString);
+ qScriptRegisterMetaType<Qt::FocusReason>(engine, qtscript_Qt_FocusReason_toScriptValue,
+ qtscript_Qt_FocusReason_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 9; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_FocusReason_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_FocusReason_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::ToolBarArea
+//
+
+static const Qt::ToolBarArea qtscript_Qt_ToolBarArea_values[] = {
+ Qt::NoToolBarArea
+ , Qt::LeftToolBarArea
+ , Qt::RightToolBarArea
+ , Qt::TopToolBarArea
+ , Qt::BottomToolBarArea
+ , Qt::ToolBarArea_Mask
+};
+
+static const char * const qtscript_Qt_ToolBarArea_keys[] = {
+ "NoToolBarArea"
+ , "LeftToolBarArea"
+ , "RightToolBarArea"
+ , "TopToolBarArea"
+ , "BottomToolBarArea"
+ , "ToolBarArea_Mask"
+};
+
+static QString qtscript_Qt_ToolBarArea_toStringHelper(Qt::ToolBarArea value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("ToolBarArea");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_ToolBarArea_toScriptValue(QScriptEngine *engine, const Qt::ToolBarArea &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_ToolBarArea_toStringHelper(value));
+}
+
+static void qtscript_Qt_ToolBarArea_fromScriptValue(const QScriptValue &value, Qt::ToolBarArea &out)
+{
+ out = qvariant_cast<Qt::ToolBarArea>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_ToolBarArea(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("ToolBarArea");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::ToolBarArea>(arg));
+ return context->throwError(QString::fromLatin1("ToolBarArea(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_ToolBarArea_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ToolBarArea value = qscriptvalue_cast<Qt::ToolBarArea>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_ToolBarArea_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ToolBarArea value = qscriptvalue_cast<Qt::ToolBarArea>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_ToolBarArea_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_ToolBarArea_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_ToolBarArea,
+ qtscript_Qt_ToolBarArea_valueOf, qtscript_Qt_ToolBarArea_toString);
+ qScriptRegisterMetaType<Qt::ToolBarArea>(engine, qtscript_Qt_ToolBarArea_toScriptValue,
+ qtscript_Qt_ToolBarArea_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 6; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_ToolBarArea_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_ToolBarArea_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::ToolBarAreas
+//
+
+static QScriptValue qtscript_Qt_ToolBarAreas_toScriptValue(QScriptEngine *engine, const Qt::ToolBarAreas &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_Qt_ToolBarAreas_fromScriptValue(const QScriptValue &value, Qt::ToolBarAreas &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<Qt::ToolBarAreas>())
+ out = qvariant_cast<Qt::ToolBarAreas>(var);
+ else if (var.userType() == qMetaTypeId<Qt::ToolBarArea>())
+ out = qvariant_cast<Qt::ToolBarArea>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_Qt_ToolBarAreas(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ToolBarAreas result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<Qt::ToolBarAreas>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<Qt::ToolBarArea>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("ToolBarAreas(): argument %0 is not of type ToolBarArea").arg(i));
+ }
+ result |= qvariant_cast<Qt::ToolBarArea>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_Qt_ToolBarAreas_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ToolBarAreas value = qscriptvalue_cast<Qt::ToolBarAreas>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_ToolBarAreas_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ToolBarAreas value = qscriptvalue_cast<Qt::ToolBarAreas>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 6; ++i) {
+ if ((value & qtscript_Qt_ToolBarArea_values[i]) == qtscript_Qt_ToolBarArea_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_Qt_ToolBarArea_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_Qt_ToolBarAreas_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<Qt::ToolBarAreas>() == otherObj.value<Qt::ToolBarAreas>())));
+}
+
+static QScriptValue qtscript_create_Qt_ToolBarAreas_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_Qt_ToolBarAreas, qtscript_Qt_ToolBarAreas_valueOf,
+ qtscript_Qt_ToolBarAreas_toString, qtscript_Qt_ToolBarAreas_equals);
+ qScriptRegisterMetaType<Qt::ToolBarAreas>(engine, qtscript_Qt_ToolBarAreas_toScriptValue,
+ qtscript_Qt_ToolBarAreas_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// Qt::KeyboardModifier
+//
+
+static const Qt::KeyboardModifier qtscript_Qt_KeyboardModifier_values[] = {
+ Qt::KeyboardModifierMask
+ , Qt::NoModifier
+ , Qt::ShiftModifier
+ , Qt::ControlModifier
+ , Qt::AltModifier
+ , Qt::MetaModifier
+ , Qt::KeypadModifier
+ , Qt::GroupSwitchModifier
+};
+
+static const char * const qtscript_Qt_KeyboardModifier_keys[] = {
+ "KeyboardModifierMask"
+ , "NoModifier"
+ , "ShiftModifier"
+ , "ControlModifier"
+ , "AltModifier"
+ , "MetaModifier"
+ , "KeypadModifier"
+ , "GroupSwitchModifier"
+};
+
+static QString qtscript_Qt_KeyboardModifier_toStringHelper(Qt::KeyboardModifier value)
+{
+ for (int i = 0; i < 8; ++i) {
+ if (qtscript_Qt_KeyboardModifier_values[i] == value)
+ return QString::fromLatin1(qtscript_Qt_KeyboardModifier_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_Qt_KeyboardModifier_toScriptValue(QScriptEngine *engine, const Qt::KeyboardModifier &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_KeyboardModifier_toStringHelper(value));
+}
+
+static void qtscript_Qt_KeyboardModifier_fromScriptValue(const QScriptValue &value, Qt::KeyboardModifier &out)
+{
+ out = qvariant_cast<Qt::KeyboardModifier>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_KeyboardModifier(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 8; ++i) {
+ if (qtscript_Qt_KeyboardModifier_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<Qt::KeyboardModifier>(arg));
+ }
+ return context->throwError(QString::fromLatin1("KeyboardModifier(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_KeyboardModifier_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::KeyboardModifier value = qscriptvalue_cast<Qt::KeyboardModifier>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_KeyboardModifier_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::KeyboardModifier value = qscriptvalue_cast<Qt::KeyboardModifier>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_KeyboardModifier_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_KeyboardModifier_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_KeyboardModifier,
+ qtscript_Qt_KeyboardModifier_valueOf, qtscript_Qt_KeyboardModifier_toString);
+ qScriptRegisterMetaType<Qt::KeyboardModifier>(engine, qtscript_Qt_KeyboardModifier_toScriptValue,
+ qtscript_Qt_KeyboardModifier_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 8; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_KeyboardModifier_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_KeyboardModifier_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::KeyboardModifiers
+//
+
+static QScriptValue qtscript_Qt_KeyboardModifiers_toScriptValue(QScriptEngine *engine, const Qt::KeyboardModifiers &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_Qt_KeyboardModifiers_fromScriptValue(const QScriptValue &value, Qt::KeyboardModifiers &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<Qt::KeyboardModifiers>())
+ out = qvariant_cast<Qt::KeyboardModifiers>(var);
+ else if (var.userType() == qMetaTypeId<Qt::KeyboardModifier>())
+ out = qvariant_cast<Qt::KeyboardModifier>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_Qt_KeyboardModifiers(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::KeyboardModifiers result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<Qt::KeyboardModifiers>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<Qt::KeyboardModifier>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("KeyboardModifiers(): argument %0 is not of type KeyboardModifier").arg(i));
+ }
+ result |= qvariant_cast<Qt::KeyboardModifier>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_Qt_KeyboardModifiers_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::KeyboardModifiers value = qscriptvalue_cast<Qt::KeyboardModifiers>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_KeyboardModifiers_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::KeyboardModifiers value = qscriptvalue_cast<Qt::KeyboardModifiers>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 8; ++i) {
+ if ((value & qtscript_Qt_KeyboardModifier_values[i]) == qtscript_Qt_KeyboardModifier_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_Qt_KeyboardModifier_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_Qt_KeyboardModifiers_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<Qt::KeyboardModifiers>() == otherObj.value<Qt::KeyboardModifiers>())));
+}
+
+static QScriptValue qtscript_create_Qt_KeyboardModifiers_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_Qt_KeyboardModifiers, qtscript_Qt_KeyboardModifiers_valueOf,
+ qtscript_Qt_KeyboardModifiers_toString, qtscript_Qt_KeyboardModifiers_equals);
+ qScriptRegisterMetaType<Qt::KeyboardModifiers>(engine, qtscript_Qt_KeyboardModifiers_toScriptValue,
+ qtscript_Qt_KeyboardModifiers_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// Qt::WhiteSpaceMode
+//
+
+static const Qt::WhiteSpaceMode qtscript_Qt_WhiteSpaceMode_values[] = {
+ Qt::WhiteSpaceModeUndefined
+ , Qt::WhiteSpaceNormal
+ , Qt::WhiteSpacePre
+ , Qt::WhiteSpaceNoWrap
+};
+
+static const char * const qtscript_Qt_WhiteSpaceMode_keys[] = {
+ "WhiteSpaceModeUndefined"
+ , "WhiteSpaceNormal"
+ , "WhiteSpacePre"
+ , "WhiteSpaceNoWrap"
+};
+
+static QString qtscript_Qt_WhiteSpaceMode_toStringHelper(Qt::WhiteSpaceMode value)
+{
+ if ((value >= Qt::WhiteSpaceModeUndefined) && (value <= Qt::WhiteSpaceNoWrap))
+ return qtscript_Qt_WhiteSpaceMode_keys[static_cast<int>(value)-static_cast<int>(Qt::WhiteSpaceModeUndefined)];
+ return QString();
+}
+
+static QScriptValue qtscript_Qt_WhiteSpaceMode_toScriptValue(QScriptEngine *engine, const Qt::WhiteSpaceMode &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_WhiteSpaceMode_toStringHelper(value));
+}
+
+static void qtscript_Qt_WhiteSpaceMode_fromScriptValue(const QScriptValue &value, Qt::WhiteSpaceMode &out)
+{
+ out = qvariant_cast<Qt::WhiteSpaceMode>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_WhiteSpaceMode(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= Qt::WhiteSpaceModeUndefined) && (arg <= Qt::WhiteSpaceNoWrap))
+ return qScriptValueFromValue(engine, static_cast<Qt::WhiteSpaceMode>(arg));
+ return context->throwError(QString::fromLatin1("WhiteSpaceMode(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_WhiteSpaceMode_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::WhiteSpaceMode value = qscriptvalue_cast<Qt::WhiteSpaceMode>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_WhiteSpaceMode_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::WhiteSpaceMode value = qscriptvalue_cast<Qt::WhiteSpaceMode>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_WhiteSpaceMode_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_WhiteSpaceMode_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_WhiteSpaceMode,
+ qtscript_Qt_WhiteSpaceMode_valueOf, qtscript_Qt_WhiteSpaceMode_toString);
+ qScriptRegisterMetaType<Qt::WhiteSpaceMode>(engine, qtscript_Qt_WhiteSpaceMode_toScriptValue,
+ qtscript_Qt_WhiteSpaceMode_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 4; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_WhiteSpaceMode_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_WhiteSpaceMode_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::DayOfWeek
+//
+
+static const Qt::DayOfWeek qtscript_Qt_DayOfWeek_values[] = {
+ Qt::Monday
+ , Qt::Tuesday
+ , Qt::Wednesday
+ , Qt::Thursday
+ , Qt::Friday
+ , Qt::Saturday
+ , Qt::Sunday
+};
+
+static const char * const qtscript_Qt_DayOfWeek_keys[] = {
+ "Monday"
+ , "Tuesday"
+ , "Wednesday"
+ , "Thursday"
+ , "Friday"
+ , "Saturday"
+ , "Sunday"
+};
+
+static QString qtscript_Qt_DayOfWeek_toStringHelper(Qt::DayOfWeek value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("DayOfWeek");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_DayOfWeek_toScriptValue(QScriptEngine *engine, const Qt::DayOfWeek &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_DayOfWeek_toStringHelper(value));
+}
+
+static void qtscript_Qt_DayOfWeek_fromScriptValue(const QScriptValue &value, Qt::DayOfWeek &out)
+{
+ out = qvariant_cast<Qt::DayOfWeek>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_DayOfWeek(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("DayOfWeek");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::DayOfWeek>(arg));
+ return context->throwError(QString::fromLatin1("DayOfWeek(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_DayOfWeek_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::DayOfWeek value = qscriptvalue_cast<Qt::DayOfWeek>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_DayOfWeek_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::DayOfWeek value = qscriptvalue_cast<Qt::DayOfWeek>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_DayOfWeek_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_DayOfWeek_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_DayOfWeek,
+ qtscript_Qt_DayOfWeek_valueOf, qtscript_Qt_DayOfWeek_toString);
+ qScriptRegisterMetaType<Qt::DayOfWeek>(engine, qtscript_Qt_DayOfWeek_toScriptValue,
+ qtscript_Qt_DayOfWeek_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 7; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_DayOfWeek_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_DayOfWeek_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::EventPriority
+//
+
+static const Qt::EventPriority qtscript_Qt_EventPriority_values[] = {
+ Qt::LowEventPriority
+ , Qt::NormalEventPriority
+ , Qt::HighEventPriority
+};
+
+static const char * const qtscript_Qt_EventPriority_keys[] = {
+ "LowEventPriority"
+ , "NormalEventPriority"
+ , "HighEventPriority"
+};
+
+static QString qtscript_Qt_EventPriority_toStringHelper(Qt::EventPriority value)
+{
+ if ((value >= Qt::LowEventPriority) && (value <= Qt::HighEventPriority))
+ return qtscript_Qt_EventPriority_keys[static_cast<int>(value)-static_cast<int>(Qt::LowEventPriority)];
+ return QString();
+}
+
+static QScriptValue qtscript_Qt_EventPriority_toScriptValue(QScriptEngine *engine, const Qt::EventPriority &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_EventPriority_toStringHelper(value));
+}
+
+static void qtscript_Qt_EventPriority_fromScriptValue(const QScriptValue &value, Qt::EventPriority &out)
+{
+ out = qvariant_cast<Qt::EventPriority>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_EventPriority(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= Qt::LowEventPriority) && (arg <= Qt::HighEventPriority))
+ return qScriptValueFromValue(engine, static_cast<Qt::EventPriority>(arg));
+ return context->throwError(QString::fromLatin1("EventPriority(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_EventPriority_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::EventPriority value = qscriptvalue_cast<Qt::EventPriority>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_EventPriority_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::EventPriority value = qscriptvalue_cast<Qt::EventPriority>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_EventPriority_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_EventPriority_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_EventPriority,
+ qtscript_Qt_EventPriority_valueOf, qtscript_Qt_EventPriority_toString);
+ qScriptRegisterMetaType<Qt::EventPriority>(engine, qtscript_Qt_EventPriority_toScriptValue,
+ qtscript_Qt_EventPriority_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_EventPriority_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_EventPriority_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::DateFormat
+//
+
+static const Qt::DateFormat qtscript_Qt_DateFormat_values[] = {
+ Qt::TextDate
+ , Qt::ISODate
+ , Qt::SystemLocaleDate
+ , Qt::LocaleDate
+ , Qt::SystemLocaleShortDate
+ , Qt::SystemLocaleLongDate
+ , Qt::DefaultLocaleShortDate
+ , Qt::DefaultLocaleLongDate
+};
+
+static const char * const qtscript_Qt_DateFormat_keys[] = {
+ "TextDate"
+ , "ISODate"
+ , "SystemLocaleDate"
+ , "LocaleDate"
+ , "SystemLocaleShortDate"
+ , "SystemLocaleLongDate"
+ , "DefaultLocaleShortDate"
+ , "DefaultLocaleLongDate"
+};
+
+static QString qtscript_Qt_DateFormat_toStringHelper(Qt::DateFormat value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("DateFormat");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_DateFormat_toScriptValue(QScriptEngine *engine, const Qt::DateFormat &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_DateFormat_toStringHelper(value));
+}
+
+static void qtscript_Qt_DateFormat_fromScriptValue(const QScriptValue &value, Qt::DateFormat &out)
+{
+ out = qvariant_cast<Qt::DateFormat>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_DateFormat(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("DateFormat");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::DateFormat>(arg));
+ return context->throwError(QString::fromLatin1("DateFormat(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_DateFormat_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::DateFormat value = qscriptvalue_cast<Qt::DateFormat>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_DateFormat_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::DateFormat value = qscriptvalue_cast<Qt::DateFormat>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_DateFormat_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_DateFormat_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_DateFormat,
+ qtscript_Qt_DateFormat_valueOf, qtscript_Qt_DateFormat_toString);
+ qScriptRegisterMetaType<Qt::DateFormat>(engine, qtscript_Qt_DateFormat_toScriptValue,
+ qtscript_Qt_DateFormat_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 8; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_DateFormat_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_DateFormat_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::MaskMode
+//
+
+static const Qt::MaskMode qtscript_Qt_MaskMode_values[] = {
+ Qt::MaskInColor
+ , Qt::MaskOutColor
+};
+
+static const char * const qtscript_Qt_MaskMode_keys[] = {
+ "MaskInColor"
+ , "MaskOutColor"
+};
+
+static QString qtscript_Qt_MaskMode_toStringHelper(Qt::MaskMode value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("MaskMode");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_MaskMode_toScriptValue(QScriptEngine *engine, const Qt::MaskMode &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_MaskMode_toStringHelper(value));
+}
+
+static void qtscript_Qt_MaskMode_fromScriptValue(const QScriptValue &value, Qt::MaskMode &out)
+{
+ out = qvariant_cast<Qt::MaskMode>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_MaskMode(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("MaskMode");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::MaskMode>(arg));
+ return context->throwError(QString::fromLatin1("MaskMode(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_MaskMode_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::MaskMode value = qscriptvalue_cast<Qt::MaskMode>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_MaskMode_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::MaskMode value = qscriptvalue_cast<Qt::MaskMode>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_MaskMode_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_MaskMode_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_MaskMode,
+ qtscript_Qt_MaskMode_valueOf, qtscript_Qt_MaskMode_toString);
+ qScriptRegisterMetaType<Qt::MaskMode>(engine, qtscript_Qt_MaskMode_toScriptValue,
+ qtscript_Qt_MaskMode_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_MaskMode_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_MaskMode_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::UIEffect
+//
+
+static const Qt::UIEffect qtscript_Qt_UIEffect_values[] = {
+ Qt::UI_General
+ , Qt::UI_AnimateMenu
+ , Qt::UI_FadeMenu
+ , Qt::UI_AnimateCombo
+ , Qt::UI_AnimateTooltip
+ , Qt::UI_FadeTooltip
+ , Qt::UI_AnimateToolBox
+};
+
+static const char * const qtscript_Qt_UIEffect_keys[] = {
+ "UI_General"
+ , "UI_AnimateMenu"
+ , "UI_FadeMenu"
+ , "UI_AnimateCombo"
+ , "UI_AnimateTooltip"
+ , "UI_FadeTooltip"
+ , "UI_AnimateToolBox"
+};
+
+static QString qtscript_Qt_UIEffect_toStringHelper(Qt::UIEffect value)
+{
+ if ((value >= Qt::UI_General) && (value <= Qt::UI_AnimateToolBox))
+ return qtscript_Qt_UIEffect_keys[static_cast<int>(value)-static_cast<int>(Qt::UI_General)];
+ return QString();
+}
+
+static QScriptValue qtscript_Qt_UIEffect_toScriptValue(QScriptEngine *engine, const Qt::UIEffect &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_UIEffect_toStringHelper(value));
+}
+
+static void qtscript_Qt_UIEffect_fromScriptValue(const QScriptValue &value, Qt::UIEffect &out)
+{
+ out = qvariant_cast<Qt::UIEffect>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_UIEffect(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= Qt::UI_General) && (arg <= Qt::UI_AnimateToolBox))
+ return qScriptValueFromValue(engine, static_cast<Qt::UIEffect>(arg));
+ return context->throwError(QString::fromLatin1("UIEffect(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_UIEffect_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::UIEffect value = qscriptvalue_cast<Qt::UIEffect>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_UIEffect_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::UIEffect value = qscriptvalue_cast<Qt::UIEffect>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_UIEffect_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_UIEffect_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_UIEffect,
+ qtscript_Qt_UIEffect_valueOf, qtscript_Qt_UIEffect_toString);
+ qScriptRegisterMetaType<Qt::UIEffect>(engine, qtscript_Qt_UIEffect_toScriptValue,
+ qtscript_Qt_UIEffect_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 7; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_UIEffect_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_UIEffect_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::ContextMenuPolicy
+//
+
+static const Qt::ContextMenuPolicy qtscript_Qt_ContextMenuPolicy_values[] = {
+ Qt::NoContextMenu
+ , Qt::DefaultContextMenu
+ , Qt::ActionsContextMenu
+ , Qt::CustomContextMenu
+ , Qt::PreventContextMenu
+};
+
+static const char * const qtscript_Qt_ContextMenuPolicy_keys[] = {
+ "NoContextMenu"
+ , "DefaultContextMenu"
+ , "ActionsContextMenu"
+ , "CustomContextMenu"
+ , "PreventContextMenu"
+};
+
+static QString qtscript_Qt_ContextMenuPolicy_toStringHelper(Qt::ContextMenuPolicy value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("ContextMenuPolicy");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_ContextMenuPolicy_toScriptValue(QScriptEngine *engine, const Qt::ContextMenuPolicy &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_ContextMenuPolicy_toStringHelper(value));
+}
+
+static void qtscript_Qt_ContextMenuPolicy_fromScriptValue(const QScriptValue &value, Qt::ContextMenuPolicy &out)
+{
+ out = qvariant_cast<Qt::ContextMenuPolicy>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_ContextMenuPolicy(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("ContextMenuPolicy");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::ContextMenuPolicy>(arg));
+ return context->throwError(QString::fromLatin1("ContextMenuPolicy(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_ContextMenuPolicy_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ContextMenuPolicy value = qscriptvalue_cast<Qt::ContextMenuPolicy>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_ContextMenuPolicy_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ContextMenuPolicy value = qscriptvalue_cast<Qt::ContextMenuPolicy>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_ContextMenuPolicy_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_ContextMenuPolicy_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_ContextMenuPolicy,
+ qtscript_Qt_ContextMenuPolicy_valueOf, qtscript_Qt_ContextMenuPolicy_toString);
+ qScriptRegisterMetaType<Qt::ContextMenuPolicy>(engine, qtscript_Qt_ContextMenuPolicy_toScriptValue,
+ qtscript_Qt_ContextMenuPolicy_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 5; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_ContextMenuPolicy_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_ContextMenuPolicy_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::AnchorAttribute
+//
+
+static const Qt::AnchorAttribute qtscript_Qt_AnchorAttribute_values[] = {
+ Qt::AnchorName
+ , Qt::AnchorHref
+};
+
+static const char * const qtscript_Qt_AnchorAttribute_keys[] = {
+ "AnchorName"
+ , "AnchorHref"
+};
+
+static QString qtscript_Qt_AnchorAttribute_toStringHelper(Qt::AnchorAttribute value)
+{
+ if ((value >= Qt::AnchorName) && (value <= Qt::AnchorHref))
+ return qtscript_Qt_AnchorAttribute_keys[static_cast<int>(value)-static_cast<int>(Qt::AnchorName)];
+ return QString();
+}
+
+static QScriptValue qtscript_Qt_AnchorAttribute_toScriptValue(QScriptEngine *engine, const Qt::AnchorAttribute &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_AnchorAttribute_toStringHelper(value));
+}
+
+static void qtscript_Qt_AnchorAttribute_fromScriptValue(const QScriptValue &value, Qt::AnchorAttribute &out)
+{
+ out = qvariant_cast<Qt::AnchorAttribute>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_AnchorAttribute(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= Qt::AnchorName) && (arg <= Qt::AnchorHref))
+ return qScriptValueFromValue(engine, static_cast<Qt::AnchorAttribute>(arg));
+ return context->throwError(QString::fromLatin1("AnchorAttribute(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_AnchorAttribute_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::AnchorAttribute value = qscriptvalue_cast<Qt::AnchorAttribute>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_AnchorAttribute_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::AnchorAttribute value = qscriptvalue_cast<Qt::AnchorAttribute>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_AnchorAttribute_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_AnchorAttribute_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_AnchorAttribute,
+ qtscript_Qt_AnchorAttribute_valueOf, qtscript_Qt_AnchorAttribute_toString);
+ qScriptRegisterMetaType<Qt::AnchorAttribute>(engine, qtscript_Qt_AnchorAttribute_toScriptValue,
+ qtscript_Qt_AnchorAttribute_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_AnchorAttribute_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_AnchorAttribute_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::ScrollBarPolicy
+//
+
+static const Qt::ScrollBarPolicy qtscript_Qt_ScrollBarPolicy_values[] = {
+ Qt::ScrollBarAsNeeded
+ , Qt::ScrollBarAlwaysOff
+ , Qt::ScrollBarAlwaysOn
+};
+
+static const char * const qtscript_Qt_ScrollBarPolicy_keys[] = {
+ "ScrollBarAsNeeded"
+ , "ScrollBarAlwaysOff"
+ , "ScrollBarAlwaysOn"
+};
+
+static QString qtscript_Qt_ScrollBarPolicy_toStringHelper(Qt::ScrollBarPolicy value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("ScrollBarPolicy");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_ScrollBarPolicy_toScriptValue(QScriptEngine *engine, const Qt::ScrollBarPolicy &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_ScrollBarPolicy_toStringHelper(value));
+}
+
+static void qtscript_Qt_ScrollBarPolicy_fromScriptValue(const QScriptValue &value, Qt::ScrollBarPolicy &out)
+{
+ out = qvariant_cast<Qt::ScrollBarPolicy>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_ScrollBarPolicy(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("ScrollBarPolicy");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::ScrollBarPolicy>(arg));
+ return context->throwError(QString::fromLatin1("ScrollBarPolicy(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_ScrollBarPolicy_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ScrollBarPolicy value = qscriptvalue_cast<Qt::ScrollBarPolicy>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_ScrollBarPolicy_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ScrollBarPolicy value = qscriptvalue_cast<Qt::ScrollBarPolicy>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_ScrollBarPolicy_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_ScrollBarPolicy_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_ScrollBarPolicy,
+ qtscript_Qt_ScrollBarPolicy_valueOf, qtscript_Qt_ScrollBarPolicy_toString);
+ qScriptRegisterMetaType<Qt::ScrollBarPolicy>(engine, qtscript_Qt_ScrollBarPolicy_toScriptValue,
+ qtscript_Qt_ScrollBarPolicy_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_ScrollBarPolicy_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_ScrollBarPolicy_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::ToolButtonStyle
+//
+
+static const Qt::ToolButtonStyle qtscript_Qt_ToolButtonStyle_values[] = {
+ Qt::ToolButtonIconOnly
+ , Qt::ToolButtonTextOnly
+ , Qt::ToolButtonTextBesideIcon
+ , Qt::ToolButtonTextUnderIcon
+};
+
+static const char * const qtscript_Qt_ToolButtonStyle_keys[] = {
+ "ToolButtonIconOnly"
+ , "ToolButtonTextOnly"
+ , "ToolButtonTextBesideIcon"
+ , "ToolButtonTextUnderIcon"
+};
+
+static QString qtscript_Qt_ToolButtonStyle_toStringHelper(Qt::ToolButtonStyle value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("ToolButtonStyle");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_ToolButtonStyle_toScriptValue(QScriptEngine *engine, const Qt::ToolButtonStyle &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_ToolButtonStyle_toStringHelper(value));
+}
+
+static void qtscript_Qt_ToolButtonStyle_fromScriptValue(const QScriptValue &value, Qt::ToolButtonStyle &out)
+{
+ out = qvariant_cast<Qt::ToolButtonStyle>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_ToolButtonStyle(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("ToolButtonStyle");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::ToolButtonStyle>(arg));
+ return context->throwError(QString::fromLatin1("ToolButtonStyle(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_ToolButtonStyle_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ToolButtonStyle value = qscriptvalue_cast<Qt::ToolButtonStyle>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_ToolButtonStyle_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ToolButtonStyle value = qscriptvalue_cast<Qt::ToolButtonStyle>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_ToolButtonStyle_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_ToolButtonStyle_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_ToolButtonStyle,
+ qtscript_Qt_ToolButtonStyle_valueOf, qtscript_Qt_ToolButtonStyle_toString);
+ qScriptRegisterMetaType<Qt::ToolButtonStyle>(engine, qtscript_Qt_ToolButtonStyle_toScriptValue,
+ qtscript_Qt_ToolButtonStyle_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 4; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_ToolButtonStyle_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_ToolButtonStyle_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::TextFlag
+//
+
+static const Qt::TextFlag qtscript_Qt_TextFlag_values[] = {
+ Qt::TextSingleLine
+ , Qt::TextDontClip
+ , Qt::TextExpandTabs
+ , Qt::TextShowMnemonic
+ , Qt::TextWordWrap
+ , Qt::TextWrapAnywhere
+ , Qt::TextDontPrint
+ , Qt::TextHideMnemonic
+ , Qt::TextJustificationForced
+ , Qt::TextForceLeftToRight
+ , Qt::TextForceRightToLeft
+ , Qt::TextIncludeTrailingSpaces
+};
+
+static const char * const qtscript_Qt_TextFlag_keys[] = {
+ "TextSingleLine"
+ , "TextDontClip"
+ , "TextExpandTabs"
+ , "TextShowMnemonic"
+ , "TextWordWrap"
+ , "TextWrapAnywhere"
+ , "TextDontPrint"
+ , "TextHideMnemonic"
+ , "TextJustificationForced"
+ , "TextForceLeftToRight"
+ , "TextForceRightToLeft"
+ , "TextIncludeTrailingSpaces"
+};
+
+static QString qtscript_Qt_TextFlag_toStringHelper(Qt::TextFlag value)
+{
+ for (int i = 0; i < 12; ++i) {
+ if (qtscript_Qt_TextFlag_values[i] == value)
+ return QString::fromLatin1(qtscript_Qt_TextFlag_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_Qt_TextFlag_toScriptValue(QScriptEngine *engine, const Qt::TextFlag &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_TextFlag_toStringHelper(value));
+}
+
+static void qtscript_Qt_TextFlag_fromScriptValue(const QScriptValue &value, Qt::TextFlag &out)
+{
+ out = qvariant_cast<Qt::TextFlag>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_TextFlag(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 12; ++i) {
+ if (qtscript_Qt_TextFlag_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<Qt::TextFlag>(arg));
+ }
+ return context->throwError(QString::fromLatin1("TextFlag(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_TextFlag_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::TextFlag value = qscriptvalue_cast<Qt::TextFlag>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_TextFlag_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::TextFlag value = qscriptvalue_cast<Qt::TextFlag>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_TextFlag_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_TextFlag_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_TextFlag,
+ qtscript_Qt_TextFlag_valueOf, qtscript_Qt_TextFlag_toString);
+ qScriptRegisterMetaType<Qt::TextFlag>(engine, qtscript_Qt_TextFlag_toScriptValue,
+ qtscript_Qt_TextFlag_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 12; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_TextFlag_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_TextFlag_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::ItemSelectionMode
+//
+
+static const Qt::ItemSelectionMode qtscript_Qt_ItemSelectionMode_values[] = {
+ Qt::ContainsItemShape
+ , Qt::IntersectsItemShape
+ , Qt::ContainsItemBoundingRect
+ , Qt::IntersectsItemBoundingRect
+};
+
+static const char * const qtscript_Qt_ItemSelectionMode_keys[] = {
+ "ContainsItemShape"
+ , "IntersectsItemShape"
+ , "ContainsItemBoundingRect"
+ , "IntersectsItemBoundingRect"
+};
+
+static QString qtscript_Qt_ItemSelectionMode_toStringHelper(Qt::ItemSelectionMode value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("ItemSelectionMode");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_ItemSelectionMode_toScriptValue(QScriptEngine *engine, const Qt::ItemSelectionMode &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_ItemSelectionMode_toStringHelper(value));
+}
+
+static void qtscript_Qt_ItemSelectionMode_fromScriptValue(const QScriptValue &value, Qt::ItemSelectionMode &out)
+{
+ out = qvariant_cast<Qt::ItemSelectionMode>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_ItemSelectionMode(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("ItemSelectionMode");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::ItemSelectionMode>(arg));
+ return context->throwError(QString::fromLatin1("ItemSelectionMode(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_ItemSelectionMode_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ItemSelectionMode value = qscriptvalue_cast<Qt::ItemSelectionMode>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_ItemSelectionMode_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ItemSelectionMode value = qscriptvalue_cast<Qt::ItemSelectionMode>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_ItemSelectionMode_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_ItemSelectionMode_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_ItemSelectionMode,
+ qtscript_Qt_ItemSelectionMode_valueOf, qtscript_Qt_ItemSelectionMode_toString);
+ qScriptRegisterMetaType<Qt::ItemSelectionMode>(engine, qtscript_Qt_ItemSelectionMode_toScriptValue,
+ qtscript_Qt_ItemSelectionMode_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 4; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_ItemSelectionMode_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_ItemSelectionMode_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::SizeHint
+//
+
+static const Qt::SizeHint qtscript_Qt_SizeHint_values[] = {
+ Qt::MinimumSize
+ , Qt::PreferredSize
+ , Qt::MaximumSize
+ , Qt::MinimumDescent
+ , Qt::NSizeHints
+};
+
+static const char * const qtscript_Qt_SizeHint_keys[] = {
+ "MinimumSize"
+ , "PreferredSize"
+ , "MaximumSize"
+ , "MinimumDescent"
+ , "NSizeHints"
+};
+
+static QString qtscript_Qt_SizeHint_toStringHelper(Qt::SizeHint value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("SizeHint");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_SizeHint_toScriptValue(QScriptEngine *engine, const Qt::SizeHint &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_SizeHint_toStringHelper(value));
+}
+
+static void qtscript_Qt_SizeHint_fromScriptValue(const QScriptValue &value, Qt::SizeHint &out)
+{
+ out = qvariant_cast<Qt::SizeHint>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_SizeHint(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("SizeHint");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::SizeHint>(arg));
+ return context->throwError(QString::fromLatin1("SizeHint(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_SizeHint_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::SizeHint value = qscriptvalue_cast<Qt::SizeHint>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_SizeHint_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::SizeHint value = qscriptvalue_cast<Qt::SizeHint>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_SizeHint_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_SizeHint_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_SizeHint,
+ qtscript_Qt_SizeHint_valueOf, qtscript_Qt_SizeHint_toString);
+ qScriptRegisterMetaType<Qt::SizeHint>(engine, qtscript_Qt_SizeHint_toScriptValue,
+ qtscript_Qt_SizeHint_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 5; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_SizeHint_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_SizeHint_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::Key
+//
+
+static const Qt::Key qtscript_Qt_Key_values[] = {
+ Qt::Key_Space
+ , Qt::Key_Exclam
+ , Qt::Key_QuoteDbl
+ , Qt::Key_NumberSign
+ , Qt::Key_Dollar
+ , Qt::Key_Percent
+ , Qt::Key_Ampersand
+ , Qt::Key_Apostrophe
+ , Qt::Key_ParenLeft
+ , Qt::Key_ParenRight
+ , Qt::Key_Asterisk
+ , Qt::Key_Plus
+ , Qt::Key_Comma
+ , Qt::Key_Minus
+ , Qt::Key_Period
+ , Qt::Key_Slash
+ , Qt::Key_0
+ , Qt::Key_1
+ , Qt::Key_2
+ , Qt::Key_3
+ , Qt::Key_4
+ , Qt::Key_5
+ , Qt::Key_6
+ , Qt::Key_7
+ , Qt::Key_8
+ , Qt::Key_9
+ , Qt::Key_Colon
+ , Qt::Key_Semicolon
+ , Qt::Key_Less
+ , Qt::Key_Equal
+ , Qt::Key_Greater
+ , Qt::Key_Question
+ , Qt::Key_At
+ , Qt::Key_A
+ , Qt::Key_B
+ , Qt::Key_C
+ , Qt::Key_D
+ , Qt::Key_E
+ , Qt::Key_F
+ , Qt::Key_G
+ , Qt::Key_H
+ , Qt::Key_I
+ , Qt::Key_J
+ , Qt::Key_K
+ , Qt::Key_L
+ , Qt::Key_M
+ , Qt::Key_N
+ , Qt::Key_O
+ , Qt::Key_P
+ , Qt::Key_Q
+ , Qt::Key_R
+ , Qt::Key_S
+ , Qt::Key_T
+ , Qt::Key_U
+ , Qt::Key_V
+ , Qt::Key_W
+ , Qt::Key_X
+ , Qt::Key_Y
+ , Qt::Key_Z
+ , Qt::Key_BracketLeft
+ , Qt::Key_Backslash
+ , Qt::Key_BracketRight
+ , Qt::Key_AsciiCircum
+ , Qt::Key_Underscore
+ , Qt::Key_QuoteLeft
+ , Qt::Key_BraceLeft
+ , Qt::Key_Bar
+ , Qt::Key_BraceRight
+ , Qt::Key_AsciiTilde
+ , Qt::Key_nobreakspace
+ , Qt::Key_exclamdown
+ , Qt::Key_cent
+ , Qt::Key_sterling
+ , Qt::Key_currency
+ , Qt::Key_yen
+ , Qt::Key_brokenbar
+ , Qt::Key_section
+ , Qt::Key_diaeresis
+ , Qt::Key_copyright
+ , Qt::Key_ordfeminine
+ , Qt::Key_guillemotleft
+ , Qt::Key_notsign
+ , Qt::Key_hyphen
+ , Qt::Key_registered
+ , Qt::Key_macron
+ , Qt::Key_degree
+ , Qt::Key_plusminus
+ , Qt::Key_twosuperior
+ , Qt::Key_threesuperior
+ , Qt::Key_acute
+ , Qt::Key_mu
+ , Qt::Key_paragraph
+ , Qt::Key_periodcentered
+ , Qt::Key_cedilla
+ , Qt::Key_onesuperior
+ , Qt::Key_masculine
+ , Qt::Key_guillemotright
+ , Qt::Key_onequarter
+ , Qt::Key_onehalf
+ , Qt::Key_threequarters
+ , Qt::Key_questiondown
+ , Qt::Key_Agrave
+ , Qt::Key_Aacute
+ , Qt::Key_Acircumflex
+ , Qt::Key_Atilde
+ , Qt::Key_Adiaeresis
+ , Qt::Key_Aring
+ , Qt::Key_AE
+ , Qt::Key_Ccedilla
+ , Qt::Key_Egrave
+ , Qt::Key_Eacute
+ , Qt::Key_Ecircumflex
+ , Qt::Key_Ediaeresis
+ , Qt::Key_Igrave
+ , Qt::Key_Iacute
+ , Qt::Key_Icircumflex
+ , Qt::Key_Idiaeresis
+ , Qt::Key_ETH
+ , Qt::Key_Ntilde
+ , Qt::Key_Ograve
+ , Qt::Key_Oacute
+ , Qt::Key_Ocircumflex
+ , Qt::Key_Otilde
+ , Qt::Key_Odiaeresis
+ , Qt::Key_multiply
+ , Qt::Key_Ooblique
+ , Qt::Key_Ugrave
+ , Qt::Key_Uacute
+ , Qt::Key_Ucircumflex
+ , Qt::Key_Udiaeresis
+ , Qt::Key_Yacute
+ , Qt::Key_THORN
+ , Qt::Key_ssharp
+ , Qt::Key_division
+ , Qt::Key_ydiaeresis
+ , Qt::Key_Escape
+ , Qt::Key_Tab
+ , Qt::Key_Backtab
+ , Qt::Key_Backspace
+ , Qt::Key_Return
+ , Qt::Key_Enter
+ , Qt::Key_Insert
+ , Qt::Key_Delete
+ , Qt::Key_Pause
+ , Qt::Key_Print
+ , Qt::Key_SysReq
+ , Qt::Key_Clear
+ , Qt::Key_Home
+ , Qt::Key_End
+ , Qt::Key_Left
+ , Qt::Key_Up
+ , Qt::Key_Right
+ , Qt::Key_Down
+ , Qt::Key_PageUp
+ , Qt::Key_PageDown
+ , Qt::Key_Shift
+ , Qt::Key_Control
+ , Qt::Key_Meta
+ , Qt::Key_Alt
+ , Qt::Key_CapsLock
+ , Qt::Key_NumLock
+ , Qt::Key_ScrollLock
+ , Qt::Key_F1
+ , Qt::Key_F2
+ , Qt::Key_F3
+ , Qt::Key_F4
+ , Qt::Key_F5
+ , Qt::Key_F6
+ , Qt::Key_F7
+ , Qt::Key_F8
+ , Qt::Key_F9
+ , Qt::Key_F10
+ , Qt::Key_F11
+ , Qt::Key_F12
+ , Qt::Key_F13
+ , Qt::Key_F14
+ , Qt::Key_F15
+ , Qt::Key_F16
+ , Qt::Key_F17
+ , Qt::Key_F18
+ , Qt::Key_F19
+ , Qt::Key_F20
+ , Qt::Key_F21
+ , Qt::Key_F22
+ , Qt::Key_F23
+ , Qt::Key_F24
+ , Qt::Key_F25
+ , Qt::Key_F26
+ , Qt::Key_F27
+ , Qt::Key_F28
+ , Qt::Key_F29
+ , Qt::Key_F30
+ , Qt::Key_F31
+ , Qt::Key_F32
+ , Qt::Key_F33
+ , Qt::Key_F34
+ , Qt::Key_F35
+ , Qt::Key_Super_L
+ , Qt::Key_Super_R
+ , Qt::Key_Menu
+ , Qt::Key_Hyper_L
+ , Qt::Key_Hyper_R
+ , Qt::Key_Help
+ , Qt::Key_Direction_L
+ , Qt::Key_Direction_R
+ , Qt::Key_Back
+ , Qt::Key_Forward
+ , Qt::Key_Stop
+ , Qt::Key_Refresh
+ , Qt::Key_VolumeDown
+ , Qt::Key_VolumeMute
+ , Qt::Key_VolumeUp
+ , Qt::Key_BassBoost
+ , Qt::Key_BassUp
+ , Qt::Key_BassDown
+ , Qt::Key_TrebleUp
+ , Qt::Key_TrebleDown
+ , Qt::Key_MediaPlay
+ , Qt::Key_MediaStop
+ , Qt::Key_MediaPrevious
+ , Qt::Key_MediaNext
+ , Qt::Key_MediaRecord
+ , Qt::Key_HomePage
+ , Qt::Key_Favorites
+ , Qt::Key_Search
+ , Qt::Key_Standby
+ , Qt::Key_OpenUrl
+ , Qt::Key_LaunchMail
+ , Qt::Key_LaunchMedia
+ , Qt::Key_Launch0
+ , Qt::Key_Launch1
+ , Qt::Key_Launch2
+ , Qt::Key_Launch3
+ , Qt::Key_Launch4
+ , Qt::Key_Launch5
+ , Qt::Key_Launch6
+ , Qt::Key_Launch7
+ , Qt::Key_Launch8
+ , Qt::Key_Launch9
+ , Qt::Key_LaunchA
+ , Qt::Key_LaunchB
+ , Qt::Key_LaunchC
+ , Qt::Key_LaunchD
+ , Qt::Key_LaunchE
+ , Qt::Key_LaunchF
+ , Qt::Key_AltGr
+ , Qt::Key_Multi_key
+ , Qt::Key_Kanji
+ , Qt::Key_Muhenkan
+ , Qt::Key_Henkan
+ , Qt::Key_Romaji
+ , Qt::Key_Hiragana
+ , Qt::Key_Katakana
+ , Qt::Key_Hiragana_Katakana
+ , Qt::Key_Zenkaku
+ , Qt::Key_Hankaku
+ , Qt::Key_Zenkaku_Hankaku
+ , Qt::Key_Touroku
+ , Qt::Key_Massyo
+ , Qt::Key_Kana_Lock
+ , Qt::Key_Kana_Shift
+ , Qt::Key_Eisu_Shift
+ , Qt::Key_Eisu_toggle
+ , Qt::Key_Hangul
+ , Qt::Key_Hangul_Start
+ , Qt::Key_Hangul_End
+ , Qt::Key_Hangul_Hanja
+ , Qt::Key_Hangul_Jamo
+ , Qt::Key_Hangul_Romaja
+ , Qt::Key_Codeinput
+ , Qt::Key_Hangul_Jeonja
+ , Qt::Key_Hangul_Banja
+ , Qt::Key_Hangul_PreHanja
+ , Qt::Key_Hangul_PostHanja
+ , Qt::Key_SingleCandidate
+ , Qt::Key_MultipleCandidate
+ , Qt::Key_PreviousCandidate
+ , Qt::Key_Hangul_Special
+ , Qt::Key_Mode_switch
+ , Qt::Key_Dead_Grave
+ , Qt::Key_Dead_Acute
+ , Qt::Key_Dead_Circumflex
+ , Qt::Key_Dead_Tilde
+ , Qt::Key_Dead_Macron
+ , Qt::Key_Dead_Breve
+ , Qt::Key_Dead_Abovedot
+ , Qt::Key_Dead_Diaeresis
+ , Qt::Key_Dead_Abovering
+ , Qt::Key_Dead_Doubleacute
+ , Qt::Key_Dead_Caron
+ , Qt::Key_Dead_Cedilla
+ , Qt::Key_Dead_Ogonek
+ , Qt::Key_Dead_Iota
+ , Qt::Key_Dead_Voiced_Sound
+ , Qt::Key_Dead_Semivoiced_Sound
+ , Qt::Key_Dead_Belowdot
+ , Qt::Key_Dead_Hook
+ , Qt::Key_Dead_Horn
+ , Qt::Key_MediaLast
+ , Qt::Key_Select
+ , Qt::Key_Yes
+ , Qt::Key_No
+ , Qt::Key_Cancel
+ , Qt::Key_Printer
+ , Qt::Key_Execute
+ , Qt::Key_Sleep
+ , Qt::Key_Play
+ , Qt::Key_Zoom
+ , Qt::Key_Context1
+ , Qt::Key_Context2
+ , Qt::Key_Context3
+ , Qt::Key_Context4
+ , Qt::Key_Call
+ , Qt::Key_Hangup
+ , Qt::Key_Flip
+ , Qt::Key_unknown
+};
+
+static const char * const qtscript_Qt_Key_keys[] = {
+ "Key_Space"
+ , "Key_Exclam"
+ , "Key_QuoteDbl"
+ , "Key_NumberSign"
+ , "Key_Dollar"
+ , "Key_Percent"
+ , "Key_Ampersand"
+ , "Key_Apostrophe"
+ , "Key_ParenLeft"
+ , "Key_ParenRight"
+ , "Key_Asterisk"
+ , "Key_Plus"
+ , "Key_Comma"
+ , "Key_Minus"
+ , "Key_Period"
+ , "Key_Slash"
+ , "Key_0"
+ , "Key_1"
+ , "Key_2"
+ , "Key_3"
+ , "Key_4"
+ , "Key_5"
+ , "Key_6"
+ , "Key_7"
+ , "Key_8"
+ , "Key_9"
+ , "Key_Colon"
+ , "Key_Semicolon"
+ , "Key_Less"
+ , "Key_Equal"
+ , "Key_Greater"
+ , "Key_Question"
+ , "Key_At"
+ , "Key_A"
+ , "Key_B"
+ , "Key_C"
+ , "Key_D"
+ , "Key_E"
+ , "Key_F"
+ , "Key_G"
+ , "Key_H"
+ , "Key_I"
+ , "Key_J"
+ , "Key_K"
+ , "Key_L"
+ , "Key_M"
+ , "Key_N"
+ , "Key_O"
+ , "Key_P"
+ , "Key_Q"
+ , "Key_R"
+ , "Key_S"
+ , "Key_T"
+ , "Key_U"
+ , "Key_V"
+ , "Key_W"
+ , "Key_X"
+ , "Key_Y"
+ , "Key_Z"
+ , "Key_BracketLeft"
+ , "Key_Backslash"
+ , "Key_BracketRight"
+ , "Key_AsciiCircum"
+ , "Key_Underscore"
+ , "Key_QuoteLeft"
+ , "Key_BraceLeft"
+ , "Key_Bar"
+ , "Key_BraceRight"
+ , "Key_AsciiTilde"
+ , "Key_nobreakspace"
+ , "Key_exclamdown"
+ , "Key_cent"
+ , "Key_sterling"
+ , "Key_currency"
+ , "Key_yen"
+ , "Key_brokenbar"
+ , "Key_section"
+ , "Key_diaeresis"
+ , "Key_copyright"
+ , "Key_ordfeminine"
+ , "Key_guillemotleft"
+ , "Key_notsign"
+ , "Key_hyphen"
+ , "Key_registered"
+ , "Key_macron"
+ , "Key_degree"
+ , "Key_plusminus"
+ , "Key_twosuperior"
+ , "Key_threesuperior"
+ , "Key_acute"
+ , "Key_mu"
+ , "Key_paragraph"
+ , "Key_periodcentered"
+ , "Key_cedilla"
+ , "Key_onesuperior"
+ , "Key_masculine"
+ , "Key_guillemotright"
+ , "Key_onequarter"
+ , "Key_onehalf"
+ , "Key_threequarters"
+ , "Key_questiondown"
+ , "Key_Agrave"
+ , "Key_Aacute"
+ , "Key_Acircumflex"
+ , "Key_Atilde"
+ , "Key_Adiaeresis"
+ , "Key_Aring"
+ , "Key_AE"
+ , "Key_Ccedilla"
+ , "Key_Egrave"
+ , "Key_Eacute"
+ , "Key_Ecircumflex"
+ , "Key_Ediaeresis"
+ , "Key_Igrave"
+ , "Key_Iacute"
+ , "Key_Icircumflex"
+ , "Key_Idiaeresis"
+ , "Key_ETH"
+ , "Key_Ntilde"
+ , "Key_Ograve"
+ , "Key_Oacute"
+ , "Key_Ocircumflex"
+ , "Key_Otilde"
+ , "Key_Odiaeresis"
+ , "Key_multiply"
+ , "Key_Ooblique"
+ , "Key_Ugrave"
+ , "Key_Uacute"
+ , "Key_Ucircumflex"
+ , "Key_Udiaeresis"
+ , "Key_Yacute"
+ , "Key_THORN"
+ , "Key_ssharp"
+ , "Key_division"
+ , "Key_ydiaeresis"
+ , "Key_Escape"
+ , "Key_Tab"
+ , "Key_Backtab"
+ , "Key_Backspace"
+ , "Key_Return"
+ , "Key_Enter"
+ , "Key_Insert"
+ , "Key_Delete"
+ , "Key_Pause"
+ , "Key_Print"
+ , "Key_SysReq"
+ , "Key_Clear"
+ , "Key_Home"
+ , "Key_End"
+ , "Key_Left"
+ , "Key_Up"
+ , "Key_Right"
+ , "Key_Down"
+ , "Key_PageUp"
+ , "Key_PageDown"
+ , "Key_Shift"
+ , "Key_Control"
+ , "Key_Meta"
+ , "Key_Alt"
+ , "Key_CapsLock"
+ , "Key_NumLock"
+ , "Key_ScrollLock"
+ , "Key_F1"
+ , "Key_F2"
+ , "Key_F3"
+ , "Key_F4"
+ , "Key_F5"
+ , "Key_F6"
+ , "Key_F7"
+ , "Key_F8"
+ , "Key_F9"
+ , "Key_F10"
+ , "Key_F11"
+ , "Key_F12"
+ , "Key_F13"
+ , "Key_F14"
+ , "Key_F15"
+ , "Key_F16"
+ , "Key_F17"
+ , "Key_F18"
+ , "Key_F19"
+ , "Key_F20"
+ , "Key_F21"
+ , "Key_F22"
+ , "Key_F23"
+ , "Key_F24"
+ , "Key_F25"
+ , "Key_F26"
+ , "Key_F27"
+ , "Key_F28"
+ , "Key_F29"
+ , "Key_F30"
+ , "Key_F31"
+ , "Key_F32"
+ , "Key_F33"
+ , "Key_F34"
+ , "Key_F35"
+ , "Key_Super_L"
+ , "Key_Super_R"
+ , "Key_Menu"
+ , "Key_Hyper_L"
+ , "Key_Hyper_R"
+ , "Key_Help"
+ , "Key_Direction_L"
+ , "Key_Direction_R"
+ , "Key_Back"
+ , "Key_Forward"
+ , "Key_Stop"
+ , "Key_Refresh"
+ , "Key_VolumeDown"
+ , "Key_VolumeMute"
+ , "Key_VolumeUp"
+ , "Key_BassBoost"
+ , "Key_BassUp"
+ , "Key_BassDown"
+ , "Key_TrebleUp"
+ , "Key_TrebleDown"
+ , "Key_MediaPlay"
+ , "Key_MediaStop"
+ , "Key_MediaPrevious"
+ , "Key_MediaNext"
+ , "Key_MediaRecord"
+ , "Key_HomePage"
+ , "Key_Favorites"
+ , "Key_Search"
+ , "Key_Standby"
+ , "Key_OpenUrl"
+ , "Key_LaunchMail"
+ , "Key_LaunchMedia"
+ , "Key_Launch0"
+ , "Key_Launch1"
+ , "Key_Launch2"
+ , "Key_Launch3"
+ , "Key_Launch4"
+ , "Key_Launch5"
+ , "Key_Launch6"
+ , "Key_Launch7"
+ , "Key_Launch8"
+ , "Key_Launch9"
+ , "Key_LaunchA"
+ , "Key_LaunchB"
+ , "Key_LaunchC"
+ , "Key_LaunchD"
+ , "Key_LaunchE"
+ , "Key_LaunchF"
+ , "Key_AltGr"
+ , "Key_Multi_key"
+ , "Key_Kanji"
+ , "Key_Muhenkan"
+ , "Key_Henkan"
+ , "Key_Romaji"
+ , "Key_Hiragana"
+ , "Key_Katakana"
+ , "Key_Hiragana_Katakana"
+ , "Key_Zenkaku"
+ , "Key_Hankaku"
+ , "Key_Zenkaku_Hankaku"
+ , "Key_Touroku"
+ , "Key_Massyo"
+ , "Key_Kana_Lock"
+ , "Key_Kana_Shift"
+ , "Key_Eisu_Shift"
+ , "Key_Eisu_toggle"
+ , "Key_Hangul"
+ , "Key_Hangul_Start"
+ , "Key_Hangul_End"
+ , "Key_Hangul_Hanja"
+ , "Key_Hangul_Jamo"
+ , "Key_Hangul_Romaja"
+ , "Key_Codeinput"
+ , "Key_Hangul_Jeonja"
+ , "Key_Hangul_Banja"
+ , "Key_Hangul_PreHanja"
+ , "Key_Hangul_PostHanja"
+ , "Key_SingleCandidate"
+ , "Key_MultipleCandidate"
+ , "Key_PreviousCandidate"
+ , "Key_Hangul_Special"
+ , "Key_Mode_switch"
+ , "Key_Dead_Grave"
+ , "Key_Dead_Acute"
+ , "Key_Dead_Circumflex"
+ , "Key_Dead_Tilde"
+ , "Key_Dead_Macron"
+ , "Key_Dead_Breve"
+ , "Key_Dead_Abovedot"
+ , "Key_Dead_Diaeresis"
+ , "Key_Dead_Abovering"
+ , "Key_Dead_Doubleacute"
+ , "Key_Dead_Caron"
+ , "Key_Dead_Cedilla"
+ , "Key_Dead_Ogonek"
+ , "Key_Dead_Iota"
+ , "Key_Dead_Voiced_Sound"
+ , "Key_Dead_Semivoiced_Sound"
+ , "Key_Dead_Belowdot"
+ , "Key_Dead_Hook"
+ , "Key_Dead_Horn"
+ , "Key_MediaLast"
+ , "Key_Select"
+ , "Key_Yes"
+ , "Key_No"
+ , "Key_Cancel"
+ , "Key_Printer"
+ , "Key_Execute"
+ , "Key_Sleep"
+ , "Key_Play"
+ , "Key_Zoom"
+ , "Key_Context1"
+ , "Key_Context2"
+ , "Key_Context3"
+ , "Key_Context4"
+ , "Key_Call"
+ , "Key_Hangup"
+ , "Key_Flip"
+ , "Key_unknown"
+};
+
+static QString qtscript_Qt_Key_toStringHelper(Qt::Key value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("Key");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_Key_toScriptValue(QScriptEngine *engine, const Qt::Key &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_Key_toStringHelper(value));
+}
+
+static void qtscript_Qt_Key_fromScriptValue(const QScriptValue &value, Qt::Key &out)
+{
+ out = qvariant_cast<Qt::Key>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_Key(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("Key");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::Key>(arg));
+ return context->throwError(QString::fromLatin1("Key(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_Key_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::Key value = qscriptvalue_cast<Qt::Key>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_Key_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::Key value = qscriptvalue_cast<Qt::Key>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_Key_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_Key_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_Key,
+ qtscript_Qt_Key_valueOf, qtscript_Qt_Key_toString);
+ qScriptRegisterMetaType<Qt::Key>(engine, qtscript_Qt_Key_toScriptValue,
+ qtscript_Qt_Key_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 316; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_Key_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_Key_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::ToolBarAreaSizes
+//
+
+static const Qt::ToolBarAreaSizes qtscript_Qt_ToolBarAreaSizes_values[] = {
+ Qt::NToolBarAreas
+};
+
+static const char * const qtscript_Qt_ToolBarAreaSizes_keys[] = {
+ "NToolBarAreas"
+};
+
+static QString qtscript_Qt_ToolBarAreaSizes_toStringHelper(Qt::ToolBarAreaSizes value)
+{
+ if ((value >= Qt::NToolBarAreas) && (value <= Qt::NToolBarAreas))
+ return qtscript_Qt_ToolBarAreaSizes_keys[static_cast<int>(value)-static_cast<int>(Qt::NToolBarAreas)];
+ return QString();
+}
+
+static QScriptValue qtscript_Qt_ToolBarAreaSizes_toScriptValue(QScriptEngine *engine, const Qt::ToolBarAreaSizes &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_ToolBarAreaSizes_toStringHelper(value));
+}
+
+static void qtscript_Qt_ToolBarAreaSizes_fromScriptValue(const QScriptValue &value, Qt::ToolBarAreaSizes &out)
+{
+ out = qvariant_cast<Qt::ToolBarAreaSizes>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_ToolBarAreaSizes(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= Qt::NToolBarAreas) && (arg <= Qt::NToolBarAreas))
+ return qScriptValueFromValue(engine, static_cast<Qt::ToolBarAreaSizes>(arg));
+ return context->throwError(QString::fromLatin1("ToolBarAreaSizes(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_ToolBarAreaSizes_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ToolBarAreaSizes value = qscriptvalue_cast<Qt::ToolBarAreaSizes>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_ToolBarAreaSizes_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ToolBarAreaSizes value = qscriptvalue_cast<Qt::ToolBarAreaSizes>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_ToolBarAreaSizes_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_ToolBarAreaSizes_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_ToolBarAreaSizes,
+ qtscript_Qt_ToolBarAreaSizes_valueOf, qtscript_Qt_ToolBarAreaSizes_toString);
+ qScriptRegisterMetaType<Qt::ToolBarAreaSizes>(engine, qtscript_Qt_ToolBarAreaSizes_toScriptValue,
+ qtscript_Qt_ToolBarAreaSizes_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 1; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_ToolBarAreaSizes_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_ToolBarAreaSizes_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::ArrowType
+//
+
+static const Qt::ArrowType qtscript_Qt_ArrowType_values[] = {
+ Qt::NoArrow
+ , Qt::UpArrow
+ , Qt::DownArrow
+ , Qt::LeftArrow
+ , Qt::RightArrow
+};
+
+static const char * const qtscript_Qt_ArrowType_keys[] = {
+ "NoArrow"
+ , "UpArrow"
+ , "DownArrow"
+ , "LeftArrow"
+ , "RightArrow"
+};
+
+static QString qtscript_Qt_ArrowType_toStringHelper(Qt::ArrowType value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("ArrowType");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_ArrowType_toScriptValue(QScriptEngine *engine, const Qt::ArrowType &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_ArrowType_toStringHelper(value));
+}
+
+static void qtscript_Qt_ArrowType_fromScriptValue(const QScriptValue &value, Qt::ArrowType &out)
+{
+ out = qvariant_cast<Qt::ArrowType>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_ArrowType(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("ArrowType");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::ArrowType>(arg));
+ return context->throwError(QString::fromLatin1("ArrowType(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_ArrowType_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ArrowType value = qscriptvalue_cast<Qt::ArrowType>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_ArrowType_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ArrowType value = qscriptvalue_cast<Qt::ArrowType>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_ArrowType_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_ArrowType_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_ArrowType,
+ qtscript_Qt_ArrowType_valueOf, qtscript_Qt_ArrowType_toString);
+ qScriptRegisterMetaType<Qt::ArrowType>(engine, qtscript_Qt_ArrowType_toScriptValue,
+ qtscript_Qt_ArrowType_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 5; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_ArrowType_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_ArrowType_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::FocusPolicy
+//
+
+static const Qt::FocusPolicy qtscript_Qt_FocusPolicy_values[] = {
+ Qt::NoFocus
+ , Qt::TabFocus
+ , Qt::ClickFocus
+ , Qt::StrongFocus
+ , Qt::WheelFocus
+};
+
+static const char * const qtscript_Qt_FocusPolicy_keys[] = {
+ "NoFocus"
+ , "TabFocus"
+ , "ClickFocus"
+ , "StrongFocus"
+ , "WheelFocus"
+};
+
+static QString qtscript_Qt_FocusPolicy_toStringHelper(Qt::FocusPolicy value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("FocusPolicy");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_FocusPolicy_toScriptValue(QScriptEngine *engine, const Qt::FocusPolicy &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_FocusPolicy_toStringHelper(value));
+}
+
+static void qtscript_Qt_FocusPolicy_fromScriptValue(const QScriptValue &value, Qt::FocusPolicy &out)
+{
+ out = qvariant_cast<Qt::FocusPolicy>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_FocusPolicy(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("FocusPolicy");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::FocusPolicy>(arg));
+ return context->throwError(QString::fromLatin1("FocusPolicy(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_FocusPolicy_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::FocusPolicy value = qscriptvalue_cast<Qt::FocusPolicy>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_FocusPolicy_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::FocusPolicy value = qscriptvalue_cast<Qt::FocusPolicy>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_FocusPolicy_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_FocusPolicy_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_FocusPolicy,
+ qtscript_Qt_FocusPolicy_valueOf, qtscript_Qt_FocusPolicy_toString);
+ qScriptRegisterMetaType<Qt::FocusPolicy>(engine, qtscript_Qt_FocusPolicy_toScriptValue,
+ qtscript_Qt_FocusPolicy_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 5; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_FocusPolicy_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_FocusPolicy_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::WindowFrameSection
+//
+
+static const Qt::WindowFrameSection qtscript_Qt_WindowFrameSection_values[] = {
+ Qt::NoSection
+ , Qt::LeftSection
+ , Qt::TopLeftSection
+ , Qt::TopSection
+ , Qt::TopRightSection
+ , Qt::RightSection
+ , Qt::BottomRightSection
+ , Qt::BottomSection
+ , Qt::BottomLeftSection
+ , Qt::TitleBarArea
+};
+
+static const char * const qtscript_Qt_WindowFrameSection_keys[] = {
+ "NoSection"
+ , "LeftSection"
+ , "TopLeftSection"
+ , "TopSection"
+ , "TopRightSection"
+ , "RightSection"
+ , "BottomRightSection"
+ , "BottomSection"
+ , "BottomLeftSection"
+ , "TitleBarArea"
+};
+
+static QString qtscript_Qt_WindowFrameSection_toStringHelper(Qt::WindowFrameSection value)
+{
+ if ((value >= Qt::NoSection) && (value <= Qt::TitleBarArea))
+ return qtscript_Qt_WindowFrameSection_keys[static_cast<int>(value)-static_cast<int>(Qt::NoSection)];
+ return QString();
+}
+
+static QScriptValue qtscript_Qt_WindowFrameSection_toScriptValue(QScriptEngine *engine, const Qt::WindowFrameSection &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_WindowFrameSection_toStringHelper(value));
+}
+
+static void qtscript_Qt_WindowFrameSection_fromScriptValue(const QScriptValue &value, Qt::WindowFrameSection &out)
+{
+ out = qvariant_cast<Qt::WindowFrameSection>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_WindowFrameSection(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= Qt::NoSection) && (arg <= Qt::TitleBarArea))
+ return qScriptValueFromValue(engine, static_cast<Qt::WindowFrameSection>(arg));
+ return context->throwError(QString::fromLatin1("WindowFrameSection(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_WindowFrameSection_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::WindowFrameSection value = qscriptvalue_cast<Qt::WindowFrameSection>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_WindowFrameSection_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::WindowFrameSection value = qscriptvalue_cast<Qt::WindowFrameSection>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_WindowFrameSection_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_WindowFrameSection_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_WindowFrameSection,
+ qtscript_Qt_WindowFrameSection_valueOf, qtscript_Qt_WindowFrameSection_toString);
+ qScriptRegisterMetaType<Qt::WindowFrameSection>(engine, qtscript_Qt_WindowFrameSection_toScriptValue,
+ qtscript_Qt_WindowFrameSection_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 10; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_WindowFrameSection_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_WindowFrameSection_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::InputMethodQuery
+//
+
+static const Qt::InputMethodQuery qtscript_Qt_InputMethodQuery_values[] = {
+ Qt::ImMicroFocus
+ , Qt::ImFont
+ , Qt::ImCursorPosition
+ , Qt::ImSurroundingText
+ , Qt::ImCurrentSelection
+};
+
+static const char * const qtscript_Qt_InputMethodQuery_keys[] = {
+ "ImMicroFocus"
+ , "ImFont"
+ , "ImCursorPosition"
+ , "ImSurroundingText"
+ , "ImCurrentSelection"
+};
+
+static QString qtscript_Qt_InputMethodQuery_toStringHelper(Qt::InputMethodQuery value)
+{
+ if ((value >= Qt::ImMicroFocus) && (value <= Qt::ImCurrentSelection))
+ return qtscript_Qt_InputMethodQuery_keys[static_cast<int>(value)-static_cast<int>(Qt::ImMicroFocus)];
+ return QString();
+}
+
+static QScriptValue qtscript_Qt_InputMethodQuery_toScriptValue(QScriptEngine *engine, const Qt::InputMethodQuery &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_InputMethodQuery_toStringHelper(value));
+}
+
+static void qtscript_Qt_InputMethodQuery_fromScriptValue(const QScriptValue &value, Qt::InputMethodQuery &out)
+{
+ out = qvariant_cast<Qt::InputMethodQuery>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_InputMethodQuery(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= Qt::ImMicroFocus) && (arg <= Qt::ImCurrentSelection))
+ return qScriptValueFromValue(engine, static_cast<Qt::InputMethodQuery>(arg));
+ return context->throwError(QString::fromLatin1("InputMethodQuery(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_InputMethodQuery_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::InputMethodQuery value = qscriptvalue_cast<Qt::InputMethodQuery>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_InputMethodQuery_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::InputMethodQuery value = qscriptvalue_cast<Qt::InputMethodQuery>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_InputMethodQuery_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_InputMethodQuery_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_InputMethodQuery,
+ qtscript_Qt_InputMethodQuery_valueOf, qtscript_Qt_InputMethodQuery_toString);
+ qScriptRegisterMetaType<Qt::InputMethodQuery>(engine, qtscript_Qt_InputMethodQuery_toScriptValue,
+ qtscript_Qt_InputMethodQuery_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 5; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_InputMethodQuery_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_InputMethodQuery_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::DropAction
+//
+
+static const Qt::DropAction qtscript_Qt_DropAction_values[] = {
+ Qt::IgnoreAction
+ , Qt::CopyAction
+ , Qt::MoveAction
+ , Qt::LinkAction
+ , Qt::ActionMask
+ , Qt::TargetMoveAction
+};
+
+static const char * const qtscript_Qt_DropAction_keys[] = {
+ "IgnoreAction"
+ , "CopyAction"
+ , "MoveAction"
+ , "LinkAction"
+ , "ActionMask"
+ , "TargetMoveAction"
+};
+
+static QString qtscript_Qt_DropAction_toStringHelper(Qt::DropAction value)
+{
+ for (int i = 0; i < 6; ++i) {
+ if (qtscript_Qt_DropAction_values[i] == value)
+ return QString::fromLatin1(qtscript_Qt_DropAction_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_Qt_DropAction_toScriptValue(QScriptEngine *engine, const Qt::DropAction &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_DropAction_toStringHelper(value));
+}
+
+static void qtscript_Qt_DropAction_fromScriptValue(const QScriptValue &value, Qt::DropAction &out)
+{
+ out = qvariant_cast<Qt::DropAction>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_DropAction(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 6; ++i) {
+ if (qtscript_Qt_DropAction_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<Qt::DropAction>(arg));
+ }
+ return context->throwError(QString::fromLatin1("DropAction(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_DropAction_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::DropAction value = qscriptvalue_cast<Qt::DropAction>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_DropAction_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::DropAction value = qscriptvalue_cast<Qt::DropAction>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_DropAction_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_DropAction_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_DropAction,
+ qtscript_Qt_DropAction_valueOf, qtscript_Qt_DropAction_toString);
+ qScriptRegisterMetaType<Qt::DropAction>(engine, qtscript_Qt_DropAction_toScriptValue,
+ qtscript_Qt_DropAction_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 6; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_DropAction_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_DropAction_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::DropActions
+//
+
+static QScriptValue qtscript_Qt_DropActions_toScriptValue(QScriptEngine *engine, const Qt::DropActions &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_Qt_DropActions_fromScriptValue(const QScriptValue &value, Qt::DropActions &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<Qt::DropActions>())
+ out = qvariant_cast<Qt::DropActions>(var);
+ else if (var.userType() == qMetaTypeId<Qt::DropAction>())
+ out = qvariant_cast<Qt::DropAction>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_Qt_DropActions(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::DropActions result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<Qt::DropActions>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<Qt::DropAction>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("DropActions(): argument %0 is not of type DropAction").arg(i));
+ }
+ result |= qvariant_cast<Qt::DropAction>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_Qt_DropActions_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::DropActions value = qscriptvalue_cast<Qt::DropActions>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_DropActions_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::DropActions value = qscriptvalue_cast<Qt::DropActions>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 6; ++i) {
+ if ((value & qtscript_Qt_DropAction_values[i]) == qtscript_Qt_DropAction_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_Qt_DropAction_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_Qt_DropActions_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<Qt::DropActions>() == otherObj.value<Qt::DropActions>())));
+}
+
+static QScriptValue qtscript_create_Qt_DropActions_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_Qt_DropActions, qtscript_Qt_DropActions_valueOf,
+ qtscript_Qt_DropActions_toString, qtscript_Qt_DropActions_equals);
+ qScriptRegisterMetaType<Qt::DropActions>(engine, qtscript_Qt_DropActions_toScriptValue,
+ qtscript_Qt_DropActions_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// Qt::FillRule
+//
+
+static const Qt::FillRule qtscript_Qt_FillRule_values[] = {
+ Qt::OddEvenFill
+ , Qt::WindingFill
+};
+
+static const char * const qtscript_Qt_FillRule_keys[] = {
+ "OddEvenFill"
+ , "WindingFill"
+};
+
+static QString qtscript_Qt_FillRule_toStringHelper(Qt::FillRule value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("FillRule");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_FillRule_toScriptValue(QScriptEngine *engine, const Qt::FillRule &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_FillRule_toStringHelper(value));
+}
+
+static void qtscript_Qt_FillRule_fromScriptValue(const QScriptValue &value, Qt::FillRule &out)
+{
+ out = qvariant_cast<Qt::FillRule>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_FillRule(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("FillRule");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::FillRule>(arg));
+ return context->throwError(QString::fromLatin1("FillRule(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_FillRule_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::FillRule value = qscriptvalue_cast<Qt::FillRule>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_FillRule_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::FillRule value = qscriptvalue_cast<Qt::FillRule>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_FillRule_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_FillRule_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_FillRule,
+ qtscript_Qt_FillRule_valueOf, qtscript_Qt_FillRule_toString);
+ qScriptRegisterMetaType<Qt::FillRule>(engine, qtscript_Qt_FillRule_toScriptValue,
+ qtscript_Qt_FillRule_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_FillRule_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_FillRule_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::GlobalColor
+//
+
+static const Qt::GlobalColor qtscript_Qt_GlobalColor_values[] = {
+ Qt::color0
+ , Qt::color1
+ , Qt::black
+ , Qt::white
+ , Qt::darkGray
+ , Qt::gray
+ , Qt::lightGray
+ , Qt::red
+ , Qt::green
+ , Qt::blue
+ , Qt::cyan
+ , Qt::magenta
+ , Qt::yellow
+ , Qt::darkRed
+ , Qt::darkGreen
+ , Qt::darkBlue
+ , Qt::darkCyan
+ , Qt::darkMagenta
+ , Qt::darkYellow
+ , Qt::transparent
+};
+
+static const char * const qtscript_Qt_GlobalColor_keys[] = {
+ "color0"
+ , "color1"
+ , "black"
+ , "white"
+ , "darkGray"
+ , "gray"
+ , "lightGray"
+ , "red"
+ , "green"
+ , "blue"
+ , "cyan"
+ , "magenta"
+ , "yellow"
+ , "darkRed"
+ , "darkGreen"
+ , "darkBlue"
+ , "darkCyan"
+ , "darkMagenta"
+ , "darkYellow"
+ , "transparent"
+};
+
+static QString qtscript_Qt_GlobalColor_toStringHelper(Qt::GlobalColor value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("GlobalColor");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_GlobalColor_toScriptValue(QScriptEngine *engine, const Qt::GlobalColor &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_GlobalColor_toStringHelper(value));
+}
+
+static void qtscript_Qt_GlobalColor_fromScriptValue(const QScriptValue &value, Qt::GlobalColor &out)
+{
+ out = qvariant_cast<Qt::GlobalColor>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_GlobalColor(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("GlobalColor");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::GlobalColor>(arg));
+ return context->throwError(QString::fromLatin1("GlobalColor(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_GlobalColor_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::GlobalColor value = qscriptvalue_cast<Qt::GlobalColor>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_GlobalColor_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::GlobalColor value = qscriptvalue_cast<Qt::GlobalColor>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_GlobalColor_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_GlobalColor_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_GlobalColor,
+ qtscript_Qt_GlobalColor_valueOf, qtscript_Qt_GlobalColor_toString);
+ qScriptRegisterMetaType<Qt::GlobalColor>(engine, qtscript_Qt_GlobalColor_toScriptValue,
+ qtscript_Qt_GlobalColor_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 20; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_GlobalColor_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_GlobalColor_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::ConnectionType
+//
+
+static const Qt::ConnectionType qtscript_Qt_ConnectionType_values[] = {
+ Qt::AutoConnection
+ , Qt::DirectConnection
+ , Qt::QueuedConnection
+ , Qt::AutoCompatConnection
+ , Qt::BlockingQueuedConnection
+};
+
+static const char * const qtscript_Qt_ConnectionType_keys[] = {
+ "AutoConnection"
+ , "DirectConnection"
+ , "QueuedConnection"
+ , "AutoCompatConnection"
+ , "BlockingQueuedConnection"
+};
+
+static QString qtscript_Qt_ConnectionType_toStringHelper(Qt::ConnectionType value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("ConnectionType");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_ConnectionType_toScriptValue(QScriptEngine *engine, const Qt::ConnectionType &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_ConnectionType_toStringHelper(value));
+}
+
+static void qtscript_Qt_ConnectionType_fromScriptValue(const QScriptValue &value, Qt::ConnectionType &out)
+{
+ out = qvariant_cast<Qt::ConnectionType>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_ConnectionType(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("ConnectionType");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::ConnectionType>(arg));
+ return context->throwError(QString::fromLatin1("ConnectionType(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_ConnectionType_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ConnectionType value = qscriptvalue_cast<Qt::ConnectionType>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_ConnectionType_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ConnectionType value = qscriptvalue_cast<Qt::ConnectionType>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_ConnectionType_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_ConnectionType_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_ConnectionType,
+ qtscript_Qt_ConnectionType_valueOf, qtscript_Qt_ConnectionType_toString);
+ qScriptRegisterMetaType<Qt::ConnectionType>(engine, qtscript_Qt_ConnectionType_toScriptValue,
+ qtscript_Qt_ConnectionType_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 5; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_ConnectionType_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_ConnectionType_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::PenCapStyle
+//
+
+static const Qt::PenCapStyle qtscript_Qt_PenCapStyle_values[] = {
+ Qt::FlatCap
+ , Qt::SquareCap
+ , Qt::RoundCap
+ , Qt::MPenCapStyle
+};
+
+static const char * const qtscript_Qt_PenCapStyle_keys[] = {
+ "FlatCap"
+ , "SquareCap"
+ , "RoundCap"
+ , "MPenCapStyle"
+};
+
+static QString qtscript_Qt_PenCapStyle_toStringHelper(Qt::PenCapStyle value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("PenCapStyle");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_PenCapStyle_toScriptValue(QScriptEngine *engine, const Qt::PenCapStyle &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_PenCapStyle_toStringHelper(value));
+}
+
+static void qtscript_Qt_PenCapStyle_fromScriptValue(const QScriptValue &value, Qt::PenCapStyle &out)
+{
+ out = qvariant_cast<Qt::PenCapStyle>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_PenCapStyle(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("PenCapStyle");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::PenCapStyle>(arg));
+ return context->throwError(QString::fromLatin1("PenCapStyle(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_PenCapStyle_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::PenCapStyle value = qscriptvalue_cast<Qt::PenCapStyle>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_PenCapStyle_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::PenCapStyle value = qscriptvalue_cast<Qt::PenCapStyle>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_PenCapStyle_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_PenCapStyle_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_PenCapStyle,
+ qtscript_Qt_PenCapStyle_valueOf, qtscript_Qt_PenCapStyle_toString);
+ qScriptRegisterMetaType<Qt::PenCapStyle>(engine, qtscript_Qt_PenCapStyle_toScriptValue,
+ qtscript_Qt_PenCapStyle_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 4; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_PenCapStyle_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_PenCapStyle_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::TransformationMode
+//
+
+static const Qt::TransformationMode qtscript_Qt_TransformationMode_values[] = {
+ Qt::FastTransformation
+ , Qt::SmoothTransformation
+};
+
+static const char * const qtscript_Qt_TransformationMode_keys[] = {
+ "FastTransformation"
+ , "SmoothTransformation"
+};
+
+static QString qtscript_Qt_TransformationMode_toStringHelper(Qt::TransformationMode value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("TransformationMode");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_TransformationMode_toScriptValue(QScriptEngine *engine, const Qt::TransformationMode &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_TransformationMode_toStringHelper(value));
+}
+
+static void qtscript_Qt_TransformationMode_fromScriptValue(const QScriptValue &value, Qt::TransformationMode &out)
+{
+ out = qvariant_cast<Qt::TransformationMode>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_TransformationMode(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("TransformationMode");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::TransformationMode>(arg));
+ return context->throwError(QString::fromLatin1("TransformationMode(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_TransformationMode_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::TransformationMode value = qscriptvalue_cast<Qt::TransformationMode>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_TransformationMode_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::TransformationMode value = qscriptvalue_cast<Qt::TransformationMode>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_TransformationMode_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_TransformationMode_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_TransformationMode,
+ qtscript_Qt_TransformationMode_valueOf, qtscript_Qt_TransformationMode_toString);
+ qScriptRegisterMetaType<Qt::TransformationMode>(engine, qtscript_Qt_TransformationMode_toScriptValue,
+ qtscript_Qt_TransformationMode_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_TransformationMode_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_TransformationMode_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::DockWidgetAreaSizes
+//
+
+static const Qt::DockWidgetAreaSizes qtscript_Qt_DockWidgetAreaSizes_values[] = {
+ Qt::NDockWidgetAreas
+};
+
+static const char * const qtscript_Qt_DockWidgetAreaSizes_keys[] = {
+ "NDockWidgetAreas"
+};
+
+static QString qtscript_Qt_DockWidgetAreaSizes_toStringHelper(Qt::DockWidgetAreaSizes value)
+{
+ if ((value >= Qt::NDockWidgetAreas) && (value <= Qt::NDockWidgetAreas))
+ return qtscript_Qt_DockWidgetAreaSizes_keys[static_cast<int>(value)-static_cast<int>(Qt::NDockWidgetAreas)];
+ return QString();
+}
+
+static QScriptValue qtscript_Qt_DockWidgetAreaSizes_toScriptValue(QScriptEngine *engine, const Qt::DockWidgetAreaSizes &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_DockWidgetAreaSizes_toStringHelper(value));
+}
+
+static void qtscript_Qt_DockWidgetAreaSizes_fromScriptValue(const QScriptValue &value, Qt::DockWidgetAreaSizes &out)
+{
+ out = qvariant_cast<Qt::DockWidgetAreaSizes>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_DockWidgetAreaSizes(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= Qt::NDockWidgetAreas) && (arg <= Qt::NDockWidgetAreas))
+ return qScriptValueFromValue(engine, static_cast<Qt::DockWidgetAreaSizes>(arg));
+ return context->throwError(QString::fromLatin1("DockWidgetAreaSizes(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_DockWidgetAreaSizes_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::DockWidgetAreaSizes value = qscriptvalue_cast<Qt::DockWidgetAreaSizes>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_DockWidgetAreaSizes_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::DockWidgetAreaSizes value = qscriptvalue_cast<Qt::DockWidgetAreaSizes>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_DockWidgetAreaSizes_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_DockWidgetAreaSizes_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_DockWidgetAreaSizes,
+ qtscript_Qt_DockWidgetAreaSizes_valueOf, qtscript_Qt_DockWidgetAreaSizes_toString);
+ qScriptRegisterMetaType<Qt::DockWidgetAreaSizes>(engine, qtscript_Qt_DockWidgetAreaSizes_toScriptValue,
+ qtscript_Qt_DockWidgetAreaSizes_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 1; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_DockWidgetAreaSizes_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_DockWidgetAreaSizes_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::ApplicationAttribute
+//
+
+static const Qt::ApplicationAttribute qtscript_Qt_ApplicationAttribute_values[] = {
+ Qt::AA_ImmediateWidgetCreation
+ , Qt::AA_MSWindowsUseDirect3DByDefault
+ , Qt::AA_DontShowIconsInMenus
+ , Qt::AA_NativeWindows
+ , Qt::AA_DontCreateNativeWidgetSiblings
+ , Qt::AA_MacPluginApplication
+ , Qt::AA_AttributeCount
+};
+
+static const char * const qtscript_Qt_ApplicationAttribute_keys[] = {
+ "AA_ImmediateWidgetCreation"
+ , "AA_MSWindowsUseDirect3DByDefault"
+ , "AA_DontShowIconsInMenus"
+ , "AA_NativeWindows"
+ , "AA_DontCreateNativeWidgetSiblings"
+ , "AA_MacPluginApplication"
+ , "AA_AttributeCount"
+};
+
+static QString qtscript_Qt_ApplicationAttribute_toStringHelper(Qt::ApplicationAttribute value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("ApplicationAttribute");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_ApplicationAttribute_toScriptValue(QScriptEngine *engine, const Qt::ApplicationAttribute &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_ApplicationAttribute_toStringHelper(value));
+}
+
+static void qtscript_Qt_ApplicationAttribute_fromScriptValue(const QScriptValue &value, Qt::ApplicationAttribute &out)
+{
+ out = qvariant_cast<Qt::ApplicationAttribute>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_ApplicationAttribute(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("ApplicationAttribute");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::ApplicationAttribute>(arg));
+ return context->throwError(QString::fromLatin1("ApplicationAttribute(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_ApplicationAttribute_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ApplicationAttribute value = qscriptvalue_cast<Qt::ApplicationAttribute>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_ApplicationAttribute_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ApplicationAttribute value = qscriptvalue_cast<Qt::ApplicationAttribute>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_ApplicationAttribute_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_ApplicationAttribute_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_ApplicationAttribute,
+ qtscript_Qt_ApplicationAttribute_valueOf, qtscript_Qt_ApplicationAttribute_toString);
+ qScriptRegisterMetaType<Qt::ApplicationAttribute>(engine, qtscript_Qt_ApplicationAttribute_toScriptValue,
+ qtscript_Qt_ApplicationAttribute_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 7; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_ApplicationAttribute_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_ApplicationAttribute_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::ShortcutContext
+//
+
+static const Qt::ShortcutContext qtscript_Qt_ShortcutContext_values[] = {
+ Qt::WidgetShortcut
+ , Qt::WindowShortcut
+ , Qt::ApplicationShortcut
+ , Qt::WidgetWithChildrenShortcut
+};
+
+static const char * const qtscript_Qt_ShortcutContext_keys[] = {
+ "WidgetShortcut"
+ , "WindowShortcut"
+ , "ApplicationShortcut"
+ , "WidgetWithChildrenShortcut"
+};
+
+static QString qtscript_Qt_ShortcutContext_toStringHelper(Qt::ShortcutContext value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("ShortcutContext");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_ShortcutContext_toScriptValue(QScriptEngine *engine, const Qt::ShortcutContext &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_ShortcutContext_toStringHelper(value));
+}
+
+static void qtscript_Qt_ShortcutContext_fromScriptValue(const QScriptValue &value, Qt::ShortcutContext &out)
+{
+ out = qvariant_cast<Qt::ShortcutContext>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_ShortcutContext(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("ShortcutContext");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::ShortcutContext>(arg));
+ return context->throwError(QString::fromLatin1("ShortcutContext(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_ShortcutContext_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ShortcutContext value = qscriptvalue_cast<Qt::ShortcutContext>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_ShortcutContext_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ShortcutContext value = qscriptvalue_cast<Qt::ShortcutContext>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_ShortcutContext_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_ShortcutContext_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_ShortcutContext,
+ qtscript_Qt_ShortcutContext_valueOf, qtscript_Qt_ShortcutContext_toString);
+ qScriptRegisterMetaType<Qt::ShortcutContext>(engine, qtscript_Qt_ShortcutContext_toScriptValue,
+ qtscript_Qt_ShortcutContext_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 4; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_ShortcutContext_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_ShortcutContext_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::TextInteractionFlag
+//
+
+static const Qt::TextInteractionFlag qtscript_Qt_TextInteractionFlag_values[] = {
+ Qt::NoTextInteraction
+ , Qt::TextSelectableByMouse
+ , Qt::TextSelectableByKeyboard
+ , Qt::LinksAccessibleByMouse
+ , Qt::LinksAccessibleByKeyboard
+ , Qt::TextBrowserInteraction
+ , Qt::TextEditable
+ , Qt::TextEditorInteraction
+};
+
+static const char * const qtscript_Qt_TextInteractionFlag_keys[] = {
+ "NoTextInteraction"
+ , "TextSelectableByMouse"
+ , "TextSelectableByKeyboard"
+ , "LinksAccessibleByMouse"
+ , "LinksAccessibleByKeyboard"
+ , "TextBrowserInteraction"
+ , "TextEditable"
+ , "TextEditorInteraction"
+};
+
+static QString qtscript_Qt_TextInteractionFlag_toStringHelper(Qt::TextInteractionFlag value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("TextInteractionFlag");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_TextInteractionFlag_toScriptValue(QScriptEngine *engine, const Qt::TextInteractionFlag &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_TextInteractionFlag_toStringHelper(value));
+}
+
+static void qtscript_Qt_TextInteractionFlag_fromScriptValue(const QScriptValue &value, Qt::TextInteractionFlag &out)
+{
+ out = qvariant_cast<Qt::TextInteractionFlag>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_TextInteractionFlag(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("TextInteractionFlag");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::TextInteractionFlag>(arg));
+ return context->throwError(QString::fromLatin1("TextInteractionFlag(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_TextInteractionFlag_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::TextInteractionFlag value = qscriptvalue_cast<Qt::TextInteractionFlag>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_TextInteractionFlag_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::TextInteractionFlag value = qscriptvalue_cast<Qt::TextInteractionFlag>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_TextInteractionFlag_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_TextInteractionFlag_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_TextInteractionFlag,
+ qtscript_Qt_TextInteractionFlag_valueOf, qtscript_Qt_TextInteractionFlag_toString);
+ qScriptRegisterMetaType<Qt::TextInteractionFlag>(engine, qtscript_Qt_TextInteractionFlag_toScriptValue,
+ qtscript_Qt_TextInteractionFlag_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 8; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_TextInteractionFlag_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_TextInteractionFlag_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::TextInteractionFlags
+//
+
+static QScriptValue qtscript_Qt_TextInteractionFlags_toScriptValue(QScriptEngine *engine, const Qt::TextInteractionFlags &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_Qt_TextInteractionFlags_fromScriptValue(const QScriptValue &value, Qt::TextInteractionFlags &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<Qt::TextInteractionFlags>())
+ out = qvariant_cast<Qt::TextInteractionFlags>(var);
+ else if (var.userType() == qMetaTypeId<Qt::TextInteractionFlag>())
+ out = qvariant_cast<Qt::TextInteractionFlag>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_Qt_TextInteractionFlags(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::TextInteractionFlags result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<Qt::TextInteractionFlags>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<Qt::TextInteractionFlag>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("TextInteractionFlags(): argument %0 is not of type TextInteractionFlag").arg(i));
+ }
+ result |= qvariant_cast<Qt::TextInteractionFlag>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_Qt_TextInteractionFlags_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::TextInteractionFlags value = qscriptvalue_cast<Qt::TextInteractionFlags>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_TextInteractionFlags_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::TextInteractionFlags value = qscriptvalue_cast<Qt::TextInteractionFlags>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 8; ++i) {
+ if ((value & qtscript_Qt_TextInteractionFlag_values[i]) == qtscript_Qt_TextInteractionFlag_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_Qt_TextInteractionFlag_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_Qt_TextInteractionFlags_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<Qt::TextInteractionFlags>() == otherObj.value<Qt::TextInteractionFlags>())));
+}
+
+static QScriptValue qtscript_create_Qt_TextInteractionFlags_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_Qt_TextInteractionFlags, qtscript_Qt_TextInteractionFlags_valueOf,
+ qtscript_Qt_TextInteractionFlags_toString, qtscript_Qt_TextInteractionFlags_equals);
+ qScriptRegisterMetaType<Qt::TextInteractionFlags>(engine, qtscript_Qt_TextInteractionFlags_toScriptValue,
+ qtscript_Qt_TextInteractionFlags_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// Qt::CheckState
+//
+
+static const Qt::CheckState qtscript_Qt_CheckState_values[] = {
+ Qt::Unchecked
+ , Qt::PartiallyChecked
+ , Qt::Checked
+};
+
+static const char * const qtscript_Qt_CheckState_keys[] = {
+ "Unchecked"
+ , "PartiallyChecked"
+ , "Checked"
+};
+
+static QString qtscript_Qt_CheckState_toStringHelper(Qt::CheckState value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("CheckState");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_CheckState_toScriptValue(QScriptEngine *engine, const Qt::CheckState &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_CheckState_toStringHelper(value));
+}
+
+static void qtscript_Qt_CheckState_fromScriptValue(const QScriptValue &value, Qt::CheckState &out)
+{
+ out = qvariant_cast<Qt::CheckState>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_CheckState(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("CheckState");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::CheckState>(arg));
+ return context->throwError(QString::fromLatin1("CheckState(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_CheckState_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::CheckState value = qscriptvalue_cast<Qt::CheckState>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_CheckState_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::CheckState value = qscriptvalue_cast<Qt::CheckState>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_CheckState_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_CheckState_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_CheckState,
+ qtscript_Qt_CheckState_valueOf, qtscript_Qt_CheckState_toString);
+ qScriptRegisterMetaType<Qt::CheckState>(engine, qtscript_Qt_CheckState_toScriptValue,
+ qtscript_Qt_CheckState_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_CheckState_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_CheckState_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::DockWidgetArea
+//
+
+static const Qt::DockWidgetArea qtscript_Qt_DockWidgetArea_values[] = {
+ Qt::NoDockWidgetArea
+ , Qt::LeftDockWidgetArea
+ , Qt::RightDockWidgetArea
+ , Qt::TopDockWidgetArea
+ , Qt::BottomDockWidgetArea
+ , Qt::DockWidgetArea_Mask
+};
+
+static const char * const qtscript_Qt_DockWidgetArea_keys[] = {
+ "NoDockWidgetArea"
+ , "LeftDockWidgetArea"
+ , "RightDockWidgetArea"
+ , "TopDockWidgetArea"
+ , "BottomDockWidgetArea"
+ , "DockWidgetArea_Mask"
+};
+
+static QString qtscript_Qt_DockWidgetArea_toStringHelper(Qt::DockWidgetArea value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("DockWidgetArea");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_DockWidgetArea_toScriptValue(QScriptEngine *engine, const Qt::DockWidgetArea &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_DockWidgetArea_toStringHelper(value));
+}
+
+static void qtscript_Qt_DockWidgetArea_fromScriptValue(const QScriptValue &value, Qt::DockWidgetArea &out)
+{
+ out = qvariant_cast<Qt::DockWidgetArea>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_DockWidgetArea(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("DockWidgetArea");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::DockWidgetArea>(arg));
+ return context->throwError(QString::fromLatin1("DockWidgetArea(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_DockWidgetArea_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::DockWidgetArea value = qscriptvalue_cast<Qt::DockWidgetArea>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_DockWidgetArea_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::DockWidgetArea value = qscriptvalue_cast<Qt::DockWidgetArea>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_DockWidgetArea_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_DockWidgetArea_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_DockWidgetArea,
+ qtscript_Qt_DockWidgetArea_valueOf, qtscript_Qt_DockWidgetArea_toString);
+ qScriptRegisterMetaType<Qt::DockWidgetArea>(engine, qtscript_Qt_DockWidgetArea_toScriptValue,
+ qtscript_Qt_DockWidgetArea_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 6; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_DockWidgetArea_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_DockWidgetArea_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::DockWidgetAreas
+//
+
+static QScriptValue qtscript_Qt_DockWidgetAreas_toScriptValue(QScriptEngine *engine, const Qt::DockWidgetAreas &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_Qt_DockWidgetAreas_fromScriptValue(const QScriptValue &value, Qt::DockWidgetAreas &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<Qt::DockWidgetAreas>())
+ out = qvariant_cast<Qt::DockWidgetAreas>(var);
+ else if (var.userType() == qMetaTypeId<Qt::DockWidgetArea>())
+ out = qvariant_cast<Qt::DockWidgetArea>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_Qt_DockWidgetAreas(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::DockWidgetAreas result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<Qt::DockWidgetAreas>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<Qt::DockWidgetArea>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("DockWidgetAreas(): argument %0 is not of type DockWidgetArea").arg(i));
+ }
+ result |= qvariant_cast<Qt::DockWidgetArea>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_Qt_DockWidgetAreas_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::DockWidgetAreas value = qscriptvalue_cast<Qt::DockWidgetAreas>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_DockWidgetAreas_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::DockWidgetAreas value = qscriptvalue_cast<Qt::DockWidgetAreas>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 6; ++i) {
+ if ((value & qtscript_Qt_DockWidgetArea_values[i]) == qtscript_Qt_DockWidgetArea_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_Qt_DockWidgetArea_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_Qt_DockWidgetAreas_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<Qt::DockWidgetAreas>() == otherObj.value<Qt::DockWidgetAreas>())));
+}
+
+static QScriptValue qtscript_create_Qt_DockWidgetAreas_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_Qt_DockWidgetAreas, qtscript_Qt_DockWidgetAreas_valueOf,
+ qtscript_Qt_DockWidgetAreas_toString, qtscript_Qt_DockWidgetAreas_equals);
+ qScriptRegisterMetaType<Qt::DockWidgetAreas>(engine, qtscript_Qt_DockWidgetAreas_toScriptValue,
+ qtscript_Qt_DockWidgetAreas_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// Qt::TimeSpec
+//
+
+static const Qt::TimeSpec qtscript_Qt_TimeSpec_values[] = {
+ Qt::LocalTime
+ , Qt::UTC
+ , Qt::OffsetFromUTC
+};
+
+static const char * const qtscript_Qt_TimeSpec_keys[] = {
+ "LocalTime"
+ , "UTC"
+ , "OffsetFromUTC"
+};
+
+static QString qtscript_Qt_TimeSpec_toStringHelper(Qt::TimeSpec value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("TimeSpec");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_TimeSpec_toScriptValue(QScriptEngine *engine, const Qt::TimeSpec &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_TimeSpec_toStringHelper(value));
+}
+
+static void qtscript_Qt_TimeSpec_fromScriptValue(const QScriptValue &value, Qt::TimeSpec &out)
+{
+ out = qvariant_cast<Qt::TimeSpec>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_TimeSpec(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("TimeSpec");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::TimeSpec>(arg));
+ return context->throwError(QString::fromLatin1("TimeSpec(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_TimeSpec_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::TimeSpec value = qscriptvalue_cast<Qt::TimeSpec>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_TimeSpec_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::TimeSpec value = qscriptvalue_cast<Qt::TimeSpec>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_TimeSpec_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_TimeSpec_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_TimeSpec,
+ qtscript_Qt_TimeSpec_valueOf, qtscript_Qt_TimeSpec_toString);
+ qScriptRegisterMetaType<Qt::TimeSpec>(engine, qtscript_Qt_TimeSpec_toScriptValue,
+ qtscript_Qt_TimeSpec_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_TimeSpec_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_TimeSpec_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::ImageConversionFlag
+//
+
+static const Qt::ImageConversionFlag qtscript_Qt_ImageConversionFlag_values[] = {
+ Qt::AutoColor
+ , Qt::MonoOnly
+ , Qt::ColorMode_Mask
+ , Qt::OrderedAlphaDither
+ , Qt::DiffuseAlphaDither
+ , Qt::AlphaDither_Mask
+ , Qt::OrderedDither
+ , Qt::ThresholdDither
+ , Qt::Dither_Mask
+ , Qt::PreferDither
+ , Qt::AvoidDither
+ , Qt::DitherMode_Mask
+ , Qt::NoOpaqueDetection
+};
+
+static const char * const qtscript_Qt_ImageConversionFlag_keys[] = {
+ "AutoColor"
+ , "MonoOnly"
+ , "ColorMode_Mask"
+ , "OrderedAlphaDither"
+ , "DiffuseAlphaDither"
+ , "AlphaDither_Mask"
+ , "OrderedDither"
+ , "ThresholdDither"
+ , "Dither_Mask"
+ , "PreferDither"
+ , "AvoidDither"
+ , "DitherMode_Mask"
+ , "NoOpaqueDetection"
+};
+
+static QString qtscript_Qt_ImageConversionFlag_toStringHelper(Qt::ImageConversionFlag value)
+{
+ for (int i = 0; i < 13; ++i) {
+ if (qtscript_Qt_ImageConversionFlag_values[i] == value)
+ return QString::fromLatin1(qtscript_Qt_ImageConversionFlag_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_Qt_ImageConversionFlag_toScriptValue(QScriptEngine *engine, const Qt::ImageConversionFlag &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_ImageConversionFlag_toStringHelper(value));
+}
+
+static void qtscript_Qt_ImageConversionFlag_fromScriptValue(const QScriptValue &value, Qt::ImageConversionFlag &out)
+{
+ out = qvariant_cast<Qt::ImageConversionFlag>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_ImageConversionFlag(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 13; ++i) {
+ if (qtscript_Qt_ImageConversionFlag_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<Qt::ImageConversionFlag>(arg));
+ }
+ return context->throwError(QString::fromLatin1("ImageConversionFlag(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_ImageConversionFlag_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ImageConversionFlag value = qscriptvalue_cast<Qt::ImageConversionFlag>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_ImageConversionFlag_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ImageConversionFlag value = qscriptvalue_cast<Qt::ImageConversionFlag>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_ImageConversionFlag_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_ImageConversionFlag_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_ImageConversionFlag,
+ qtscript_Qt_ImageConversionFlag_valueOf, qtscript_Qt_ImageConversionFlag_toString);
+ qScriptRegisterMetaType<Qt::ImageConversionFlag>(engine, qtscript_Qt_ImageConversionFlag_toScriptValue,
+ qtscript_Qt_ImageConversionFlag_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 13; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_ImageConversionFlag_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_ImageConversionFlag_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::ImageConversionFlags
+//
+
+static QScriptValue qtscript_Qt_ImageConversionFlags_toScriptValue(QScriptEngine *engine, const Qt::ImageConversionFlags &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_Qt_ImageConversionFlags_fromScriptValue(const QScriptValue &value, Qt::ImageConversionFlags &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<Qt::ImageConversionFlags>())
+ out = qvariant_cast<Qt::ImageConversionFlags>(var);
+ else if (var.userType() == qMetaTypeId<Qt::ImageConversionFlag>())
+ out = qvariant_cast<Qt::ImageConversionFlag>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_Qt_ImageConversionFlags(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ImageConversionFlags result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<Qt::ImageConversionFlags>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<Qt::ImageConversionFlag>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("ImageConversionFlags(): argument %0 is not of type ImageConversionFlag").arg(i));
+ }
+ result |= qvariant_cast<Qt::ImageConversionFlag>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_Qt_ImageConversionFlags_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ImageConversionFlags value = qscriptvalue_cast<Qt::ImageConversionFlags>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_ImageConversionFlags_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ImageConversionFlags value = qscriptvalue_cast<Qt::ImageConversionFlags>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 13; ++i) {
+ if ((value & qtscript_Qt_ImageConversionFlag_values[i]) == qtscript_Qt_ImageConversionFlag_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_Qt_ImageConversionFlag_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_Qt_ImageConversionFlags_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<Qt::ImageConversionFlags>() == otherObj.value<Qt::ImageConversionFlags>())));
+}
+
+static QScriptValue qtscript_create_Qt_ImageConversionFlags_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_Qt_ImageConversionFlags, qtscript_Qt_ImageConversionFlags_valueOf,
+ qtscript_Qt_ImageConversionFlags_toString, qtscript_Qt_ImageConversionFlags_equals);
+ qScriptRegisterMetaType<Qt::ImageConversionFlags>(engine, qtscript_Qt_ImageConversionFlags_toScriptValue,
+ qtscript_Qt_ImageConversionFlags_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// Qt::WindowModality
+//
+
+static const Qt::WindowModality qtscript_Qt_WindowModality_values[] = {
+ Qt::NonModal
+ , Qt::WindowModal
+ , Qt::ApplicationModal
+};
+
+static const char * const qtscript_Qt_WindowModality_keys[] = {
+ "NonModal"
+ , "WindowModal"
+ , "ApplicationModal"
+};
+
+static QString qtscript_Qt_WindowModality_toStringHelper(Qt::WindowModality value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("WindowModality");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_WindowModality_toScriptValue(QScriptEngine *engine, const Qt::WindowModality &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_WindowModality_toStringHelper(value));
+}
+
+static void qtscript_Qt_WindowModality_fromScriptValue(const QScriptValue &value, Qt::WindowModality &out)
+{
+ out = qvariant_cast<Qt::WindowModality>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_WindowModality(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("WindowModality");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::WindowModality>(arg));
+ return context->throwError(QString::fromLatin1("WindowModality(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_WindowModality_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::WindowModality value = qscriptvalue_cast<Qt::WindowModality>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_WindowModality_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::WindowModality value = qscriptvalue_cast<Qt::WindowModality>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_WindowModality_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_WindowModality_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_WindowModality,
+ qtscript_Qt_WindowModality_valueOf, qtscript_Qt_WindowModality_toString);
+ qScriptRegisterMetaType<Qt::WindowModality>(engine, qtscript_Qt_WindowModality_toScriptValue,
+ qtscript_Qt_WindowModality_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 3; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_WindowModality_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_WindowModality_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::Modifier
+//
+
+static const Qt::Modifier qtscript_Qt_Modifier_values[] = {
+ Qt::MODIFIER_MASK
+ , Qt::UNICODE_ACCEL
+ , Qt::SHIFT
+ , Qt::CTRL
+ , Qt::ALT
+ , Qt::META
+};
+
+static const char * const qtscript_Qt_Modifier_keys[] = {
+ "MODIFIER_MASK"
+ , "UNICODE_ACCEL"
+ , "SHIFT"
+ , "CTRL"
+ , "ALT"
+ , "META"
+};
+
+static QString qtscript_Qt_Modifier_toStringHelper(Qt::Modifier value)
+{
+ for (int i = 0; i < 6; ++i) {
+ if (qtscript_Qt_Modifier_values[i] == value)
+ return QString::fromLatin1(qtscript_Qt_Modifier_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_Qt_Modifier_toScriptValue(QScriptEngine *engine, const Qt::Modifier &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_Modifier_toStringHelper(value));
+}
+
+static void qtscript_Qt_Modifier_fromScriptValue(const QScriptValue &value, Qt::Modifier &out)
+{
+ out = qvariant_cast<Qt::Modifier>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_Modifier(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 6; ++i) {
+ if (qtscript_Qt_Modifier_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<Qt::Modifier>(arg));
+ }
+ return context->throwError(QString::fromLatin1("Modifier(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_Modifier_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::Modifier value = qscriptvalue_cast<Qt::Modifier>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_Modifier_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::Modifier value = qscriptvalue_cast<Qt::Modifier>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_Modifier_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_Modifier_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_Modifier,
+ qtscript_Qt_Modifier_valueOf, qtscript_Qt_Modifier_toString);
+ qScriptRegisterMetaType<Qt::Modifier>(engine, qtscript_Qt_Modifier_toScriptValue,
+ qtscript_Qt_Modifier_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 6; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_Modifier_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_Modifier_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::AlignmentFlag
+//
+
+static const Qt::AlignmentFlag qtscript_Qt_AlignmentFlag_values[] = {
+ Qt::AlignLeft
+ , Qt::AlignRight
+ , Qt::AlignHCenter
+ , Qt::AlignJustify
+ , Qt::AlignAbsolute
+ , Qt::AlignHorizontal_Mask
+ , Qt::AlignTop
+ , Qt::AlignBottom
+ , Qt::AlignVCenter
+ , Qt::AlignCenter
+ , Qt::AlignVertical_Mask
+};
+
+static const char * const qtscript_Qt_AlignmentFlag_keys[] = {
+ "AlignLeft"
+ , "AlignRight"
+ , "AlignHCenter"
+ , "AlignJustify"
+ , "AlignAbsolute"
+ , "AlignHorizontal_Mask"
+ , "AlignTop"
+ , "AlignBottom"
+ , "AlignVCenter"
+ , "AlignCenter"
+ , "AlignVertical_Mask"
+};
+
+static QString qtscript_Qt_AlignmentFlag_toStringHelper(Qt::AlignmentFlag value)
+{
+ for (int i = 0; i < 11; ++i) {
+ if (qtscript_Qt_AlignmentFlag_values[i] == value)
+ return QString::fromLatin1(qtscript_Qt_AlignmentFlag_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_Qt_AlignmentFlag_toScriptValue(QScriptEngine *engine, const Qt::AlignmentFlag &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_AlignmentFlag_toStringHelper(value));
+}
+
+static void qtscript_Qt_AlignmentFlag_fromScriptValue(const QScriptValue &value, Qt::AlignmentFlag &out)
+{
+ out = qvariant_cast<Qt::AlignmentFlag>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_AlignmentFlag(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 11; ++i) {
+ if (qtscript_Qt_AlignmentFlag_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<Qt::AlignmentFlag>(arg));
+ }
+ return context->throwError(QString::fromLatin1("AlignmentFlag(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_AlignmentFlag_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::AlignmentFlag value = qscriptvalue_cast<Qt::AlignmentFlag>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_AlignmentFlag_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::AlignmentFlag value = qscriptvalue_cast<Qt::AlignmentFlag>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_AlignmentFlag_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_AlignmentFlag_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_AlignmentFlag,
+ qtscript_Qt_AlignmentFlag_valueOf, qtscript_Qt_AlignmentFlag_toString);
+ qScriptRegisterMetaType<Qt::AlignmentFlag>(engine, qtscript_Qt_AlignmentFlag_toScriptValue,
+ qtscript_Qt_AlignmentFlag_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 11; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_AlignmentFlag_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_AlignmentFlag_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::Alignment
+//
+
+static QScriptValue qtscript_Qt_Alignment_toScriptValue(QScriptEngine *engine, const Qt::Alignment &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_Qt_Alignment_fromScriptValue(const QScriptValue &value, Qt::Alignment &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<Qt::Alignment>())
+ out = qvariant_cast<Qt::Alignment>(var);
+ else if (var.userType() == qMetaTypeId<Qt::AlignmentFlag>())
+ out = qvariant_cast<Qt::AlignmentFlag>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_Qt_Alignment(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::Alignment result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<Qt::Alignment>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<Qt::AlignmentFlag>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("Alignment(): argument %0 is not of type AlignmentFlag").arg(i));
+ }
+ result |= qvariant_cast<Qt::AlignmentFlag>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_Qt_Alignment_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::Alignment value = qscriptvalue_cast<Qt::Alignment>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_Alignment_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::Alignment value = qscriptvalue_cast<Qt::Alignment>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 11; ++i) {
+ if ((value & qtscript_Qt_AlignmentFlag_values[i]) == qtscript_Qt_AlignmentFlag_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_Qt_AlignmentFlag_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_Qt_Alignment_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<Qt::Alignment>() == otherObj.value<Qt::Alignment>())));
+}
+
+static QScriptValue qtscript_create_Qt_Alignment_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_Qt_Alignment, qtscript_Qt_Alignment_valueOf,
+ qtscript_Qt_Alignment_toString, qtscript_Qt_Alignment_equals);
+ qScriptRegisterMetaType<Qt::Alignment>(engine, qtscript_Qt_Alignment_toScriptValue,
+ qtscript_Qt_Alignment_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// Qt::WidgetAttribute
+//
+
+static const Qt::WidgetAttribute qtscript_Qt_WidgetAttribute_values[] = {
+ Qt::WA_Disabled
+ , Qt::WA_UnderMouse
+ , Qt::WA_MouseTracking
+ , Qt::WA_ContentsPropagated
+ , Qt::WA_OpaquePaintEvent
+ , Qt::WA_StaticContents
+ , Qt::WA_LaidOut
+ , Qt::WA_PaintOnScreen
+ , Qt::WA_NoSystemBackground
+ , Qt::WA_UpdatesDisabled
+ , Qt::WA_Mapped
+ , Qt::WA_MacNoClickThrough
+ , Qt::WA_PaintOutsidePaintEvent
+ , Qt::WA_InputMethodEnabled
+ , Qt::WA_WState_Visible
+ , Qt::WA_WState_Hidden
+ , Qt::WA_ForceDisabled
+ , Qt::WA_KeyCompression
+ , Qt::WA_PendingMoveEvent
+ , Qt::WA_PendingResizeEvent
+ , Qt::WA_SetPalette
+ , Qt::WA_SetFont
+ , Qt::WA_SetCursor
+ , Qt::WA_NoChildEventsFromChildren
+ , Qt::WA_WindowModified
+ , Qt::WA_Resized
+ , Qt::WA_Moved
+ , Qt::WA_PendingUpdate
+ , Qt::WA_InvalidSize
+ , Qt::WA_MacBrushedMetal
+ , Qt::WA_CustomWhatsThis
+ , Qt::WA_LayoutOnEntireRect
+ , Qt::WA_OutsideWSRange
+ , Qt::WA_GrabbedShortcut
+ , Qt::WA_TransparentForMouseEvents
+ , Qt::WA_PaintUnclipped
+ , Qt::WA_SetWindowIcon
+ , Qt::WA_NoMouseReplay
+ , Qt::WA_DeleteOnClose
+ , Qt::WA_RightToLeft
+ , Qt::WA_SetLayoutDirection
+ , Qt::WA_NoChildEventsForParent
+ , Qt::WA_ForceUpdatesDisabled
+ , Qt::WA_WState_Created
+ , Qt::WA_WState_CompressKeys
+ , Qt::WA_WState_InPaintEvent
+ , Qt::WA_WState_Reparented
+ , Qt::WA_WState_ConfigPending
+ , Qt::WA_WState_Polished
+ , Qt::WA_WState_DND
+ , Qt::WA_WState_OwnSizePolicy
+ , Qt::WA_WState_ExplicitShowHide
+ , Qt::WA_ShowModal
+ , Qt::WA_MouseNoMask
+ , Qt::WA_GroupLeader
+ , Qt::WA_NoMousePropagation
+ , Qt::WA_Hover
+ , Qt::WA_InputMethodTransparent
+ , Qt::WA_QuitOnClose
+ , Qt::WA_KeyboardFocusChange
+ , Qt::WA_AcceptDrops
+ , Qt::WA_DropSiteRegistered
+ , Qt::WA_WindowPropagation
+ , Qt::WA_NoX11EventCompression
+ , Qt::WA_TintedBackground
+ , Qt::WA_X11OpenGLOverlay
+ , Qt::WA_AlwaysShowToolTips
+ , Qt::WA_MacOpaqueSizeGrip
+ , Qt::WA_SetStyle
+ , Qt::WA_SetLocale
+ , Qt::WA_MacShowFocusRect
+ , Qt::WA_MacNormalSize
+ , Qt::WA_MacSmallSize
+ , Qt::WA_MacMiniSize
+ , Qt::WA_LayoutUsesWidgetRect
+ , Qt::WA_StyledBackground
+ , Qt::WA_MSWindowsUseDirect3D
+ , Qt::WA_CanHostQMdiSubWindowTitleBar
+ , Qt::WA_MacAlwaysShowToolWindow
+ , Qt::WA_StyleSheet
+ , Qt::WA_ShowWithoutActivating
+ , Qt::WA_X11BypassTransientForHint
+ , Qt::WA_NativeWindow
+ , Qt::WA_DontCreateNativeAncestors
+ , Qt::WA_MacVariableSize
+ , Qt::WA_DontShowOnScreen
+ , Qt::WA_X11NetWmWindowTypeDesktop
+ , Qt::WA_X11NetWmWindowTypeDock
+ , Qt::WA_X11NetWmWindowTypeToolBar
+ , Qt::WA_X11NetWmWindowTypeMenu
+ , Qt::WA_X11NetWmWindowTypeUtility
+ , Qt::WA_X11NetWmWindowTypeSplash
+ , Qt::WA_X11NetWmWindowTypeDialog
+ , Qt::WA_X11NetWmWindowTypeDropDownMenu
+ , Qt::WA_X11NetWmWindowTypePopupMenu
+ , Qt::WA_X11NetWmWindowTypeToolTip
+ , Qt::WA_X11NetWmWindowTypeNotification
+ , Qt::WA_X11NetWmWindowTypeCombo
+ , Qt::WA_X11NetWmWindowTypeDND
+ , Qt::WA_MacFrameworkScaled
+ , Qt::WA_SetWindowModality
+ , Qt::WA_WState_WindowOpacitySet
+ , Qt::WA_TranslucentBackground
+ , Qt::WA_AttributeCount
+};
+
+static const char * const qtscript_Qt_WidgetAttribute_keys[] = {
+ "WA_Disabled"
+ , "WA_UnderMouse"
+ , "WA_MouseTracking"
+ , "WA_ContentsPropagated"
+ , "WA_OpaquePaintEvent"
+ , "WA_StaticContents"
+ , "WA_LaidOut"
+ , "WA_PaintOnScreen"
+ , "WA_NoSystemBackground"
+ , "WA_UpdatesDisabled"
+ , "WA_Mapped"
+ , "WA_MacNoClickThrough"
+ , "WA_PaintOutsidePaintEvent"
+ , "WA_InputMethodEnabled"
+ , "WA_WState_Visible"
+ , "WA_WState_Hidden"
+ , "WA_ForceDisabled"
+ , "WA_KeyCompression"
+ , "WA_PendingMoveEvent"
+ , "WA_PendingResizeEvent"
+ , "WA_SetPalette"
+ , "WA_SetFont"
+ , "WA_SetCursor"
+ , "WA_NoChildEventsFromChildren"
+ , "WA_WindowModified"
+ , "WA_Resized"
+ , "WA_Moved"
+ , "WA_PendingUpdate"
+ , "WA_InvalidSize"
+ , "WA_MacBrushedMetal"
+ , "WA_CustomWhatsThis"
+ , "WA_LayoutOnEntireRect"
+ , "WA_OutsideWSRange"
+ , "WA_GrabbedShortcut"
+ , "WA_TransparentForMouseEvents"
+ , "WA_PaintUnclipped"
+ , "WA_SetWindowIcon"
+ , "WA_NoMouseReplay"
+ , "WA_DeleteOnClose"
+ , "WA_RightToLeft"
+ , "WA_SetLayoutDirection"
+ , "WA_NoChildEventsForParent"
+ , "WA_ForceUpdatesDisabled"
+ , "WA_WState_Created"
+ , "WA_WState_CompressKeys"
+ , "WA_WState_InPaintEvent"
+ , "WA_WState_Reparented"
+ , "WA_WState_ConfigPending"
+ , "WA_WState_Polished"
+ , "WA_WState_DND"
+ , "WA_WState_OwnSizePolicy"
+ , "WA_WState_ExplicitShowHide"
+ , "WA_ShowModal"
+ , "WA_MouseNoMask"
+ , "WA_GroupLeader"
+ , "WA_NoMousePropagation"
+ , "WA_Hover"
+ , "WA_InputMethodTransparent"
+ , "WA_QuitOnClose"
+ , "WA_KeyboardFocusChange"
+ , "WA_AcceptDrops"
+ , "WA_DropSiteRegistered"
+ , "WA_WindowPropagation"
+ , "WA_NoX11EventCompression"
+ , "WA_TintedBackground"
+ , "WA_X11OpenGLOverlay"
+ , "WA_AlwaysShowToolTips"
+ , "WA_MacOpaqueSizeGrip"
+ , "WA_SetStyle"
+ , "WA_SetLocale"
+ , "WA_MacShowFocusRect"
+ , "WA_MacNormalSize"
+ , "WA_MacSmallSize"
+ , "WA_MacMiniSize"
+ , "WA_LayoutUsesWidgetRect"
+ , "WA_StyledBackground"
+ , "WA_MSWindowsUseDirect3D"
+ , "WA_CanHostQMdiSubWindowTitleBar"
+ , "WA_MacAlwaysShowToolWindow"
+ , "WA_StyleSheet"
+ , "WA_ShowWithoutActivating"
+ , "WA_X11BypassTransientForHint"
+ , "WA_NativeWindow"
+ , "WA_DontCreateNativeAncestors"
+ , "WA_MacVariableSize"
+ , "WA_DontShowOnScreen"
+ , "WA_X11NetWmWindowTypeDesktop"
+ , "WA_X11NetWmWindowTypeDock"
+ , "WA_X11NetWmWindowTypeToolBar"
+ , "WA_X11NetWmWindowTypeMenu"
+ , "WA_X11NetWmWindowTypeUtility"
+ , "WA_X11NetWmWindowTypeSplash"
+ , "WA_X11NetWmWindowTypeDialog"
+ , "WA_X11NetWmWindowTypeDropDownMenu"
+ , "WA_X11NetWmWindowTypePopupMenu"
+ , "WA_X11NetWmWindowTypeToolTip"
+ , "WA_X11NetWmWindowTypeNotification"
+ , "WA_X11NetWmWindowTypeCombo"
+ , "WA_X11NetWmWindowTypeDND"
+ , "WA_MacFrameworkScaled"
+ , "WA_SetWindowModality"
+ , "WA_WState_WindowOpacitySet"
+ , "WA_TranslucentBackground"
+ , "WA_AttributeCount"
+};
+
+static QString qtscript_Qt_WidgetAttribute_toStringHelper(Qt::WidgetAttribute value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("WidgetAttribute");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_WidgetAttribute_toScriptValue(QScriptEngine *engine, const Qt::WidgetAttribute &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_WidgetAttribute_toStringHelper(value));
+}
+
+static void qtscript_Qt_WidgetAttribute_fromScriptValue(const QScriptValue &value, Qt::WidgetAttribute &out)
+{
+ out = qvariant_cast<Qt::WidgetAttribute>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_WidgetAttribute(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("WidgetAttribute");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::WidgetAttribute>(arg));
+ return context->throwError(QString::fromLatin1("WidgetAttribute(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_WidgetAttribute_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::WidgetAttribute value = qscriptvalue_cast<Qt::WidgetAttribute>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_WidgetAttribute_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::WidgetAttribute value = qscriptvalue_cast<Qt::WidgetAttribute>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_WidgetAttribute_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_WidgetAttribute_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_WidgetAttribute,
+ qtscript_Qt_WidgetAttribute_valueOf, qtscript_Qt_WidgetAttribute_toString);
+ qScriptRegisterMetaType<Qt::WidgetAttribute>(engine, qtscript_Qt_WidgetAttribute_toScriptValue,
+ qtscript_Qt_WidgetAttribute_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 104; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_WidgetAttribute_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_WidgetAttribute_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::TextFormat
+//
+
+static const Qt::TextFormat qtscript_Qt_TextFormat_values[] = {
+ Qt::PlainText
+ , Qt::RichText
+ , Qt::AutoText
+ , Qt::LogText
+};
+
+static const char * const qtscript_Qt_TextFormat_keys[] = {
+ "PlainText"
+ , "RichText"
+ , "AutoText"
+ , "LogText"
+};
+
+static QString qtscript_Qt_TextFormat_toStringHelper(Qt::TextFormat value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("TextFormat");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_TextFormat_toScriptValue(QScriptEngine *engine, const Qt::TextFormat &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_TextFormat_toStringHelper(value));
+}
+
+static void qtscript_Qt_TextFormat_fromScriptValue(const QScriptValue &value, Qt::TextFormat &out)
+{
+ out = qvariant_cast<Qt::TextFormat>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_TextFormat(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("TextFormat");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::TextFormat>(arg));
+ return context->throwError(QString::fromLatin1("TextFormat(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_TextFormat_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::TextFormat value = qscriptvalue_cast<Qt::TextFormat>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_TextFormat_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::TextFormat value = qscriptvalue_cast<Qt::TextFormat>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_TextFormat_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_TextFormat_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_TextFormat,
+ qtscript_Qt_TextFormat_valueOf, qtscript_Qt_TextFormat_toString);
+ qScriptRegisterMetaType<Qt::TextFormat>(engine, qtscript_Qt_TextFormat_toScriptValue,
+ qtscript_Qt_TextFormat_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 4; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_TextFormat_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_TextFormat_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::MouseButton
+//
+
+static const Qt::MouseButton qtscript_Qt_MouseButton_values[] = {
+ Qt::NoButton
+ , Qt::LeftButton
+ , Qt::RightButton
+ , Qt::MidButton
+ , Qt::XButton1
+ , Qt::XButton2
+ , Qt::MouseButtonMask
+};
+
+static const char * const qtscript_Qt_MouseButton_keys[] = {
+ "NoButton"
+ , "LeftButton"
+ , "RightButton"
+ , "MidButton"
+ , "XButton1"
+ , "XButton2"
+ , "MouseButtonMask"
+};
+
+static QString qtscript_Qt_MouseButton_toStringHelper(Qt::MouseButton value)
+{
+ for (int i = 0; i < 7; ++i) {
+ if (qtscript_Qt_MouseButton_values[i] == value)
+ return QString::fromLatin1(qtscript_Qt_MouseButton_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_Qt_MouseButton_toScriptValue(QScriptEngine *engine, const Qt::MouseButton &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_MouseButton_toStringHelper(value));
+}
+
+static void qtscript_Qt_MouseButton_fromScriptValue(const QScriptValue &value, Qt::MouseButton &out)
+{
+ out = qvariant_cast<Qt::MouseButton>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_MouseButton(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 7; ++i) {
+ if (qtscript_Qt_MouseButton_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<Qt::MouseButton>(arg));
+ }
+ return context->throwError(QString::fromLatin1("MouseButton(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_MouseButton_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::MouseButton value = qscriptvalue_cast<Qt::MouseButton>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_MouseButton_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::MouseButton value = qscriptvalue_cast<Qt::MouseButton>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_MouseButton_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_MouseButton_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_MouseButton,
+ qtscript_Qt_MouseButton_valueOf, qtscript_Qt_MouseButton_toString);
+ qScriptRegisterMetaType<Qt::MouseButton>(engine, qtscript_Qt_MouseButton_toScriptValue,
+ qtscript_Qt_MouseButton_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 7; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_MouseButton_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_MouseButton_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::MouseButtons
+//
+
+static QScriptValue qtscript_Qt_MouseButtons_toScriptValue(QScriptEngine *engine, const Qt::MouseButtons &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_Qt_MouseButtons_fromScriptValue(const QScriptValue &value, Qt::MouseButtons &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<Qt::MouseButtons>())
+ out = qvariant_cast<Qt::MouseButtons>(var);
+ else if (var.userType() == qMetaTypeId<Qt::MouseButton>())
+ out = qvariant_cast<Qt::MouseButton>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_Qt_MouseButtons(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::MouseButtons result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<Qt::MouseButtons>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<Qt::MouseButton>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("MouseButtons(): argument %0 is not of type MouseButton").arg(i));
+ }
+ result |= qvariant_cast<Qt::MouseButton>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_Qt_MouseButtons_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::MouseButtons value = qscriptvalue_cast<Qt::MouseButtons>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_MouseButtons_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::MouseButtons value = qscriptvalue_cast<Qt::MouseButtons>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 7; ++i) {
+ if ((value & qtscript_Qt_MouseButton_values[i]) == qtscript_Qt_MouseButton_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_Qt_MouseButton_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_Qt_MouseButtons_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<Qt::MouseButtons>() == otherObj.value<Qt::MouseButtons>())));
+}
+
+static QScriptValue qtscript_create_Qt_MouseButtons_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_Qt_MouseButtons, qtscript_Qt_MouseButtons_valueOf,
+ qtscript_Qt_MouseButtons_toString, qtscript_Qt_MouseButtons_equals);
+ qScriptRegisterMetaType<Qt::MouseButtons>(engine, qtscript_Qt_MouseButtons_toScriptValue,
+ qtscript_Qt_MouseButtons_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// Qt::WindowState
+//
+
+static const Qt::WindowState qtscript_Qt_WindowState_values[] = {
+ Qt::WindowNoState
+ , Qt::WindowMinimized
+ , Qt::WindowMaximized
+ , Qt::WindowFullScreen
+ , Qt::WindowActive
+};
+
+static const char * const qtscript_Qt_WindowState_keys[] = {
+ "WindowNoState"
+ , "WindowMinimized"
+ , "WindowMaximized"
+ , "WindowFullScreen"
+ , "WindowActive"
+};
+
+static QString qtscript_Qt_WindowState_toStringHelper(Qt::WindowState value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("WindowState");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_WindowState_toScriptValue(QScriptEngine *engine, const Qt::WindowState &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_WindowState_toStringHelper(value));
+}
+
+static void qtscript_Qt_WindowState_fromScriptValue(const QScriptValue &value, Qt::WindowState &out)
+{
+ out = qvariant_cast<Qt::WindowState>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_WindowState(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("WindowState");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::WindowState>(arg));
+ return context->throwError(QString::fromLatin1("WindowState(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_WindowState_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::WindowState value = qscriptvalue_cast<Qt::WindowState>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_WindowState_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::WindowState value = qscriptvalue_cast<Qt::WindowState>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_WindowState_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_WindowState_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_WindowState,
+ qtscript_Qt_WindowState_valueOf, qtscript_Qt_WindowState_toString);
+ qScriptRegisterMetaType<Qt::WindowState>(engine, qtscript_Qt_WindowState_toScriptValue,
+ qtscript_Qt_WindowState_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 5; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_WindowState_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_WindowState_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::WindowStates
+//
+
+static QScriptValue qtscript_Qt_WindowStates_toScriptValue(QScriptEngine *engine, const Qt::WindowStates &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_Qt_WindowStates_fromScriptValue(const QScriptValue &value, Qt::WindowStates &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<Qt::WindowStates>())
+ out = qvariant_cast<Qt::WindowStates>(var);
+ else if (var.userType() == qMetaTypeId<Qt::WindowState>())
+ out = qvariant_cast<Qt::WindowState>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_Qt_WindowStates(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::WindowStates result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<Qt::WindowStates>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<Qt::WindowState>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("WindowStates(): argument %0 is not of type WindowState").arg(i));
+ }
+ result |= qvariant_cast<Qt::WindowState>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_Qt_WindowStates_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::WindowStates value = qscriptvalue_cast<Qt::WindowStates>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_WindowStates_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::WindowStates value = qscriptvalue_cast<Qt::WindowStates>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 5; ++i) {
+ if ((value & qtscript_Qt_WindowState_values[i]) == qtscript_Qt_WindowState_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_Qt_WindowState_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_Qt_WindowStates_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<Qt::WindowStates>() == otherObj.value<Qt::WindowStates>())));
+}
+
+static QScriptValue qtscript_create_Qt_WindowStates_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_Qt_WindowStates, qtscript_Qt_WindowStates_valueOf,
+ qtscript_Qt_WindowStates_toString, qtscript_Qt_WindowStates_equals);
+ qScriptRegisterMetaType<Qt::WindowStates>(engine, qtscript_Qt_WindowStates_toScriptValue,
+ qtscript_Qt_WindowStates_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// Qt::PenStyle
+//
+
+static const Qt::PenStyle qtscript_Qt_PenStyle_values[] = {
+ Qt::NoPen
+ , Qt::SolidLine
+ , Qt::DashLine
+ , Qt::DotLine
+ , Qt::DashDotLine
+ , Qt::DashDotDotLine
+ , Qt::CustomDashLine
+ , Qt::MPenStyle
+};
+
+static const char * const qtscript_Qt_PenStyle_keys[] = {
+ "NoPen"
+ , "SolidLine"
+ , "DashLine"
+ , "DotLine"
+ , "DashDotLine"
+ , "DashDotDotLine"
+ , "CustomDashLine"
+ , "MPenStyle"
+};
+
+static QString qtscript_Qt_PenStyle_toStringHelper(Qt::PenStyle value)
+{
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("PenStyle");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ return QString::fromLatin1(menum.valueToKey(value));
+}
+
+static QScriptValue qtscript_Qt_PenStyle_toScriptValue(QScriptEngine *engine, const Qt::PenStyle &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_PenStyle_toStringHelper(value));
+}
+
+static void qtscript_Qt_PenStyle_fromScriptValue(const QScriptValue &value, Qt::PenStyle &out)
+{
+ out = qvariant_cast<Qt::PenStyle>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_PenStyle(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ const QMetaObject *meta = qtscript_Qt_metaObject();
+ int idx = meta->indexOfEnumerator("PenStyle");
+ Q_ASSERT(idx != -1);
+ QMetaEnum menum = meta->enumerator(idx);
+ if (menum.valueToKey(arg) != 0)
+ return qScriptValueFromValue(engine, static_cast<Qt::PenStyle>(arg));
+ return context->throwError(QString::fromLatin1("PenStyle(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_PenStyle_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::PenStyle value = qscriptvalue_cast<Qt::PenStyle>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_PenStyle_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::PenStyle value = qscriptvalue_cast<Qt::PenStyle>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_PenStyle_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_PenStyle_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_PenStyle,
+ qtscript_Qt_PenStyle_valueOf, qtscript_Qt_PenStyle_toString);
+ qScriptRegisterMetaType<Qt::PenStyle>(engine, qtscript_Qt_PenStyle_toScriptValue,
+ qtscript_Qt_PenStyle_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 8; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_PenStyle_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_PenStyle_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::ItemFlag
+//
+
+static const Qt::ItemFlag qtscript_Qt_ItemFlag_values[] = {
+ Qt::NoItemFlags
+ , Qt::ItemIsSelectable
+ , Qt::ItemIsEditable
+ , Qt::ItemIsDragEnabled
+ , Qt::ItemIsDropEnabled
+ , Qt::ItemIsUserCheckable
+ , Qt::ItemIsEnabled
+ , Qt::ItemIsTristate
+};
+
+static const char * const qtscript_Qt_ItemFlag_keys[] = {
+ "NoItemFlags"
+ , "ItemIsSelectable"
+ , "ItemIsEditable"
+ , "ItemIsDragEnabled"
+ , "ItemIsDropEnabled"
+ , "ItemIsUserCheckable"
+ , "ItemIsEnabled"
+ , "ItemIsTristate"
+};
+
+static QString qtscript_Qt_ItemFlag_toStringHelper(Qt::ItemFlag value)
+{
+ for (int i = 0; i < 8; ++i) {
+ if (qtscript_Qt_ItemFlag_values[i] == value)
+ return QString::fromLatin1(qtscript_Qt_ItemFlag_keys[i]);
+ }
+ return QString();
+}
+
+static QScriptValue qtscript_Qt_ItemFlag_toScriptValue(QScriptEngine *engine, const Qt::ItemFlag &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_ItemFlag_toStringHelper(value));
+}
+
+static void qtscript_Qt_ItemFlag_fromScriptValue(const QScriptValue &value, Qt::ItemFlag &out)
+{
+ out = qvariant_cast<Qt::ItemFlag>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_ItemFlag(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ for (int i = 0; i < 8; ++i) {
+ if (qtscript_Qt_ItemFlag_values[i] == arg)
+ return qScriptValueFromValue(engine, static_cast<Qt::ItemFlag>(arg));
+ }
+ return context->throwError(QString::fromLatin1("ItemFlag(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_ItemFlag_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ItemFlag value = qscriptvalue_cast<Qt::ItemFlag>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_ItemFlag_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ItemFlag value = qscriptvalue_cast<Qt::ItemFlag>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_ItemFlag_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_ItemFlag_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_ItemFlag,
+ qtscript_Qt_ItemFlag_valueOf, qtscript_Qt_ItemFlag_toString);
+ qScriptRegisterMetaType<Qt::ItemFlag>(engine, qtscript_Qt_ItemFlag_toScriptValue,
+ qtscript_Qt_ItemFlag_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 8; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_ItemFlag_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_ItemFlag_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt::ItemFlags
+//
+
+static QScriptValue qtscript_Qt_ItemFlags_toScriptValue(QScriptEngine *engine, const Qt::ItemFlags &value)
+{
+ return engine->newVariant(qVariantFromValue(value));
+}
+
+static void qtscript_Qt_ItemFlags_fromScriptValue(const QScriptValue &value, Qt::ItemFlags &out)
+{
+ QVariant var = value.toVariant();
+ if (var.userType() == qMetaTypeId<Qt::ItemFlags>())
+ out = qvariant_cast<Qt::ItemFlags>(var);
+ else if (var.userType() == qMetaTypeId<Qt::ItemFlag>())
+ out = qvariant_cast<Qt::ItemFlag>(var);
+ else
+ out = 0;
+}
+
+static QScriptValue qtscript_construct_Qt_ItemFlags(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ItemFlags result = 0;
+ if ((context->argumentCount() == 1) && context->argument(0).isNumber()) {
+ result = static_cast<Qt::ItemFlags>(context->argument(0).toInt32());
+ } else {
+ for (int i = 0; i < context->argumentCount(); ++i) {
+ QVariant v = context->argument(i).toVariant();
+ if (v.userType() != qMetaTypeId<Qt::ItemFlag>()) {
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("ItemFlags(): argument %0 is not of type ItemFlag").arg(i));
+ }
+ result |= qvariant_cast<Qt::ItemFlag>(v);
+ }
+ }
+ return engine->newVariant(qVariantFromValue(result));
+}
+
+static QScriptValue qtscript_Qt_ItemFlags_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ItemFlags value = qscriptvalue_cast<Qt::ItemFlags>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_ItemFlags_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::ItemFlags value = qscriptvalue_cast<Qt::ItemFlags>(context->thisObject());
+ QString result;
+ for (int i = 0; i < 8; ++i) {
+ if ((value & qtscript_Qt_ItemFlag_values[i]) == qtscript_Qt_ItemFlag_values[i]) {
+ if (!result.isEmpty())
+ result.append(QString::fromLatin1(","));
+ result.append(QString::fromLatin1(qtscript_Qt_ItemFlag_keys[i]));
+ }
+ }
+ return QScriptValue(engine, result);
+}
+
+static QScriptValue qtscript_Qt_ItemFlags_equals(QScriptContext *context, QScriptEngine *engine)
+{
+ QVariant thisObj = context->thisObject().toVariant();
+ QVariant otherObj = context->argument(0).toVariant();
+ return QScriptValue(engine, ((thisObj.userType() == otherObj.userType()) &&
+ (thisObj.value<Qt::ItemFlags>() == otherObj.value<Qt::ItemFlags>())));
+}
+
+static QScriptValue qtscript_create_Qt_ItemFlags_class(QScriptEngine *engine)
+{
+ QScriptValue ctor = qtscript_create_flags_class_helper(
+ engine, qtscript_construct_Qt_ItemFlags, qtscript_Qt_ItemFlags_valueOf,
+ qtscript_Qt_ItemFlags_toString, qtscript_Qt_ItemFlags_equals);
+ qScriptRegisterMetaType<Qt::ItemFlags>(engine, qtscript_Qt_ItemFlags_toScriptValue,
+ qtscript_Qt_ItemFlags_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ return ctor;
+}
+
+//
+// Qt::HitTestAccuracy
+//
+
+static const Qt::HitTestAccuracy qtscript_Qt_HitTestAccuracy_values[] = {
+ Qt::ExactHit
+ , Qt::FuzzyHit
+};
+
+static const char * const qtscript_Qt_HitTestAccuracy_keys[] = {
+ "ExactHit"
+ , "FuzzyHit"
+};
+
+static QString qtscript_Qt_HitTestAccuracy_toStringHelper(Qt::HitTestAccuracy value)
+{
+ if ((value >= Qt::ExactHit) && (value <= Qt::FuzzyHit))
+ return qtscript_Qt_HitTestAccuracy_keys[static_cast<int>(value)-static_cast<int>(Qt::ExactHit)];
+ return QString();
+}
+
+static QScriptValue qtscript_Qt_HitTestAccuracy_toScriptValue(QScriptEngine *engine, const Qt::HitTestAccuracy &value)
+{
+ QScriptValue clazz = engine->globalObject().property(QString::fromLatin1("Qt"));
+ return clazz.property(qtscript_Qt_HitTestAccuracy_toStringHelper(value));
+}
+
+static void qtscript_Qt_HitTestAccuracy_fromScriptValue(const QScriptValue &value, Qt::HitTestAccuracy &out)
+{
+ out = qvariant_cast<Qt::HitTestAccuracy>(value.toVariant());
+}
+
+static QScriptValue qtscript_construct_Qt_HitTestAccuracy(QScriptContext *context, QScriptEngine *engine)
+{
+ int arg = context->argument(0).toInt32();
+ if ((arg >= Qt::ExactHit) && (arg <= Qt::FuzzyHit))
+ return qScriptValueFromValue(engine, static_cast<Qt::HitTestAccuracy>(arg));
+ return context->throwError(QString::fromLatin1("HitTestAccuracy(): invalid enum value (%0)").arg(arg));
+}
+
+static QScriptValue qtscript_Qt_HitTestAccuracy_valueOf(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::HitTestAccuracy value = qscriptvalue_cast<Qt::HitTestAccuracy>(context->thisObject());
+ return QScriptValue(engine, static_cast<int>(value));
+}
+
+static QScriptValue qtscript_Qt_HitTestAccuracy_toString(QScriptContext *context, QScriptEngine *engine)
+{
+ Qt::HitTestAccuracy value = qscriptvalue_cast<Qt::HitTestAccuracy>(context->thisObject());
+ return QScriptValue(engine, qtscript_Qt_HitTestAccuracy_toStringHelper(value));
+}
+
+static QScriptValue qtscript_create_Qt_HitTestAccuracy_class(QScriptEngine *engine, QScriptValue &clazz)
+{
+ QScriptValue ctor = qtscript_create_enum_class_helper(
+ engine, qtscript_construct_Qt_HitTestAccuracy,
+ qtscript_Qt_HitTestAccuracy_valueOf, qtscript_Qt_HitTestAccuracy_toString);
+ qScriptRegisterMetaType<Qt::HitTestAccuracy>(engine, qtscript_Qt_HitTestAccuracy_toScriptValue,
+ qtscript_Qt_HitTestAccuracy_fromScriptValue, ctor.property(QString::fromLatin1("prototype")));
+ for (int i = 0; i < 2; ++i) {
+ clazz.setProperty(QString::fromLatin1(qtscript_Qt_HitTestAccuracy_keys[i]),
+ engine->newVariant(qVariantFromValue(qtscript_Qt_HitTestAccuracy_values[i])),
+ QScriptValue::ReadOnly | QScriptValue::Undeletable);
+ }
+ return ctor;
+}
+
+//
+// Qt
+//
+
+static QScriptValue qtscript_Qt_static_call(QScriptContext *context, QScriptEngine *)
+{
+ uint _id = context->callee().data().toUInt32();
+ Q_ASSERT((_id & 0xFFFF0000) == 0xBABE0000);
+ _id &= 0x0000FFFF;
+ switch (_id) {
+ case 0:
+ return context->throwError(QScriptContext::TypeError,
+ QString::fromLatin1("Qt cannot be constructed"));
+ break;
+
+ default:
+ Q_ASSERT(false);
+ }
+ return qtscript_Qt_throw_ambiguity_error_helper(context,
+ qtscript_Qt_function_names[_id],
+ qtscript_Qt_function_signatures[_id]);
+}
+
+QScriptValue qtscript_create_Qt_class(QScriptEngine *engine)
+{
+ static const int function_lengths[] = {
+ 0
+ // static
+ // prototype
+ , 0
+ };
+ QScriptValue proto = QScriptValue();
+ QScriptValue ctor = engine->newFunction(qtscript_Qt_static_call, proto, function_lengths[0]);
+ ctor.setData(QScriptValue(engine, uint(0xBABE0000 + 0)));
+
+ ctor.setProperty(QString::fromLatin1("CursorShape"),
+ qtscript_create_Qt_CursorShape_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("Corner"),
+ qtscript_create_Qt_Corner_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("Axis"),
+ qtscript_create_Qt_Axis_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("Orientation"),
+ qtscript_create_Qt_Orientation_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("Orientations"),
+ qtscript_create_Qt_Orientations_class(engine));
+ ctor.setProperty(QString::fromLatin1("LayoutDirection"),
+ qtscript_create_Qt_LayoutDirection_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("BGMode"),
+ qtscript_create_Qt_BGMode_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("AspectRatioMode"),
+ qtscript_create_Qt_AspectRatioMode_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("TextElideMode"),
+ qtscript_create_Qt_TextElideMode_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("SizeMode"),
+ qtscript_create_Qt_SizeMode_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("WindowType"),
+ qtscript_create_Qt_WindowType_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("WindowFlags"),
+ qtscript_create_Qt_WindowFlags_class(engine));
+ ctor.setProperty(QString::fromLatin1("ItemDataRole"),
+ qtscript_create_Qt_ItemDataRole_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("SortOrder"),
+ qtscript_create_Qt_SortOrder_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("MatchFlag"),
+ qtscript_create_Qt_MatchFlag_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("MatchFlags"),
+ qtscript_create_Qt_MatchFlags_class(engine));
+ ctor.setProperty(QString::fromLatin1("PenJoinStyle"),
+ qtscript_create_Qt_PenJoinStyle_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("CaseSensitivity"),
+ qtscript_create_Qt_CaseSensitivity_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("BrushStyle"),
+ qtscript_create_Qt_BrushStyle_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ClipOperation"),
+ qtscript_create_Qt_ClipOperation_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("FocusReason"),
+ qtscript_create_Qt_FocusReason_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ToolBarArea"),
+ qtscript_create_Qt_ToolBarArea_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ToolBarAreas"),
+ qtscript_create_Qt_ToolBarAreas_class(engine));
+ ctor.setProperty(QString::fromLatin1("KeyboardModifier"),
+ qtscript_create_Qt_KeyboardModifier_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("KeyboardModifiers"),
+ qtscript_create_Qt_KeyboardModifiers_class(engine));
+ ctor.setProperty(QString::fromLatin1("WhiteSpaceMode"),
+ qtscript_create_Qt_WhiteSpaceMode_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("DayOfWeek"),
+ qtscript_create_Qt_DayOfWeek_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("EventPriority"),
+ qtscript_create_Qt_EventPriority_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("DateFormat"),
+ qtscript_create_Qt_DateFormat_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("MaskMode"),
+ qtscript_create_Qt_MaskMode_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("UIEffect"),
+ qtscript_create_Qt_UIEffect_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ContextMenuPolicy"),
+ qtscript_create_Qt_ContextMenuPolicy_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("AnchorAttribute"),
+ qtscript_create_Qt_AnchorAttribute_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ScrollBarPolicy"),
+ qtscript_create_Qt_ScrollBarPolicy_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ToolButtonStyle"),
+ qtscript_create_Qt_ToolButtonStyle_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("TextFlag"),
+ qtscript_create_Qt_TextFlag_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ItemSelectionMode"),
+ qtscript_create_Qt_ItemSelectionMode_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("SizeHint"),
+ qtscript_create_Qt_SizeHint_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("Key"),
+ qtscript_create_Qt_Key_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ToolBarAreaSizes"),
+ qtscript_create_Qt_ToolBarAreaSizes_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ArrowType"),
+ qtscript_create_Qt_ArrowType_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("FocusPolicy"),
+ qtscript_create_Qt_FocusPolicy_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("WindowFrameSection"),
+ qtscript_create_Qt_WindowFrameSection_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("InputMethodQuery"),
+ qtscript_create_Qt_InputMethodQuery_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("DropAction"),
+ qtscript_create_Qt_DropAction_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("DropActions"),
+ qtscript_create_Qt_DropActions_class(engine));
+ ctor.setProperty(QString::fromLatin1("FillRule"),
+ qtscript_create_Qt_FillRule_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("GlobalColor"),
+ qtscript_create_Qt_GlobalColor_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ConnectionType"),
+ qtscript_create_Qt_ConnectionType_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("PenCapStyle"),
+ qtscript_create_Qt_PenCapStyle_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("TransformationMode"),
+ qtscript_create_Qt_TransformationMode_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("DockWidgetAreaSizes"),
+ qtscript_create_Qt_DockWidgetAreaSizes_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ApplicationAttribute"),
+ qtscript_create_Qt_ApplicationAttribute_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ShortcutContext"),
+ qtscript_create_Qt_ShortcutContext_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("TextInteractionFlag"),
+ qtscript_create_Qt_TextInteractionFlag_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("TextInteractionFlags"),
+ qtscript_create_Qt_TextInteractionFlags_class(engine));
+ ctor.setProperty(QString::fromLatin1("CheckState"),
+ qtscript_create_Qt_CheckState_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("DockWidgetArea"),
+ qtscript_create_Qt_DockWidgetArea_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("DockWidgetAreas"),
+ qtscript_create_Qt_DockWidgetAreas_class(engine));
+ ctor.setProperty(QString::fromLatin1("TimeSpec"),
+ qtscript_create_Qt_TimeSpec_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ImageConversionFlag"),
+ qtscript_create_Qt_ImageConversionFlag_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ImageConversionFlags"),
+ qtscript_create_Qt_ImageConversionFlags_class(engine));
+ ctor.setProperty(QString::fromLatin1("WindowModality"),
+ qtscript_create_Qt_WindowModality_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("Modifier"),
+ qtscript_create_Qt_Modifier_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("AlignmentFlag"),
+ qtscript_create_Qt_AlignmentFlag_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("Alignment"),
+ qtscript_create_Qt_Alignment_class(engine));
+ ctor.setProperty(QString::fromLatin1("WidgetAttribute"),
+ qtscript_create_Qt_WidgetAttribute_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("TextFormat"),
+ qtscript_create_Qt_TextFormat_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("MouseButton"),
+ qtscript_create_Qt_MouseButton_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("MouseButtons"),
+ qtscript_create_Qt_MouseButtons_class(engine));
+ ctor.setProperty(QString::fromLatin1("WindowState"),
+ qtscript_create_Qt_WindowState_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("WindowStates"),
+ qtscript_create_Qt_WindowStates_class(engine));
+ ctor.setProperty(QString::fromLatin1("PenStyle"),
+ qtscript_create_Qt_PenStyle_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ItemFlag"),
+ qtscript_create_Qt_ItemFlag_class(engine, ctor));
+ ctor.setProperty(QString::fromLatin1("ItemFlags"),
+ qtscript_create_Qt_ItemFlags_class(engine));
+ ctor.setProperty(QString::fromLatin1("HitTestAccuracy"),
+ qtscript_create_Qt_HitTestAccuracy_class(engine, ctor));
+ return ctor;
+}
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractItemModel.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractItemModel.cpp
new file mode 100644
index 0000000..e72484a
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractItemModel.cpp
@@ -0,0 +1,568 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QAbstractItemModel.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qabstractitemmodel.h>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qdatastream.h>
+#include <qlist.h>
+#include <qmimedata.h>
+#include <qobject.h>
+#include <qsize.h>
+#include <qstringlist.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QModelIndex)
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QVariant)
+Q_DECLARE_METATYPE(QMimeData*)
+Q_DECLARE_METATYPE(Qt::DropAction)
+Q_DECLARE_METATYPE(QFlags<Qt::ItemFlag>)
+Q_DECLARE_METATYPE(Qt::Orientation)
+template <> \
+struct QMetaTypeId< QMap<int,QVariant> > \
+{ \
+ enum { Defined = 1 }; \
+ static int qt_metatype_id() \
+ { \
+ static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
+ if (!metatype_id) \
+ metatype_id = qRegisterMetaType< QMap<int,QVariant> >("QMap<int,QVariant>"); \
+ return metatype_id; \
+ } \
+};
+Q_DECLARE_METATYPE(QFlags<Qt::MatchFlag>)
+Q_DECLARE_METATYPE(QList<QModelIndex>)
+Q_DECLARE_METATYPE(Qt::SortOrder)
+Q_DECLARE_METATYPE(QFlags<Qt::DropAction>)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_QAbstractItemModel::QtScriptShell_QAbstractItemModel(QObject* parent)
+ : QAbstractItemModel(parent) {}
+
+QtScriptShell_QAbstractItemModel::~QtScriptShell_QAbstractItemModel() {}
+
+QModelIndex QtScriptShell_QAbstractItemModel::buddy(const QModelIndex& index) const
+{
+ QScriptValue _q_function = __qtscript_self.property("buddy");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("buddy") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::buddy(index);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QModelIndex >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)));
+ }
+}
+
+bool QtScriptShell_QAbstractItemModel::canFetchMore(const QModelIndex& parent) const
+{
+ QScriptValue _q_function = __qtscript_self.property("canFetchMore");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("canFetchMore") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::canFetchMore(parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+void QtScriptShell_QAbstractItemModel::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QAbstractItemModel::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+int QtScriptShell_QAbstractItemModel::columnCount(const QModelIndex& parent) const
+{
+ QScriptValue _q_function = __qtscript_self.property("columnCount");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("columnCount") & QScriptValue::QObjectMember)) {
+ qFatal("QAbstractItemModel::columnCount() is abstract!");
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<int >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+void QtScriptShell_QAbstractItemModel::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QAbstractItemModel::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+QVariant QtScriptShell_QAbstractItemModel::data(const QModelIndex& index, int role) const
+{
+ QScriptValue _q_function = __qtscript_self.property("data");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("data") & QScriptValue::QObjectMember)) {
+ qFatal("QAbstractItemModel::data() is abstract!");
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QVariant >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)
+ << qScriptValueFromValue(_q_engine, role)));
+ }
+}
+
+bool QtScriptShell_QAbstractItemModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent)
+{
+ QScriptValue _q_function = __qtscript_self.property("dropMimeData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("dropMimeData") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::dropMimeData(data, action, row, column, parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, const_cast<QMimeData *>(data))
+ << qScriptValueFromValue(_q_engine, action)
+ << qScriptValueFromValue(_q_engine, row)
+ << qScriptValueFromValue(_q_engine, column)
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+bool QtScriptShell_QAbstractItemModel::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_QAbstractItemModel::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+void QtScriptShell_QAbstractItemModel::fetchMore(const QModelIndex& parent)
+{
+ QScriptValue _q_function = __qtscript_self.property("fetchMore");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("fetchMore") & QScriptValue::QObjectMember)) {
+ QAbstractItemModel::fetchMore(parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, parent));
+ }
+}
+
+Qt::ItemFlags QtScriptShell_QAbstractItemModel::flags(const QModelIndex& index) const
+{
+ QScriptValue _q_function = __qtscript_self.property("flags");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("flags") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::flags(index);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<Qt::ItemFlags >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)));
+ }
+}
+
+bool QtScriptShell_QAbstractItemModel::hasChildren(const QModelIndex& parent) const
+{
+ QScriptValue _q_function = __qtscript_self.property("hasChildren");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("hasChildren") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::hasChildren(parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+QVariant QtScriptShell_QAbstractItemModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ QScriptValue _q_function = __qtscript_self.property("headerData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("headerData") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::headerData(section, orientation, role);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QVariant >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, section)
+ << qScriptValueFromValue(_q_engine, orientation)
+ << qScriptValueFromValue(_q_engine, role)));
+ }
+}
+
+QModelIndex QtScriptShell_QAbstractItemModel::index(int row, int column, const QModelIndex& parent) const
+{
+ QScriptValue _q_function = __qtscript_self.property("index");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("index") & QScriptValue::QObjectMember)) {
+ qFatal("QAbstractItemModel::index() is abstract!");
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QModelIndex >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, row)
+ << qScriptValueFromValue(_q_engine, column)
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+bool QtScriptShell_QAbstractItemModel::insertColumns(int column, int count, const QModelIndex& parent)
+{
+ QScriptValue _q_function = __qtscript_self.property("insertColumns");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("insertColumns") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::insertColumns(column, count, parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, column)
+ << qScriptValueFromValue(_q_engine, count)
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+bool QtScriptShell_QAbstractItemModel::insertRows(int row, int count, const QModelIndex& parent)
+{
+ QScriptValue _q_function = __qtscript_self.property("insertRows");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("insertRows") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::insertRows(row, count, parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, row)
+ << qScriptValueFromValue(_q_engine, count)
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+QMap<int , QVariant > QtScriptShell_QAbstractItemModel::itemData(const QModelIndex& index) const
+{
+ QScriptValue _q_function = __qtscript_self.property("itemData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("itemData") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::itemData(index);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QMap<int , QVariant > >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)));
+ }
+}
+
+QList<QModelIndex > QtScriptShell_QAbstractItemModel::match(const QModelIndex& start, int role, const QVariant& value, int hits, Qt::MatchFlags flags) const
+{
+ QScriptValue _q_function = __qtscript_self.property("match");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("match") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::match(start, role, value, hits, flags);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QList<QModelIndex > >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, start)
+ << qScriptValueFromValue(_q_engine, role)
+ << qScriptValueFromValue(_q_engine, value)
+ << qScriptValueFromValue(_q_engine, hits)
+ << qScriptValueFromValue(_q_engine, flags)));
+ }
+}
+
+QMimeData* QtScriptShell_QAbstractItemModel::mimeData(const QList<QModelIndex >& indexes) const
+{
+ QScriptValue _q_function = __qtscript_self.property("mimeData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("mimeData") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::mimeData(indexes);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QMimeData* >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, indexes)));
+ }
+}
+
+QStringList QtScriptShell_QAbstractItemModel::mimeTypes() const
+{
+ QScriptValue _q_function = __qtscript_self.property("mimeTypes");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("mimeTypes") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::mimeTypes();
+ } else {
+ return qscriptvalue_cast<QStringList >(_q_function.call(__qtscript_self));
+ }
+}
+
+QModelIndex QtScriptShell_QAbstractItemModel::parent(const QModelIndex& child) const
+{
+ QScriptValue _q_function = __qtscript_self.property("parent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("parent") & QScriptValue::QObjectMember)) {
+ qFatal("QAbstractItemModel::parent() is abstract!");
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QModelIndex >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, child)));
+ }
+}
+
+bool QtScriptShell_QAbstractItemModel::removeColumns(int column, int count, const QModelIndex& parent)
+{
+ QScriptValue _q_function = __qtscript_self.property("removeColumns");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("removeColumns") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::removeColumns(column, count, parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, column)
+ << qScriptValueFromValue(_q_engine, count)
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+bool QtScriptShell_QAbstractItemModel::removeRows(int row, int count, const QModelIndex& parent)
+{
+ QScriptValue _q_function = __qtscript_self.property("removeRows");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("removeRows") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::removeRows(row, count, parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, row)
+ << qScriptValueFromValue(_q_engine, count)
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+void QtScriptShell_QAbstractItemModel::revert()
+{
+ QScriptValue _q_function = __qtscript_self.property("revert");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("revert") & QScriptValue::QObjectMember)) {
+ QAbstractItemModel::revert();
+ } else {
+ _q_function.call(__qtscript_self);
+ }
+}
+
+int QtScriptShell_QAbstractItemModel::rowCount(const QModelIndex& parent) const
+{
+ QScriptValue _q_function = __qtscript_self.property("rowCount");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("rowCount") & QScriptValue::QObjectMember)) {
+ qFatal("QAbstractItemModel::rowCount() is abstract!");
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<int >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+bool QtScriptShell_QAbstractItemModel::setData(const QModelIndex& index, const QVariant& value, int role)
+{
+ QScriptValue _q_function = __qtscript_self.property("setData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("setData") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::setData(index, value, role);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)
+ << qScriptValueFromValue(_q_engine, value)
+ << qScriptValueFromValue(_q_engine, role)));
+ }
+}
+
+bool QtScriptShell_QAbstractItemModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant& value, int role)
+{
+ QScriptValue _q_function = __qtscript_self.property("setHeaderData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("setHeaderData") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::setHeaderData(section, orientation, value, role);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, section)
+ << qScriptValueFromValue(_q_engine, orientation)
+ << qScriptValueFromValue(_q_engine, value)
+ << qScriptValueFromValue(_q_engine, role)));
+ }
+}
+
+bool QtScriptShell_QAbstractItemModel::setItemData(const QModelIndex& index, const QMap<int , QVariant >& roles)
+{
+ QScriptValue _q_function = __qtscript_self.property("setItemData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("setItemData") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::setItemData(index, roles);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)
+ << qScriptValueFromValue(_q_engine, roles)));
+ }
+}
+
+void QtScriptShell_QAbstractItemModel::sort(int column, Qt::SortOrder order)
+{
+ QScriptValue _q_function = __qtscript_self.property("sort");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("sort") & QScriptValue::QObjectMember)) {
+ QAbstractItemModel::sort(column, order);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, column)
+ << qScriptValueFromValue(_q_engine, order));
+ }
+}
+
+QSize QtScriptShell_QAbstractItemModel::span(const QModelIndex& index) const
+{
+ QScriptValue _q_function = __qtscript_self.property("span");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("span") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::span(index);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QSize >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)));
+ }
+}
+
+bool QtScriptShell_QAbstractItemModel::submit()
+{
+ QScriptValue _q_function = __qtscript_self.property("submit");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("submit") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::submit();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+Qt::DropActions QtScriptShell_QAbstractItemModel::supportedDropActions() const
+{
+ QScriptValue _q_function = __qtscript_self.property("supportedDropActions");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("supportedDropActions") & QScriptValue::QObjectMember)) {
+ return QAbstractItemModel::supportedDropActions();
+ } else {
+ return qscriptvalue_cast<Qt::DropActions >(_q_function.call(__qtscript_self));
+ }
+}
+
+void QtScriptShell_QAbstractItemModel::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QAbstractItemModel::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractItemModel.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractItemModel.h
new file mode 100644
index 0000000..57f18e9
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractItemModel.h
@@ -0,0 +1,93 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QABSTRACTITEMMODEL_H
+#define QTSCRIPTSHELL_QABSTRACTITEMMODEL_H
+
+#include <qabstractitemmodel.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QAbstractItemModel : public QAbstractItemModel
+{
+public:
+ QtScriptShell_QAbstractItemModel(QObject* parent = 0);
+ ~QtScriptShell_QAbstractItemModel();
+
+ QModelIndex buddy(const QModelIndex& index) const;
+ bool canFetchMore(const QModelIndex& parent) const;
+ void childEvent(QChildEvent* arg__1);
+ int columnCount(const QModelIndex& parent = QModelIndex()) const;
+ void customEvent(QEvent* arg__1);
+ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
+ bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ void fetchMore(const QModelIndex& parent);
+ Qt::ItemFlags flags(const QModelIndex& index) const;
+ bool hasChildren(const QModelIndex& parent = QModelIndex()) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
+ QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const;
+ bool insertColumns(int column, int count, const QModelIndex& parent = QModelIndex());
+ bool insertRows(int row, int count, const QModelIndex& parent = QModelIndex());
+ QMap<int , QVariant > itemData(const QModelIndex& index) const;
+ QList<QModelIndex > match(const QModelIndex& start, int role, const QVariant& value, int hits = 1, Qt::MatchFlags flags = Qt::MatchFlags(Qt::MatchStartsWith|Qt::MatchWrap)) const;
+ QMimeData* mimeData(const QList<QModelIndex >& indexes) const;
+ QStringList mimeTypes() const;
+ QModelIndex parent(const QModelIndex& child) const;
+ bool removeColumns(int column, int count, const QModelIndex& parent = QModelIndex());
+ bool removeRows(int row, int count, const QModelIndex& parent = QModelIndex());
+ void revert();
+ int rowCount(const QModelIndex& parent = QModelIndex()) const;
+ bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
+ bool setHeaderData(int section, Qt::Orientation orientation, const QVariant& value, int role = Qt::EditRole);
+ bool setItemData(const QModelIndex& index, const QMap<int , QVariant >& roles);
+ void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);
+ QSize span(const QModelIndex& index) const;
+ bool submit();
+ Qt::DropActions supportedDropActions() const;
+ void timerEvent(QTimerEvent* arg__1);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QABSTRACTITEMMODEL_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractListModel.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractListModel.cpp
new file mode 100644
index 0000000..278ffc6
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractListModel.cpp
@@ -0,0 +1,528 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QAbstractListModel.h"
+
+#include <QtScript/QScriptEngine>
+#include <QSize>
+#include <QStringList>
+#include <QVariant>
+#include <qabstractitemmodel.h>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qdatastream.h>
+#include <qlist.h>
+#include <qmimedata.h>
+#include <qobject.h>
+#include <qsize.h>
+#include <qstringlist.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QModelIndex)
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QVariant)
+Q_DECLARE_METATYPE(QMimeData*)
+Q_DECLARE_METATYPE(Qt::DropAction)
+Q_DECLARE_METATYPE(QFlags<Qt::ItemFlag>)
+Q_DECLARE_METATYPE(Qt::Orientation)
+template <> \
+struct QMetaTypeId< QMap<int,QVariant> > \
+{ \
+ enum { Defined = 1 }; \
+ static int qt_metatype_id() \
+ { \
+ static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
+ if (!metatype_id) \
+ metatype_id = qRegisterMetaType< QMap<int,QVariant> >("QMap<int,QVariant>"); \
+ return metatype_id; \
+ } \
+};
+Q_DECLARE_METATYPE(QFlags<Qt::MatchFlag>)
+Q_DECLARE_METATYPE(QList<QModelIndex>)
+Q_DECLARE_METATYPE(Qt::SortOrder)
+Q_DECLARE_METATYPE(QFlags<Qt::DropAction>)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_QAbstractListModel::QtScriptShell_QAbstractListModel(QObject* parent)
+ : QAbstractListModel(parent) {}
+
+QtScriptShell_QAbstractListModel::~QtScriptShell_QAbstractListModel() {}
+
+QModelIndex QtScriptShell_QAbstractListModel::buddy(const QModelIndex& index) const
+{
+ QScriptValue _q_function = __qtscript_self.property("buddy");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("buddy") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::buddy(index);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QModelIndex >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)));
+ }
+}
+
+bool QtScriptShell_QAbstractListModel::canFetchMore(const QModelIndex& parent) const
+{
+ QScriptValue _q_function = __qtscript_self.property("canFetchMore");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("canFetchMore") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::canFetchMore(parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+void QtScriptShell_QAbstractListModel::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QAbstractListModel::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_QAbstractListModel::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QAbstractListModel::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+QVariant QtScriptShell_QAbstractListModel::data(const QModelIndex& index, int role) const
+{
+ QScriptValue _q_function = __qtscript_self.property("data");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("data") & QScriptValue::QObjectMember)) {
+ qFatal("QAbstractListModel::data() is abstract!");
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QVariant >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)
+ << qScriptValueFromValue(_q_engine, role)));
+ }
+}
+
+bool QtScriptShell_QAbstractListModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent)
+{
+ QScriptValue _q_function = __qtscript_self.property("dropMimeData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("dropMimeData") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::dropMimeData(data, action, row, column, parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, const_cast<QMimeData *>(data))
+ << qScriptValueFromValue(_q_engine, action)
+ << qScriptValueFromValue(_q_engine, row)
+ << qScriptValueFromValue(_q_engine, column)
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+bool QtScriptShell_QAbstractListModel::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_QAbstractListModel::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+void QtScriptShell_QAbstractListModel::fetchMore(const QModelIndex& parent)
+{
+ QScriptValue _q_function = __qtscript_self.property("fetchMore");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("fetchMore") & QScriptValue::QObjectMember)) {
+ QAbstractListModel::fetchMore(parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, parent));
+ }
+}
+
+Qt::ItemFlags QtScriptShell_QAbstractListModel::flags(const QModelIndex& index) const
+{
+ QScriptValue _q_function = __qtscript_self.property("flags");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("flags") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::flags(index);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<Qt::ItemFlags >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)));
+ }
+}
+
+QVariant QtScriptShell_QAbstractListModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ QScriptValue _q_function = __qtscript_self.property("headerData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("headerData") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::headerData(section, orientation, role);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QVariant >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, section)
+ << qScriptValueFromValue(_q_engine, orientation)
+ << qScriptValueFromValue(_q_engine, role)));
+ }
+}
+
+QModelIndex QtScriptShell_QAbstractListModel::index(int row, int column, const QModelIndex& parent) const
+{
+ QScriptValue _q_function = __qtscript_self.property("index");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("index") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::index(row, column, parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QModelIndex >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, row)
+ << qScriptValueFromValue(_q_engine, column)
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+bool QtScriptShell_QAbstractListModel::insertColumns(int column, int count, const QModelIndex& parent)
+{
+ QScriptValue _q_function = __qtscript_self.property("insertColumns");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("insertColumns") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::insertColumns(column, count, parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, column)
+ << qScriptValueFromValue(_q_engine, count)
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+bool QtScriptShell_QAbstractListModel::insertRows(int row, int count, const QModelIndex& parent)
+{
+ QScriptValue _q_function = __qtscript_self.property("insertRows");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("insertRows") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::insertRows(row, count, parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, row)
+ << qScriptValueFromValue(_q_engine, count)
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+QMap<int , QVariant > QtScriptShell_QAbstractListModel::itemData(const QModelIndex& index) const
+{
+ QScriptValue _q_function = __qtscript_self.property("itemData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("itemData") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::itemData(index);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QMap<int , QVariant > >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)));
+ }
+}
+
+QList<QModelIndex > QtScriptShell_QAbstractListModel::match(const QModelIndex& start, int role, const QVariant& value, int hits, Qt::MatchFlags flags) const
+{
+ QScriptValue _q_function = __qtscript_self.property("match");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("match") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::match(start, role, value, hits, flags);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QList<QModelIndex > >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, start)
+ << qScriptValueFromValue(_q_engine, role)
+ << qScriptValueFromValue(_q_engine, value)
+ << qScriptValueFromValue(_q_engine, hits)
+ << qScriptValueFromValue(_q_engine, flags)));
+ }
+}
+
+QMimeData* QtScriptShell_QAbstractListModel::mimeData(const QList<QModelIndex >& indexes) const
+{
+ QScriptValue _q_function = __qtscript_self.property("mimeData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("mimeData") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::mimeData(indexes);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QMimeData* >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, indexes)));
+ }
+}
+
+QStringList QtScriptShell_QAbstractListModel::mimeTypes() const
+{
+ QScriptValue _q_function = __qtscript_self.property("mimeTypes");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("mimeTypes") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::mimeTypes();
+ } else {
+ return qscriptvalue_cast<QStringList >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_QAbstractListModel::removeColumns(int column, int count, const QModelIndex& parent)
+{
+ QScriptValue _q_function = __qtscript_self.property("removeColumns");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("removeColumns") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::removeColumns(column, count, parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, column)
+ << qScriptValueFromValue(_q_engine, count)
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+bool QtScriptShell_QAbstractListModel::removeRows(int row, int count, const QModelIndex& parent)
+{
+ QScriptValue _q_function = __qtscript_self.property("removeRows");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("removeRows") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::removeRows(row, count, parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, row)
+ << qScriptValueFromValue(_q_engine, count)
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+void QtScriptShell_QAbstractListModel::revert()
+{
+ QScriptValue _q_function = __qtscript_self.property("revert");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("revert") & QScriptValue::QObjectMember)) {
+ QAbstractListModel::revert();
+ } else {
+ _q_function.call(__qtscript_self);
+ }
+}
+
+int QtScriptShell_QAbstractListModel::rowCount(const QModelIndex& parent) const
+{
+ QScriptValue _q_function = __qtscript_self.property("rowCount");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("rowCount") & QScriptValue::QObjectMember)) {
+ qFatal("QAbstractListModel::rowCount() is abstract!");
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<int >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+bool QtScriptShell_QAbstractListModel::setData(const QModelIndex& index, const QVariant& value, int role)
+{
+ QScriptValue _q_function = __qtscript_self.property("setData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("setData") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::setData(index, value, role);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)
+ << qScriptValueFromValue(_q_engine, value)
+ << qScriptValueFromValue(_q_engine, role)));
+ }
+}
+
+bool QtScriptShell_QAbstractListModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant& value, int role)
+{
+ QScriptValue _q_function = __qtscript_self.property("setHeaderData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("setHeaderData") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::setHeaderData(section, orientation, value, role);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, section)
+ << qScriptValueFromValue(_q_engine, orientation)
+ << qScriptValueFromValue(_q_engine, value)
+ << qScriptValueFromValue(_q_engine, role)));
+ }
+}
+
+bool QtScriptShell_QAbstractListModel::setItemData(const QModelIndex& index, const QMap<int , QVariant >& roles)
+{
+ QScriptValue _q_function = __qtscript_self.property("setItemData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("setItemData") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::setItemData(index, roles);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)
+ << qScriptValueFromValue(_q_engine, roles)));
+ }
+}
+
+void QtScriptShell_QAbstractListModel::sort(int column, Qt::SortOrder order)
+{
+ QScriptValue _q_function = __qtscript_self.property("sort");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("sort") & QScriptValue::QObjectMember)) {
+ QAbstractListModel::sort(column, order);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, column)
+ << qScriptValueFromValue(_q_engine, order));
+ }
+}
+
+QSize QtScriptShell_QAbstractListModel::span(const QModelIndex& index) const
+{
+ QScriptValue _q_function = __qtscript_self.property("span");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("span") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::span(index);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QSize >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)));
+ }
+}
+
+bool QtScriptShell_QAbstractListModel::submit()
+{
+ QScriptValue _q_function = __qtscript_self.property("submit");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("submit") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::submit();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+Qt::DropActions QtScriptShell_QAbstractListModel::supportedDropActions() const
+{
+ QScriptValue _q_function = __qtscript_self.property("supportedDropActions");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("supportedDropActions") & QScriptValue::QObjectMember)) {
+ return QAbstractListModel::supportedDropActions();
+ } else {
+ return qscriptvalue_cast<Qt::DropActions >(_q_function.call(__qtscript_self));
+ }
+}
+
+void QtScriptShell_QAbstractListModel::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QAbstractListModel::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractListModel.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractListModel.h
new file mode 100644
index 0000000..339bded
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractListModel.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QABSTRACTLISTMODEL_H
+#define QTSCRIPTSHELL_QABSTRACTLISTMODEL_H
+
+#include <qabstractitemmodel.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QAbstractListModel : public QAbstractListModel
+{
+public:
+ QtScriptShell_QAbstractListModel(QObject* parent = 0);
+ ~QtScriptShell_QAbstractListModel();
+
+ QModelIndex buddy(const QModelIndex& index) const;
+ bool canFetchMore(const QModelIndex& parent) const;
+ void childEvent(QChildEvent* arg__1);
+ void customEvent(QEvent* arg__1);
+ QVariant data(const QModelIndex& index, int role) const;
+ bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ void fetchMore(const QModelIndex& parent);
+ Qt::ItemFlags flags(const QModelIndex& index) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+ QModelIndex index(int row, int column = 0, const QModelIndex& parent = QModelIndex()) const;
+ bool insertColumns(int column, int count, const QModelIndex& parent);
+ bool insertRows(int row, int count, const QModelIndex& parent);
+ QMap<int , QVariant > itemData(const QModelIndex& index) const;
+ QList<QModelIndex > match(const QModelIndex& start, int role, const QVariant& value, int hits, Qt::MatchFlags flags) const;
+ QMimeData* mimeData(const QList<QModelIndex >& indexes) const;
+ QStringList mimeTypes() const;
+ bool removeColumns(int column, int count, const QModelIndex& parent);
+ bool removeRows(int row, int count, const QModelIndex& parent);
+ void revert();
+ int rowCount(const QModelIndex& parent) const;
+ bool setData(const QModelIndex& index, const QVariant& value, int role);
+ bool setHeaderData(int section, Qt::Orientation orientation, const QVariant& value, int role);
+ bool setItemData(const QModelIndex& index, const QMap<int , QVariant >& roles);
+ void sort(int column, Qt::SortOrder order);
+ QSize span(const QModelIndex& index) const;
+ bool submit();
+ Qt::DropActions supportedDropActions() const;
+ void timerEvent(QTimerEvent* arg__1);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QABSTRACTLISTMODEL_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractTableModel.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractTableModel.cpp
new file mode 100644
index 0000000..2703e12
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractTableModel.cpp
@@ -0,0 +1,542 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QAbstractTableModel.h"
+
+#include <QtScript/QScriptEngine>
+#include <QSize>
+#include <QStringList>
+#include <QVariant>
+#include <qabstractitemmodel.h>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qdatastream.h>
+#include <qlist.h>
+#include <qmimedata.h>
+#include <qobject.h>
+#include <qsize.h>
+#include <qstringlist.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QModelIndex)
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QVariant)
+Q_DECLARE_METATYPE(QMimeData*)
+Q_DECLARE_METATYPE(Qt::DropAction)
+Q_DECLARE_METATYPE(QFlags<Qt::ItemFlag>)
+Q_DECLARE_METATYPE(Qt::Orientation)
+template <> \
+struct QMetaTypeId< QMap<int,QVariant> > \
+{ \
+ enum { Defined = 1 }; \
+ static int qt_metatype_id() \
+ { \
+ static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
+ if (!metatype_id) \
+ metatype_id = qRegisterMetaType< QMap<int,QVariant> >("QMap<int,QVariant>"); \
+ return metatype_id; \
+ } \
+};
+Q_DECLARE_METATYPE(QFlags<Qt::MatchFlag>)
+Q_DECLARE_METATYPE(QList<QModelIndex>)
+Q_DECLARE_METATYPE(Qt::SortOrder)
+Q_DECLARE_METATYPE(QFlags<Qt::DropAction>)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_QAbstractTableModel::QtScriptShell_QAbstractTableModel(QObject* parent)
+ : QAbstractTableModel(parent) {}
+
+QtScriptShell_QAbstractTableModel::~QtScriptShell_QAbstractTableModel() {}
+
+QModelIndex QtScriptShell_QAbstractTableModel::buddy(const QModelIndex& index) const
+{
+ QScriptValue _q_function = __qtscript_self.property("buddy");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("buddy") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::buddy(index);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QModelIndex >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)));
+ }
+}
+
+bool QtScriptShell_QAbstractTableModel::canFetchMore(const QModelIndex& parent) const
+{
+ QScriptValue _q_function = __qtscript_self.property("canFetchMore");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("canFetchMore") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::canFetchMore(parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+void QtScriptShell_QAbstractTableModel::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QAbstractTableModel::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+int QtScriptShell_QAbstractTableModel::columnCount(const QModelIndex& parent) const
+{
+ QScriptValue _q_function = __qtscript_self.property("columnCount");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("columnCount") & QScriptValue::QObjectMember)) {
+ qFatal("QAbstractTableModel::columnCount() is abstract!");
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<int >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+void QtScriptShell_QAbstractTableModel::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QAbstractTableModel::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+QVariant QtScriptShell_QAbstractTableModel::data(const QModelIndex& index, int role) const
+{
+ QScriptValue _q_function = __qtscript_self.property("data");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("data") & QScriptValue::QObjectMember)) {
+ qFatal("QAbstractTableModel::data() is abstract!");
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QVariant >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)
+ << qScriptValueFromValue(_q_engine, role)));
+ }
+}
+
+bool QtScriptShell_QAbstractTableModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent)
+{
+ QScriptValue _q_function = __qtscript_self.property("dropMimeData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("dropMimeData") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::dropMimeData(data, action, row, column, parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, const_cast<QMimeData *>(data))
+ << qScriptValueFromValue(_q_engine, action)
+ << qScriptValueFromValue(_q_engine, row)
+ << qScriptValueFromValue(_q_engine, column)
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+bool QtScriptShell_QAbstractTableModel::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_QAbstractTableModel::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+void QtScriptShell_QAbstractTableModel::fetchMore(const QModelIndex& parent)
+{
+ QScriptValue _q_function = __qtscript_self.property("fetchMore");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("fetchMore") & QScriptValue::QObjectMember)) {
+ QAbstractTableModel::fetchMore(parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, parent));
+ }
+}
+
+Qt::ItemFlags QtScriptShell_QAbstractTableModel::flags(const QModelIndex& index) const
+{
+ QScriptValue _q_function = __qtscript_self.property("flags");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("flags") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::flags(index);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<Qt::ItemFlags >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)));
+ }
+}
+
+QVariant QtScriptShell_QAbstractTableModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ QScriptValue _q_function = __qtscript_self.property("headerData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("headerData") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::headerData(section, orientation, role);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QVariant >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, section)
+ << qScriptValueFromValue(_q_engine, orientation)
+ << qScriptValueFromValue(_q_engine, role)));
+ }
+}
+
+QModelIndex QtScriptShell_QAbstractTableModel::index(int row, int column, const QModelIndex& parent) const
+{
+ QScriptValue _q_function = __qtscript_self.property("index");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("index") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::index(row, column, parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QModelIndex >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, row)
+ << qScriptValueFromValue(_q_engine, column)
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+bool QtScriptShell_QAbstractTableModel::insertColumns(int column, int count, const QModelIndex& parent)
+{
+ QScriptValue _q_function = __qtscript_self.property("insertColumns");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("insertColumns") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::insertColumns(column, count, parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, column)
+ << qScriptValueFromValue(_q_engine, count)
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+bool QtScriptShell_QAbstractTableModel::insertRows(int row, int count, const QModelIndex& parent)
+{
+ QScriptValue _q_function = __qtscript_self.property("insertRows");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("insertRows") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::insertRows(row, count, parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, row)
+ << qScriptValueFromValue(_q_engine, count)
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+QMap<int , QVariant > QtScriptShell_QAbstractTableModel::itemData(const QModelIndex& index) const
+{
+ QScriptValue _q_function = __qtscript_self.property("itemData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("itemData") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::itemData(index);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QMap<int , QVariant > >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)));
+ }
+}
+
+QList<QModelIndex > QtScriptShell_QAbstractTableModel::match(const QModelIndex& start, int role, const QVariant& value, int hits, Qt::MatchFlags flags) const
+{
+ QScriptValue _q_function = __qtscript_self.property("match");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("match") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::match(start, role, value, hits, flags);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QList<QModelIndex > >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, start)
+ << qScriptValueFromValue(_q_engine, role)
+ << qScriptValueFromValue(_q_engine, value)
+ << qScriptValueFromValue(_q_engine, hits)
+ << qScriptValueFromValue(_q_engine, flags)));
+ }
+}
+
+QMimeData* QtScriptShell_QAbstractTableModel::mimeData(const QList<QModelIndex >& indexes) const
+{
+ QScriptValue _q_function = __qtscript_self.property("mimeData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("mimeData") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::mimeData(indexes);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QMimeData* >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, indexes)));
+ }
+}
+
+QStringList QtScriptShell_QAbstractTableModel::mimeTypes() const
+{
+ QScriptValue _q_function = __qtscript_self.property("mimeTypes");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("mimeTypes") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::mimeTypes();
+ } else {
+ return qscriptvalue_cast<QStringList >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_QAbstractTableModel::removeColumns(int column, int count, const QModelIndex& parent)
+{
+ QScriptValue _q_function = __qtscript_self.property("removeColumns");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("removeColumns") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::removeColumns(column, count, parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, column)
+ << qScriptValueFromValue(_q_engine, count)
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+bool QtScriptShell_QAbstractTableModel::removeRows(int row, int count, const QModelIndex& parent)
+{
+ QScriptValue _q_function = __qtscript_self.property("removeRows");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("removeRows") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::removeRows(row, count, parent);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, row)
+ << qScriptValueFromValue(_q_engine, count)
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+void QtScriptShell_QAbstractTableModel::revert()
+{
+ QScriptValue _q_function = __qtscript_self.property("revert");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("revert") & QScriptValue::QObjectMember)) {
+ QAbstractTableModel::revert();
+ } else {
+ _q_function.call(__qtscript_self);
+ }
+}
+
+int QtScriptShell_QAbstractTableModel::rowCount(const QModelIndex& parent) const
+{
+ QScriptValue _q_function = __qtscript_self.property("rowCount");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("rowCount") & QScriptValue::QObjectMember)) {
+ qFatal("QAbstractTableModel::rowCount() is abstract!");
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<int >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, parent)));
+ }
+}
+
+bool QtScriptShell_QAbstractTableModel::setData(const QModelIndex& index, const QVariant& value, int role)
+{
+ QScriptValue _q_function = __qtscript_self.property("setData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("setData") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::setData(index, value, role);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)
+ << qScriptValueFromValue(_q_engine, value)
+ << qScriptValueFromValue(_q_engine, role)));
+ }
+}
+
+bool QtScriptShell_QAbstractTableModel::setHeaderData(int section, Qt::Orientation orientation, const QVariant& value, int role)
+{
+ QScriptValue _q_function = __qtscript_self.property("setHeaderData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("setHeaderData") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::setHeaderData(section, orientation, value, role);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, section)
+ << qScriptValueFromValue(_q_engine, orientation)
+ << qScriptValueFromValue(_q_engine, value)
+ << qScriptValueFromValue(_q_engine, role)));
+ }
+}
+
+bool QtScriptShell_QAbstractTableModel::setItemData(const QModelIndex& index, const QMap<int , QVariant >& roles)
+{
+ QScriptValue _q_function = __qtscript_self.property("setItemData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("setItemData") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::setItemData(index, roles);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)
+ << qScriptValueFromValue(_q_engine, roles)));
+ }
+}
+
+void QtScriptShell_QAbstractTableModel::sort(int column, Qt::SortOrder order)
+{
+ QScriptValue _q_function = __qtscript_self.property("sort");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("sort") & QScriptValue::QObjectMember)) {
+ QAbstractTableModel::sort(column, order);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, column)
+ << qScriptValueFromValue(_q_engine, order));
+ }
+}
+
+QSize QtScriptShell_QAbstractTableModel::span(const QModelIndex& index) const
+{
+ QScriptValue _q_function = __qtscript_self.property("span");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("span") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::span(index);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QSize >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, index)));
+ }
+}
+
+bool QtScriptShell_QAbstractTableModel::submit()
+{
+ QScriptValue _q_function = __qtscript_self.property("submit");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("submit") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::submit();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+Qt::DropActions QtScriptShell_QAbstractTableModel::supportedDropActions() const
+{
+ QScriptValue _q_function = __qtscript_self.property("supportedDropActions");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("supportedDropActions") & QScriptValue::QObjectMember)) {
+ return QAbstractTableModel::supportedDropActions();
+ } else {
+ return qscriptvalue_cast<Qt::DropActions >(_q_function.call(__qtscript_self));
+ }
+}
+
+void QtScriptShell_QAbstractTableModel::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QAbstractTableModel::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractTableModel.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractTableModel.h
new file mode 100644
index 0000000..2755705
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QAbstractTableModel.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QABSTRACTTABLEMODEL_H
+#define QTSCRIPTSHELL_QABSTRACTTABLEMODEL_H
+
+#include <qabstractitemmodel.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QAbstractTableModel : public QAbstractTableModel
+{
+public:
+ QtScriptShell_QAbstractTableModel(QObject* parent = 0);
+ ~QtScriptShell_QAbstractTableModel();
+
+ QModelIndex buddy(const QModelIndex& index) const;
+ bool canFetchMore(const QModelIndex& parent) const;
+ void childEvent(QChildEvent* arg__1);
+ int columnCount(const QModelIndex& parent) const;
+ void customEvent(QEvent* arg__1);
+ QVariant data(const QModelIndex& index, int role) const;
+ bool dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ void fetchMore(const QModelIndex& parent);
+ Qt::ItemFlags flags(const QModelIndex& index) const;
+ QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+ QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const;
+ bool insertColumns(int column, int count, const QModelIndex& parent);
+ bool insertRows(int row, int count, const QModelIndex& parent);
+ QMap<int , QVariant > itemData(const QModelIndex& index) const;
+ QList<QModelIndex > match(const QModelIndex& start, int role, const QVariant& value, int hits, Qt::MatchFlags flags) const;
+ QMimeData* mimeData(const QList<QModelIndex >& indexes) const;
+ QStringList mimeTypes() const;
+ bool removeColumns(int column, int count, const QModelIndex& parent);
+ bool removeRows(int row, int count, const QModelIndex& parent);
+ void revert();
+ int rowCount(const QModelIndex& parent) const;
+ bool setData(const QModelIndex& index, const QVariant& value, int role);
+ bool setHeaderData(int section, Qt::Orientation orientation, const QVariant& value, int role);
+ bool setItemData(const QModelIndex& index, const QMap<int , QVariant >& roles);
+ void sort(int column, Qt::SortOrder order);
+ QSize span(const QModelIndex& index) const;
+ bool submit();
+ Qt::DropActions supportedDropActions() const;
+ void timerEvent(QTimerEvent* arg__1);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QABSTRACTTABLEMODEL_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QBuffer.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QBuffer.cpp
new file mode 100644
index 0000000..e542a05
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QBuffer.cpp
@@ -0,0 +1,339 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QBuffer.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qbuffer.h>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QFlags<QIODevice::OpenModeFlag>)
+Q_DECLARE_METATYPE(char*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_QBuffer::QtScriptShell_QBuffer(QByteArray* buf, QObject* parent)
+ : QBuffer(buf, parent) {}
+
+QtScriptShell_QBuffer::QtScriptShell_QBuffer(QObject* parent)
+ : QBuffer(parent) {}
+
+QtScriptShell_QBuffer::~QtScriptShell_QBuffer() {}
+
+bool QtScriptShell_QBuffer::atEnd() const
+{
+ QScriptValue _q_function = __qtscript_self.property("atEnd");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("atEnd") & QScriptValue::QObjectMember)) {
+ return QBuffer::atEnd();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+qint64 QtScriptShell_QBuffer::bytesAvailable() const
+{
+ QScriptValue _q_function = __qtscript_self.property("bytesAvailable");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("bytesAvailable") & QScriptValue::QObjectMember)) {
+ return QBuffer::bytesAvailable();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+qint64 QtScriptShell_QBuffer::bytesToWrite() const
+{
+ QScriptValue _q_function = __qtscript_self.property("bytesToWrite");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("bytesToWrite") & QScriptValue::QObjectMember)) {
+ return QBuffer::bytesToWrite();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_QBuffer::canReadLine() const
+{
+ QScriptValue _q_function = __qtscript_self.property("canReadLine");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("canReadLine") & QScriptValue::QObjectMember)) {
+ return QBuffer::canReadLine();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+void QtScriptShell_QBuffer::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QBuffer::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_QBuffer::close()
+{
+ QScriptValue _q_function = __qtscript_self.property("close");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("close") & QScriptValue::QObjectMember)) {
+ QBuffer::close();
+ } else {
+ _q_function.call(__qtscript_self);
+ }
+}
+
+void QtScriptShell_QBuffer::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QBuffer::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QBuffer::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QBuffer::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_QBuffer::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QBuffer::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+bool QtScriptShell_QBuffer::isSequential() const
+{
+ QScriptValue _q_function = __qtscript_self.property("isSequential");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("isSequential") & QScriptValue::QObjectMember)) {
+ return QBuffer::isSequential();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_QBuffer::open(QIODevice::OpenMode openMode)
+{
+ QScriptValue _q_function = __qtscript_self.property("open");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("open") & QScriptValue::QObjectMember)) {
+ return QBuffer::open(openMode);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, openMode)));
+ }
+}
+
+qint64 QtScriptShell_QBuffer::pos() const
+{
+ QScriptValue _q_function = __qtscript_self.property("pos");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("pos") & QScriptValue::QObjectMember)) {
+ return QBuffer::pos();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+qint64 QtScriptShell_QBuffer::readData(char* data, qint64 maxlen)
+{
+ QScriptValue _q_function = __qtscript_self.property("readData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("readData") & QScriptValue::QObjectMember)) {
+ return QBuffer::readData(data, maxlen);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, data)
+ << qScriptValueFromValue(_q_engine, maxlen)));
+ }
+}
+
+qint64 QtScriptShell_QBuffer::readLineData(char* data, qint64 maxlen)
+{
+ QScriptValue _q_function = __qtscript_self.property("readLineData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("readLineData") & QScriptValue::QObjectMember)) {
+ return QBuffer::readLineData(data, maxlen);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, data)
+ << qScriptValueFromValue(_q_engine, maxlen)));
+ }
+}
+
+bool QtScriptShell_QBuffer::reset()
+{
+ QScriptValue _q_function = __qtscript_self.property("reset");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("reset") & QScriptValue::QObjectMember)) {
+ return QBuffer::reset();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_QBuffer::seek(qint64 off)
+{
+ QScriptValue _q_function = __qtscript_self.property("seek");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("seek") & QScriptValue::QObjectMember)) {
+ return QBuffer::seek(off);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, off)));
+ }
+}
+
+qint64 QtScriptShell_QBuffer::size() const
+{
+ QScriptValue _q_function = __qtscript_self.property("size");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("size") & QScriptValue::QObjectMember)) {
+ return QBuffer::size();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+void QtScriptShell_QBuffer::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QBuffer::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QBuffer::waitForBytesWritten(int msecs)
+{
+ QScriptValue _q_function = __qtscript_self.property("waitForBytesWritten");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("waitForBytesWritten") & QScriptValue::QObjectMember)) {
+ return QBuffer::waitForBytesWritten(msecs);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, msecs)));
+ }
+}
+
+bool QtScriptShell_QBuffer::waitForReadyRead(int msecs)
+{
+ QScriptValue _q_function = __qtscript_self.property("waitForReadyRead");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("waitForReadyRead") & QScriptValue::QObjectMember)) {
+ return QBuffer::waitForReadyRead(msecs);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, msecs)));
+ }
+}
+
+qint64 QtScriptShell_QBuffer::writeData(const char* data, qint64 len)
+{
+ QScriptValue _q_function = __qtscript_self.property("writeData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("writeData") & QScriptValue::QObjectMember)) {
+ return QBuffer::writeData(data, len);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, const_cast<char *>(data))
+ << qScriptValueFromValue(_q_engine, len)));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QBuffer.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QBuffer.h
new file mode 100644
index 0000000..fa214c1
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QBuffer.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QBUFFER_H
+#define QTSCRIPTSHELL_QBUFFER_H
+
+#include <qbuffer.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QBuffer : public QBuffer
+{
+public:
+ QtScriptShell_QBuffer(QByteArray* buf, QObject* parent = 0);
+ QtScriptShell_QBuffer(QObject* parent = 0);
+ ~QtScriptShell_QBuffer();
+
+ bool atEnd() const;
+ qint64 bytesAvailable() const;
+ qint64 bytesToWrite() const;
+ bool canReadLine() const;
+ void childEvent(QChildEvent* arg__1);
+ void close();
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ bool isSequential() const;
+ bool open(QIODevice::OpenMode openMode);
+ qint64 pos() const;
+ qint64 readData(char* data, qint64 maxlen);
+ qint64 readLineData(char* data, qint64 maxlen);
+ bool reset();
+ bool seek(qint64 off);
+ qint64 size() const;
+ void timerEvent(QTimerEvent* arg__1);
+ bool waitForBytesWritten(int msecs);
+ bool waitForReadyRead(int msecs);
+ qint64 writeData(const char* data, qint64 len);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QBUFFER_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QChildEvent.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QChildEvent.cpp
new file mode 100644
index 0000000..d229e85
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QChildEvent.cpp
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QChildEvent.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qobject.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+
+QtScriptShell_QChildEvent::QtScriptShell_QChildEvent(QEvent::Type type, QObject* child)
+ : QChildEvent(type, child) {}
+
+QtScriptShell_QChildEvent::~QtScriptShell_QChildEvent() {}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QChildEvent.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QChildEvent.h
new file mode 100644
index 0000000..f128cc1
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QChildEvent.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QCHILDEVENT_H
+#define QTSCRIPTSHELL_QCHILDEVENT_H
+
+#include <qcoreevent.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QChildEvent : public QChildEvent
+{
+public:
+ QtScriptShell_QChildEvent(QEvent::Type type, QObject* child);
+ ~QtScriptShell_QChildEvent();
+
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QCHILDEVENT_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QCoreApplication.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QCoreApplication.cpp
new file mode 100644
index 0000000..94c14d9
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QCoreApplication.cpp
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QCoreApplication.h"
+
+#include <QtScript/QScriptEngine>
+#include <QStringList>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreapplication.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qstringlist.h>
+#include <qtranslator.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_QCoreApplication::~QtScriptShell_QCoreApplication() {}
+
+void QtScriptShell_QCoreApplication::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QCoreApplication::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_QCoreApplication::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QCoreApplication::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QCoreApplication::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QCoreApplication::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_QCoreApplication::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QCoreApplication::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+bool QtScriptShell_QCoreApplication::notify(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("notify");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("notify") & QScriptValue::QObjectMember)) {
+ return QCoreApplication::notify(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+void QtScriptShell_QCoreApplication::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QCoreApplication::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QCoreApplication.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QCoreApplication.h
new file mode 100644
index 0000000..84c3127
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QCoreApplication.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QCOREAPPLICATION_H
+#define QTSCRIPTSHELL_QCOREAPPLICATION_H
+
+#include <qcoreapplication.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QCoreApplication : public QCoreApplication
+{
+public:
+ QtScriptShell_QCoreApplication(int& argc, char** argv);
+ ~QtScriptShell_QCoreApplication();
+
+ void childEvent(QChildEvent* arg__1);
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ bool notify(QObject* arg__1, QEvent* arg__2);
+ void timerEvent(QTimerEvent* arg__1);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QCOREAPPLICATION_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QDataStream.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QDataStream.cpp
new file mode 100644
index 0000000..201c170
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QDataStream.cpp
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QDataStream.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qdatastream.h>
+#include <qiodevice.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+
+QtScriptShell_QDataStream::QtScriptShell_QDataStream()
+ : QDataStream() {}
+
+QtScriptShell_QDataStream::QtScriptShell_QDataStream(QByteArray* arg__1, QIODevice::OpenMode flags)
+ : QDataStream(arg__1, flags) {}
+
+QtScriptShell_QDataStream::QtScriptShell_QDataStream(QIODevice* arg__1)
+ : QDataStream(arg__1) {}
+
+QtScriptShell_QDataStream::QtScriptShell_QDataStream(const QByteArray& arg__1)
+ : QDataStream(arg__1) {}
+
+QtScriptShell_QDataStream::~QtScriptShell_QDataStream() {}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QDataStream.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QDataStream.h
new file mode 100644
index 0000000..e96d74a
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QDataStream.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QDATASTREAM_H
+#define QTSCRIPTSHELL_QDATASTREAM_H
+
+#include <qdatastream.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QDataStream : public QDataStream
+{
+public:
+ QtScriptShell_QDataStream();
+ QtScriptShell_QDataStream(QByteArray* arg__1, QIODevice::OpenMode flags);
+ QtScriptShell_QDataStream(QIODevice* arg__1);
+ QtScriptShell_QDataStream(const QByteArray& arg__1);
+ ~QtScriptShell_QDataStream();
+
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QDATASTREAM_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QDirIterator.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QDirIterator.cpp
new file mode 100644
index 0000000..04e2b1f
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QDirIterator.cpp
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QDirIterator.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qdir.h>
+#include <qdiriterator.h>
+#include <qfileinfo.h>
+#include <qstringlist.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+
+QtScriptShell_QDirIterator::QtScriptShell_QDirIterator(const QDir& dir, QDirIterator::IteratorFlags flags)
+ : QDirIterator(dir, flags) {}
+
+QtScriptShell_QDirIterator::QtScriptShell_QDirIterator(const QString& path, QDir::Filters filter, QDirIterator::IteratorFlags flags)
+ : QDirIterator(path, filter, flags) {}
+
+QtScriptShell_QDirIterator::QtScriptShell_QDirIterator(const QString& path, QDirIterator::IteratorFlags flags)
+ : QDirIterator(path, flags) {}
+
+QtScriptShell_QDirIterator::QtScriptShell_QDirIterator(const QString& path, const QStringList& nameFilters, QDir::Filters filters, QDirIterator::IteratorFlags flags)
+ : QDirIterator(path, nameFilters, filters, flags) {}
+
+QtScriptShell_QDirIterator::~QtScriptShell_QDirIterator() {}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QDirIterator.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QDirIterator.h
new file mode 100644
index 0000000..523d8a6
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QDirIterator.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QDIRITERATOR_H
+#define QTSCRIPTSHELL_QDIRITERATOR_H
+
+#include <qdiriterator.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QDirIterator : public QDirIterator
+{
+public:
+ QtScriptShell_QDirIterator(const QDir& dir, QDirIterator::IteratorFlags flags = NoIteratorFlags);
+ QtScriptShell_QDirIterator(const QString& path, QDir::Filters filter, QDirIterator::IteratorFlags flags = NoIteratorFlags);
+ QtScriptShell_QDirIterator(const QString& path, QDirIterator::IteratorFlags flags = NoIteratorFlags);
+ QtScriptShell_QDirIterator(const QString& path, const QStringList& nameFilters, QDir::Filters filters = QDir::NoFilter, QDirIterator::IteratorFlags flags = NoIteratorFlags);
+ ~QtScriptShell_QDirIterator();
+
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QDIRITERATOR_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QEvent.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QEvent.cpp
new file mode 100644
index 0000000..28f6f59
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QEvent.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QEvent.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+
+QtScriptShell_QEvent::QtScriptShell_QEvent(QEvent::Type type)
+ : QEvent(type) {}
+
+QtScriptShell_QEvent::~QtScriptShell_QEvent() {}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QEvent.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QEvent.h
new file mode 100644
index 0000000..a6ca05d
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QEvent.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QEVENT_H
+#define QTSCRIPTSHELL_QEVENT_H
+
+#include <qcoreevent.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QEvent : public QEvent
+{
+public:
+ QtScriptShell_QEvent(QEvent::Type type);
+ ~QtScriptShell_QEvent();
+
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QEVENT_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QEventLoop.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QEventLoop.cpp
new file mode 100644
index 0000000..2d73358
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QEventLoop.cpp
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QEventLoop.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_QEventLoop::QtScriptShell_QEventLoop(QObject* parent)
+ : QEventLoop(parent) {}
+
+QtScriptShell_QEventLoop::~QtScriptShell_QEventLoop() {}
+
+void QtScriptShell_QEventLoop::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QEventLoop::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_QEventLoop::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QEventLoop::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QEventLoop::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QEventLoop::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_QEventLoop::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QEventLoop::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+void QtScriptShell_QEventLoop::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QEventLoop::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QEventLoop.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QEventLoop.h
new file mode 100644
index 0000000..df69c14
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QEventLoop.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QEVENTLOOP_H
+#define QTSCRIPTSHELL_QEVENTLOOP_H
+
+#include <qeventloop.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QEventLoop : public QEventLoop
+{
+public:
+ QtScriptShell_QEventLoop(QObject* parent = 0);
+ ~QtScriptShell_QEventLoop();
+
+ void childEvent(QChildEvent* arg__1);
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ void timerEvent(QTimerEvent* arg__1);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QEVENTLOOP_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QFile.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QFile.cpp
new file mode 100644
index 0000000..aa993b3
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QFile.cpp
@@ -0,0 +1,357 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QFile.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qfile.h>
+#include <qlist.h>
+#include <qobject.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QAbstractFileEngine*)
+Q_DECLARE_METATYPE(QFlags<QIODevice::OpenModeFlag>)
+Q_DECLARE_METATYPE(char*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_QFile::QtScriptShell_QFile()
+ : QFile() {}
+
+QtScriptShell_QFile::QtScriptShell_QFile(QObject* parent)
+ : QFile(parent) {}
+
+QtScriptShell_QFile::QtScriptShell_QFile(const QString& name)
+ : QFile(name) {}
+
+QtScriptShell_QFile::QtScriptShell_QFile(const QString& name, QObject* parent)
+ : QFile(name, parent) {}
+
+QtScriptShell_QFile::~QtScriptShell_QFile() {}
+
+bool QtScriptShell_QFile::atEnd() const
+{
+ QScriptValue _q_function = __qtscript_self.property("atEnd");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("atEnd") & QScriptValue::QObjectMember)) {
+ return QFile::atEnd();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+qint64 QtScriptShell_QFile::bytesAvailable() const
+{
+ QScriptValue _q_function = __qtscript_self.property("bytesAvailable");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("bytesAvailable") & QScriptValue::QObjectMember)) {
+ return QFile::bytesAvailable();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+qint64 QtScriptShell_QFile::bytesToWrite() const
+{
+ QScriptValue _q_function = __qtscript_self.property("bytesToWrite");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("bytesToWrite") & QScriptValue::QObjectMember)) {
+ return QFile::bytesToWrite();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_QFile::canReadLine() const
+{
+ QScriptValue _q_function = __qtscript_self.property("canReadLine");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("canReadLine") & QScriptValue::QObjectMember)) {
+ return QFile::canReadLine();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+void QtScriptShell_QFile::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QFile::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_QFile::close()
+{
+ QScriptValue _q_function = __qtscript_self.property("close");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("close") & QScriptValue::QObjectMember)) {
+ QFile::close();
+ } else {
+ _q_function.call(__qtscript_self);
+ }
+}
+
+void QtScriptShell_QFile::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QFile::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QFile::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QFile::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_QFile::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QFile::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+QAbstractFileEngine* QtScriptShell_QFile::fileEngine() const
+{
+ QScriptValue _q_function = __qtscript_self.property("fileEngine");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("fileEngine") & QScriptValue::QObjectMember)) {
+ return QFile::fileEngine();
+ } else {
+ return qscriptvalue_cast<QAbstractFileEngine* >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_QFile::isSequential() const
+{
+ QScriptValue _q_function = __qtscript_self.property("isSequential");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("isSequential") & QScriptValue::QObjectMember)) {
+ return QFile::isSequential();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_QFile::open(QIODevice::OpenMode flags)
+{
+ QScriptValue _q_function = __qtscript_self.property("open");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("open") & QScriptValue::QObjectMember)) {
+ return QFile::open(flags);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, flags)));
+ }
+}
+
+qint64 QtScriptShell_QFile::pos() const
+{
+ QScriptValue _q_function = __qtscript_self.property("pos");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("pos") & QScriptValue::QObjectMember)) {
+ return QFile::pos();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+qint64 QtScriptShell_QFile::readData(char* data, qint64 maxlen)
+{
+ QScriptValue _q_function = __qtscript_self.property("readData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("readData") & QScriptValue::QObjectMember)) {
+ return QFile::readData(data, maxlen);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, data)
+ << qScriptValueFromValue(_q_engine, maxlen)));
+ }
+}
+
+qint64 QtScriptShell_QFile::readLineData(char* data, qint64 maxlen)
+{
+ QScriptValue _q_function = __qtscript_self.property("readLineData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("readLineData") & QScriptValue::QObjectMember)) {
+ return QFile::readLineData(data, maxlen);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, data)
+ << qScriptValueFromValue(_q_engine, maxlen)));
+ }
+}
+
+bool QtScriptShell_QFile::reset()
+{
+ QScriptValue _q_function = __qtscript_self.property("reset");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("reset") & QScriptValue::QObjectMember)) {
+ return QFile::reset();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_QFile::seek(qint64 offset)
+{
+ QScriptValue _q_function = __qtscript_self.property("seek");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("seek") & QScriptValue::QObjectMember)) {
+ return QFile::seek(offset);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, offset)));
+ }
+}
+
+qint64 QtScriptShell_QFile::size() const
+{
+ QScriptValue _q_function = __qtscript_self.property("size");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("size") & QScriptValue::QObjectMember)) {
+ return QFile::size();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+void QtScriptShell_QFile::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QFile::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QFile::waitForBytesWritten(int msecs)
+{
+ QScriptValue _q_function = __qtscript_self.property("waitForBytesWritten");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("waitForBytesWritten") & QScriptValue::QObjectMember)) {
+ return QFile::waitForBytesWritten(msecs);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, msecs)));
+ }
+}
+
+bool QtScriptShell_QFile::waitForReadyRead(int msecs)
+{
+ QScriptValue _q_function = __qtscript_self.property("waitForReadyRead");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("waitForReadyRead") & QScriptValue::QObjectMember)) {
+ return QFile::waitForReadyRead(msecs);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, msecs)));
+ }
+}
+
+qint64 QtScriptShell_QFile::writeData(const char* data, qint64 len)
+{
+ QScriptValue _q_function = __qtscript_self.property("writeData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("writeData") & QScriptValue::QObjectMember)) {
+ return QFile::writeData(data, len);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, const_cast<char *>(data))
+ << qScriptValueFromValue(_q_engine, len)));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QFile.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QFile.h
new file mode 100644
index 0000000..7e15713
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QFile.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QFILE_H
+#define QTSCRIPTSHELL_QFILE_H
+
+#include <qfile.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QFile : public QFile
+{
+public:
+ QtScriptShell_QFile();
+ QtScriptShell_QFile(QObject* parent);
+ QtScriptShell_QFile(const QString& name);
+ QtScriptShell_QFile(const QString& name, QObject* parent);
+ ~QtScriptShell_QFile();
+
+ bool atEnd() const;
+ qint64 bytesAvailable() const;
+ qint64 bytesToWrite() const;
+ bool canReadLine() const;
+ void childEvent(QChildEvent* arg__1);
+ void close();
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ QAbstractFileEngine* fileEngine() const;
+ bool isSequential() const;
+ bool open(QIODevice::OpenMode flags);
+ qint64 pos() const;
+ qint64 readData(char* data, qint64 maxlen);
+ qint64 readLineData(char* data, qint64 maxlen);
+ bool reset();
+ bool seek(qint64 offset);
+ qint64 size() const;
+ void timerEvent(QTimerEvent* arg__1);
+ bool waitForBytesWritten(int msecs);
+ bool waitForReadyRead(int msecs);
+ qint64 writeData(const char* data, qint64 len);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QFILE_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QFileSystemWatcher.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QFileSystemWatcher.cpp
new file mode 100644
index 0000000..2caef09
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QFileSystemWatcher.cpp
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QFileSystemWatcher.h"
+
+#include <QtScript/QScriptEngine>
+#include <QStringList>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qstringlist.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_QFileSystemWatcher::QtScriptShell_QFileSystemWatcher(QObject* parent)
+ : QFileSystemWatcher(parent) {}
+
+QtScriptShell_QFileSystemWatcher::QtScriptShell_QFileSystemWatcher(const QStringList& paths, QObject* parent)
+ : QFileSystemWatcher(paths, parent) {}
+
+QtScriptShell_QFileSystemWatcher::~QtScriptShell_QFileSystemWatcher() {}
+
+void QtScriptShell_QFileSystemWatcher::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QFileSystemWatcher::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_QFileSystemWatcher::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QFileSystemWatcher::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QFileSystemWatcher::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QFileSystemWatcher::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_QFileSystemWatcher::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QFileSystemWatcher::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+void QtScriptShell_QFileSystemWatcher::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QFileSystemWatcher::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QFileSystemWatcher.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QFileSystemWatcher.h
new file mode 100644
index 0000000..4af313b
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QFileSystemWatcher.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QFILESYSTEMWATCHER_H
+#define QTSCRIPTSHELL_QFILESYSTEMWATCHER_H
+
+#include <qfilesystemwatcher.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QFileSystemWatcher : public QFileSystemWatcher
+{
+public:
+ QtScriptShell_QFileSystemWatcher(QObject* parent = 0);
+ QtScriptShell_QFileSystemWatcher(const QStringList& paths, QObject* parent = 0);
+ ~QtScriptShell_QFileSystemWatcher();
+
+ void childEvent(QChildEvent* arg__1);
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ void timerEvent(QTimerEvent* arg__1);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QFILESYSTEMWATCHER_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QIODevice.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QIODevice.cpp
new file mode 100644
index 0000000..be6f427
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QIODevice.cpp
@@ -0,0 +1,339 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QIODevice.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qiodevice.h>
+#include <qlist.h>
+#include <qobject.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QFlags<QIODevice::OpenModeFlag>)
+Q_DECLARE_METATYPE(char*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_QIODevice::QtScriptShell_QIODevice()
+ : QIODevice() {}
+
+QtScriptShell_QIODevice::QtScriptShell_QIODevice(QObject* parent)
+ : QIODevice(parent) {}
+
+QtScriptShell_QIODevice::~QtScriptShell_QIODevice() {}
+
+bool QtScriptShell_QIODevice::atEnd() const
+{
+ QScriptValue _q_function = __qtscript_self.property("atEnd");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("atEnd") & QScriptValue::QObjectMember)) {
+ return QIODevice::atEnd();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+qint64 QtScriptShell_QIODevice::bytesAvailable() const
+{
+ QScriptValue _q_function = __qtscript_self.property("bytesAvailable");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("bytesAvailable") & QScriptValue::QObjectMember)) {
+ return QIODevice::bytesAvailable();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+qint64 QtScriptShell_QIODevice::bytesToWrite() const
+{
+ QScriptValue _q_function = __qtscript_self.property("bytesToWrite");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("bytesToWrite") & QScriptValue::QObjectMember)) {
+ return QIODevice::bytesToWrite();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_QIODevice::canReadLine() const
+{
+ QScriptValue _q_function = __qtscript_self.property("canReadLine");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("canReadLine") & QScriptValue::QObjectMember)) {
+ return QIODevice::canReadLine();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+void QtScriptShell_QIODevice::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QIODevice::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_QIODevice::close()
+{
+ QScriptValue _q_function = __qtscript_self.property("close");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("close") & QScriptValue::QObjectMember)) {
+ QIODevice::close();
+ } else {
+ _q_function.call(__qtscript_self);
+ }
+}
+
+void QtScriptShell_QIODevice::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QIODevice::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QIODevice::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QIODevice::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_QIODevice::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QIODevice::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+bool QtScriptShell_QIODevice::isSequential() const
+{
+ QScriptValue _q_function = __qtscript_self.property("isSequential");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("isSequential") & QScriptValue::QObjectMember)) {
+ return QIODevice::isSequential();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_QIODevice::open(QIODevice::OpenMode mode)
+{
+ QScriptValue _q_function = __qtscript_self.property("open");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("open") & QScriptValue::QObjectMember)) {
+ return QIODevice::open(mode);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, mode)));
+ }
+}
+
+qint64 QtScriptShell_QIODevice::pos() const
+{
+ QScriptValue _q_function = __qtscript_self.property("pos");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("pos") & QScriptValue::QObjectMember)) {
+ return QIODevice::pos();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+qint64 QtScriptShell_QIODevice::readData(char* data, qint64 maxlen)
+{
+ QScriptValue _q_function = __qtscript_self.property("readData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("readData") & QScriptValue::QObjectMember)) {
+ qFatal("QIODevice::readData() is abstract!");
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, data)
+ << qScriptValueFromValue(_q_engine, maxlen)));
+ }
+}
+
+qint64 QtScriptShell_QIODevice::readLineData(char* data, qint64 maxlen)
+{
+ QScriptValue _q_function = __qtscript_self.property("readLineData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("readLineData") & QScriptValue::QObjectMember)) {
+ return QIODevice::readLineData(data, maxlen);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, data)
+ << qScriptValueFromValue(_q_engine, maxlen)));
+ }
+}
+
+bool QtScriptShell_QIODevice::reset()
+{
+ QScriptValue _q_function = __qtscript_self.property("reset");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("reset") & QScriptValue::QObjectMember)) {
+ return QIODevice::reset();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_QIODevice::seek(qint64 pos)
+{
+ QScriptValue _q_function = __qtscript_self.property("seek");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("seek") & QScriptValue::QObjectMember)) {
+ return QIODevice::seek(pos);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, pos)));
+ }
+}
+
+qint64 QtScriptShell_QIODevice::size() const
+{
+ QScriptValue _q_function = __qtscript_self.property("size");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("size") & QScriptValue::QObjectMember)) {
+ return QIODevice::size();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+void QtScriptShell_QIODevice::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QIODevice::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QIODevice::waitForBytesWritten(int msecs)
+{
+ QScriptValue _q_function = __qtscript_self.property("waitForBytesWritten");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("waitForBytesWritten") & QScriptValue::QObjectMember)) {
+ return QIODevice::waitForBytesWritten(msecs);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, msecs)));
+ }
+}
+
+bool QtScriptShell_QIODevice::waitForReadyRead(int msecs)
+{
+ QScriptValue _q_function = __qtscript_self.property("waitForReadyRead");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("waitForReadyRead") & QScriptValue::QObjectMember)) {
+ return QIODevice::waitForReadyRead(msecs);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, msecs)));
+ }
+}
+
+qint64 QtScriptShell_QIODevice::writeData(const char* data, qint64 len)
+{
+ QScriptValue _q_function = __qtscript_self.property("writeData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("writeData") & QScriptValue::QObjectMember)) {
+ qFatal("QIODevice::writeData() is abstract!");
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, const_cast<char *>(data))
+ << qScriptValueFromValue(_q_engine, len)));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QIODevice.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QIODevice.h
new file mode 100644
index 0000000..b819967
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QIODevice.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QIODEVICE_H
+#define QTSCRIPTSHELL_QIODEVICE_H
+
+#include <qiodevice.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QIODevice : public QIODevice
+{
+public:
+ QtScriptShell_QIODevice();
+ QtScriptShell_QIODevice(QObject* parent);
+ ~QtScriptShell_QIODevice();
+
+ bool atEnd() const;
+ qint64 bytesAvailable() const;
+ qint64 bytesToWrite() const;
+ bool canReadLine() const;
+ void childEvent(QChildEvent* arg__1);
+ void close();
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ bool isSequential() const;
+ bool open(QIODevice::OpenMode mode);
+ qint64 pos() const;
+ qint64 readData(char* data, qint64 maxlen);
+ qint64 readLineData(char* data, qint64 maxlen);
+ bool reset();
+ bool seek(qint64 pos);
+ qint64 size() const;
+ void timerEvent(QTimerEvent* arg__1);
+ bool waitForBytesWritten(int msecs);
+ bool waitForReadyRead(int msecs);
+ qint64 writeData(const char* data, qint64 len);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QIODEVICE_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QMimeData.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QMimeData.cpp
new file mode 100644
index 0000000..aba5343
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QMimeData.cpp
@@ -0,0 +1,180 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QMimeData.h"
+
+#include <QtScript/QScriptEngine>
+#include <QStringList>
+#include <QUrl>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qmimedata.h>
+#include <qobject.h>
+#include <qstringlist.h>
+#include <qurl.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QVariant::Type)
+Q_DECLARE_METATYPE(QVariant)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_QMimeData::QtScriptShell_QMimeData()
+ : QMimeData() {}
+
+QtScriptShell_QMimeData::~QtScriptShell_QMimeData() {}
+
+void QtScriptShell_QMimeData::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QMimeData::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_QMimeData::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QMimeData::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QMimeData::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QMimeData::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_QMimeData::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QMimeData::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+QStringList QtScriptShell_QMimeData::formats() const
+{
+ QScriptValue _q_function = __qtscript_self.property("formats");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("formats") & QScriptValue::QObjectMember)) {
+ return QMimeData::formats();
+ } else {
+ return qscriptvalue_cast<QStringList >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_QMimeData::hasFormat(const QString& mimetype) const
+{
+ QScriptValue _q_function = __qtscript_self.property("hasFormat");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("hasFormat") & QScriptValue::QObjectMember)) {
+ return QMimeData::hasFormat(mimetype);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, mimetype)));
+ }
+}
+
+QVariant QtScriptShell_QMimeData::retrieveData(const QString& mimetype, QVariant::Type preferredType) const
+{
+ QScriptValue _q_function = __qtscript_self.property("retrieveData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("retrieveData") & QScriptValue::QObjectMember)) {
+ return QMimeData::retrieveData(mimetype, preferredType);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QVariant >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, mimetype)
+ << qScriptValueFromValue(_q_engine, preferredType)));
+ }
+}
+
+void QtScriptShell_QMimeData::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QMimeData::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QMimeData.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QMimeData.h
new file mode 100644
index 0000000..46d3384
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QMimeData.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QMIMEDATA_H
+#define QTSCRIPTSHELL_QMIMEDATA_H
+
+#include <qmimedata.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QMimeData : public QMimeData
+{
+public:
+ QtScriptShell_QMimeData();
+ ~QtScriptShell_QMimeData();
+
+ void childEvent(QChildEvent* arg__1);
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ QStringList formats() const;
+ bool hasFormat(const QString& mimetype) const;
+ QVariant retrieveData(const QString& mimetype, QVariant::Type preferredType) const;
+ void timerEvent(QTimerEvent* arg__1);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QMIMEDATA_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QObject.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QObject.cpp
new file mode 100644
index 0000000..3b37fed
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QObject.cpp
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QObject.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVarLengthArray>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_QObject::QtScriptShell_QObject(QObject* parent)
+ : QObject(parent) {}
+
+QtScriptShell_QObject::~QtScriptShell_QObject() {}
+
+void QtScriptShell_QObject::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QObject::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_QObject::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QObject::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QObject::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QObject::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_QObject::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QObject::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+void QtScriptShell_QObject::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QObject::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QObject.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QObject.h
new file mode 100644
index 0000000..5161a2c
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QObject.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QOBJECT_H
+#define QTSCRIPTSHELL_QOBJECT_H
+
+#include <qobject.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QObject : public QObject
+{
+public:
+ QtScriptShell_QObject(QObject* parent = 0);
+ ~QtScriptShell_QObject();
+
+ void childEvent(QChildEvent* arg__1);
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ void timerEvent(QTimerEvent* arg__1);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QOBJECT_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QProcess.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QProcess.cpp
new file mode 100644
index 0000000..f8c977c
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QProcess.cpp
@@ -0,0 +1,348 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QProcess.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qprocess.h>
+#include <qstringlist.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QFlags<QIODevice::OpenModeFlag>)
+Q_DECLARE_METATYPE(char*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_QProcess::QtScriptShell_QProcess(QObject* parent)
+ : QProcess(parent) {}
+
+QtScriptShell_QProcess::~QtScriptShell_QProcess() {}
+
+bool QtScriptShell_QProcess::atEnd() const
+{
+ QScriptValue _q_function = __qtscript_self.property("atEnd");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("atEnd") & QScriptValue::QObjectMember)) {
+ return QProcess::atEnd();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+qint64 QtScriptShell_QProcess::bytesAvailable() const
+{
+ QScriptValue _q_function = __qtscript_self.property("bytesAvailable");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("bytesAvailable") & QScriptValue::QObjectMember)) {
+ return QProcess::bytesAvailable();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+qint64 QtScriptShell_QProcess::bytesToWrite() const
+{
+ QScriptValue _q_function = __qtscript_self.property("bytesToWrite");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("bytesToWrite") & QScriptValue::QObjectMember)) {
+ return QProcess::bytesToWrite();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_QProcess::canReadLine() const
+{
+ QScriptValue _q_function = __qtscript_self.property("canReadLine");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("canReadLine") & QScriptValue::QObjectMember)) {
+ return QProcess::canReadLine();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+void QtScriptShell_QProcess::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QProcess::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_QProcess::close()
+{
+ QScriptValue _q_function = __qtscript_self.property("close");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("close") & QScriptValue::QObjectMember)) {
+ QProcess::close();
+ } else {
+ _q_function.call(__qtscript_self);
+ }
+}
+
+void QtScriptShell_QProcess::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QProcess::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QProcess::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QProcess::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_QProcess::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QProcess::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+bool QtScriptShell_QProcess::isSequential() const
+{
+ QScriptValue _q_function = __qtscript_self.property("isSequential");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("isSequential") & QScriptValue::QObjectMember)) {
+ return QProcess::isSequential();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_QProcess::open(QIODevice::OpenMode mode)
+{
+ QScriptValue _q_function = __qtscript_self.property("open");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("open") & QScriptValue::QObjectMember)) {
+ return QProcess::open(mode);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, mode)));
+ }
+}
+
+qint64 QtScriptShell_QProcess::pos() const
+{
+ QScriptValue _q_function = __qtscript_self.property("pos");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("pos") & QScriptValue::QObjectMember)) {
+ return QProcess::pos();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+qint64 QtScriptShell_QProcess::readData(char* data, qint64 maxlen)
+{
+ QScriptValue _q_function = __qtscript_self.property("readData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("readData") & QScriptValue::QObjectMember)) {
+ return QProcess::readData(data, maxlen);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, data)
+ << qScriptValueFromValue(_q_engine, maxlen)));
+ }
+}
+
+qint64 QtScriptShell_QProcess::readLineData(char* data, qint64 maxlen)
+{
+ QScriptValue _q_function = __qtscript_self.property("readLineData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("readLineData") & QScriptValue::QObjectMember)) {
+ return QProcess::readLineData(data, maxlen);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, data)
+ << qScriptValueFromValue(_q_engine, maxlen)));
+ }
+}
+
+bool QtScriptShell_QProcess::reset()
+{
+ QScriptValue _q_function = __qtscript_self.property("reset");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("reset") & QScriptValue::QObjectMember)) {
+ return QProcess::reset();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_QProcess::seek(qint64 pos)
+{
+ QScriptValue _q_function = __qtscript_self.property("seek");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("seek") & QScriptValue::QObjectMember)) {
+ return QProcess::seek(pos);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, pos)));
+ }
+}
+
+void QtScriptShell_QProcess::setupChildProcess()
+{
+ QScriptValue _q_function = __qtscript_self.property("setupChildProcess");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("setupChildProcess") & QScriptValue::QObjectMember)) {
+ QProcess::setupChildProcess();
+ } else {
+ _q_function.call(__qtscript_self);
+ }
+}
+
+qint64 QtScriptShell_QProcess::size() const
+{
+ QScriptValue _q_function = __qtscript_self.property("size");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("size") & QScriptValue::QObjectMember)) {
+ return QProcess::size();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+void QtScriptShell_QProcess::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QProcess::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QProcess::waitForBytesWritten(int msecs)
+{
+ QScriptValue _q_function = __qtscript_self.property("waitForBytesWritten");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("waitForBytesWritten") & QScriptValue::QObjectMember)) {
+ return QProcess::waitForBytesWritten(msecs);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, msecs)));
+ }
+}
+
+bool QtScriptShell_QProcess::waitForReadyRead(int msecs)
+{
+ QScriptValue _q_function = __qtscript_self.property("waitForReadyRead");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("waitForReadyRead") & QScriptValue::QObjectMember)) {
+ return QProcess::waitForReadyRead(msecs);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, msecs)));
+ }
+}
+
+qint64 QtScriptShell_QProcess::writeData(const char* data, qint64 len)
+{
+ QScriptValue _q_function = __qtscript_self.property("writeData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("writeData") & QScriptValue::QObjectMember)) {
+ return QProcess::writeData(data, len);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, const_cast<char *>(data))
+ << qScriptValueFromValue(_q_engine, len)));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QProcess.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QProcess.h
new file mode 100644
index 0000000..01faf81
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QProcess.h
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QPROCESS_H
+#define QTSCRIPTSHELL_QPROCESS_H
+
+#include <qprocess.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QProcess : public QProcess
+{
+public:
+ QtScriptShell_QProcess(QObject* parent = 0);
+ ~QtScriptShell_QProcess();
+
+ bool atEnd() const;
+ qint64 bytesAvailable() const;
+ qint64 bytesToWrite() const;
+ bool canReadLine() const;
+ void childEvent(QChildEvent* arg__1);
+ void close();
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ bool isSequential() const;
+ bool open(QIODevice::OpenMode mode);
+ qint64 pos() const;
+ qint64 readData(char* data, qint64 maxlen);
+ qint64 readLineData(char* data, qint64 maxlen);
+ bool reset();
+ bool seek(qint64 pos);
+ void setupChildProcess();
+ qint64 size() const;
+ void timerEvent(QTimerEvent* arg__1);
+ bool waitForBytesWritten(int msecs = 30000);
+ bool waitForReadyRead(int msecs = 30000);
+ qint64 writeData(const char* data, qint64 len);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QPROCESS_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QRunnable.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QRunnable.cpp
new file mode 100644
index 0000000..c0c5484
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QRunnable.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QRunnable.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+
+QtScriptShell_QRunnable::QtScriptShell_QRunnable()
+ : QRunnable() {}
+
+QtScriptShell_QRunnable::~QtScriptShell_QRunnable() {}
+
+void QtScriptShell_QRunnable::run()
+{
+ QScriptValue _q_function = __qtscript_self.property("run");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("run") & QScriptValue::QObjectMember)) {
+ qFatal("QRunnable::run() is abstract!");
+ } else {
+ _q_function.call(__qtscript_self);
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QRunnable.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QRunnable.h
new file mode 100644
index 0000000..17f4544
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QRunnable.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QRUNNABLE_H
+#define QTSCRIPTSHELL_QRUNNABLE_H
+
+#include <qrunnable.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QRunnable : public QRunnable
+{
+public:
+ QtScriptShell_QRunnable();
+ ~QtScriptShell_QRunnable();
+
+ void run();
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QRUNNABLE_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QSettings.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QSettings.cpp
new file mode 100644
index 0000000..d7f6327
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QSettings.cpp
@@ -0,0 +1,149 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QSettings.h"
+
+#include <QtScript/QScriptEngine>
+#include <QStringList>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qsettings.h>
+#include <qstringlist.h>
+#include <qtextcodec.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_QSettings::QtScriptShell_QSettings(QObject* parent)
+ : QSettings(parent) {}
+
+QtScriptShell_QSettings::QtScriptShell_QSettings(QSettings::Format format, QSettings::Scope scope, const QString& organization, const QString& application, QObject* parent)
+ : QSettings(format, scope, organization, application, parent) {}
+
+QtScriptShell_QSettings::QtScriptShell_QSettings(QSettings::Scope scope, const QString& organization, const QString& application, QObject* parent)
+ : QSettings(scope, organization, application, parent) {}
+
+QtScriptShell_QSettings::QtScriptShell_QSettings(const QString& fileName, QSettings::Format format, QObject* parent)
+ : QSettings(fileName, format, parent) {}
+
+QtScriptShell_QSettings::QtScriptShell_QSettings(const QString& organization, const QString& application, QObject* parent)
+ : QSettings(organization, application, parent) {}
+
+QtScriptShell_QSettings::~QtScriptShell_QSettings() {}
+
+void QtScriptShell_QSettings::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QSettings::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_QSettings::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QSettings::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QSettings::event(QEvent* event)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QSettings::event(event);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, event)));
+ }
+}
+
+bool QtScriptShell_QSettings::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QSettings::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+void QtScriptShell_QSettings::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QSettings::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QSettings.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QSettings.h
new file mode 100644
index 0000000..b10ee11
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QSettings.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QSETTINGS_H
+#define QTSCRIPTSHELL_QSETTINGS_H
+
+#include <qsettings.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QSettings : public QSettings
+{
+public:
+ QtScriptShell_QSettings(QObject* parent = 0);
+ QtScriptShell_QSettings(QSettings::Format format, QSettings::Scope scope, const QString& organization, const QString& application = QString(), QObject* parent = 0);
+ QtScriptShell_QSettings(QSettings::Scope scope, const QString& organization, const QString& application = QString(), QObject* parent = 0);
+ QtScriptShell_QSettings(const QString& fileName, QSettings::Format format, QObject* parent = 0);
+ QtScriptShell_QSettings(const QString& organization, const QString& application = QString(), QObject* parent = 0);
+ ~QtScriptShell_QSettings();
+
+ void childEvent(QChildEvent* arg__1);
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* event);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ void timerEvent(QTimerEvent* arg__1);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QSETTINGS_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QSignalMapper.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QSignalMapper.cpp
new file mode 100644
index 0000000..cb15590
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QSignalMapper.cpp
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QSignalMapper.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qsignalmapper.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_QSignalMapper::QtScriptShell_QSignalMapper(QObject* parent)
+ : QSignalMapper(parent) {}
+
+QtScriptShell_QSignalMapper::~QtScriptShell_QSignalMapper() {}
+
+void QtScriptShell_QSignalMapper::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QSignalMapper::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_QSignalMapper::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QSignalMapper::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QSignalMapper::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QSignalMapper::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_QSignalMapper::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QSignalMapper::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+void QtScriptShell_QSignalMapper::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QSignalMapper::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QSignalMapper.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QSignalMapper.h
new file mode 100644
index 0000000..012cf84
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QSignalMapper.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QSIGNALMAPPER_H
+#define QTSCRIPTSHELL_QSIGNALMAPPER_H
+
+#include <qsignalmapper.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QSignalMapper : public QSignalMapper
+{
+public:
+ QtScriptShell_QSignalMapper(QObject* parent = 0);
+ ~QtScriptShell_QSignalMapper();
+
+ void childEvent(QChildEvent* arg__1);
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ void timerEvent(QTimerEvent* arg__1);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QSIGNALMAPPER_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QSocketNotifier.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QSocketNotifier.cpp
new file mode 100644
index 0000000..8e958fe
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QSocketNotifier.cpp
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QSocketNotifier.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qsocketnotifier.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_QSocketNotifier::QtScriptShell_QSocketNotifier(int socket, QSocketNotifier::Type arg__2, QObject* parent)
+ : QSocketNotifier(socket, arg__2, parent) {}
+
+QtScriptShell_QSocketNotifier::~QtScriptShell_QSocketNotifier() {}
+
+void QtScriptShell_QSocketNotifier::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QSocketNotifier::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_QSocketNotifier::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QSocketNotifier::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QSocketNotifier::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QSocketNotifier::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_QSocketNotifier::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QSocketNotifier::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+void QtScriptShell_QSocketNotifier::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QSocketNotifier::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QSocketNotifier.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QSocketNotifier.h
new file mode 100644
index 0000000..0136777
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QSocketNotifier.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QSOCKETNOTIFIER_H
+#define QTSCRIPTSHELL_QSOCKETNOTIFIER_H
+
+#include <qsocketnotifier.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QSocketNotifier : public QSocketNotifier
+{
+public:
+ QtScriptShell_QSocketNotifier(int socket, QSocketNotifier::Type arg__2, QObject* parent = 0);
+ ~QtScriptShell_QSocketNotifier();
+
+ void childEvent(QChildEvent* arg__1);
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ void timerEvent(QTimerEvent* arg__1);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QSOCKETNOTIFIER_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QTemporaryFile.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QTemporaryFile.cpp
new file mode 100644
index 0000000..02c4d52
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QTemporaryFile.cpp
@@ -0,0 +1,358 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QTemporaryFile.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qfile.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qtemporaryfile.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QAbstractFileEngine*)
+Q_DECLARE_METATYPE(QFlags<QIODevice::OpenModeFlag>)
+Q_DECLARE_METATYPE(char*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_QTemporaryFile::QtScriptShell_QTemporaryFile()
+ : QTemporaryFile() {}
+
+QtScriptShell_QTemporaryFile::QtScriptShell_QTemporaryFile(QObject* parent)
+ : QTemporaryFile(parent) {}
+
+QtScriptShell_QTemporaryFile::QtScriptShell_QTemporaryFile(const QString& templateName)
+ : QTemporaryFile(templateName) {}
+
+QtScriptShell_QTemporaryFile::QtScriptShell_QTemporaryFile(const QString& templateName, QObject* parent)
+ : QTemporaryFile(templateName, parent) {}
+
+QtScriptShell_QTemporaryFile::~QtScriptShell_QTemporaryFile() {}
+
+bool QtScriptShell_QTemporaryFile::atEnd() const
+{
+ QScriptValue _q_function = __qtscript_self.property("atEnd");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("atEnd") & QScriptValue::QObjectMember)) {
+ return QTemporaryFile::atEnd();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+qint64 QtScriptShell_QTemporaryFile::bytesAvailable() const
+{
+ QScriptValue _q_function = __qtscript_self.property("bytesAvailable");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("bytesAvailable") & QScriptValue::QObjectMember)) {
+ return QTemporaryFile::bytesAvailable();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+qint64 QtScriptShell_QTemporaryFile::bytesToWrite() const
+{
+ QScriptValue _q_function = __qtscript_self.property("bytesToWrite");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("bytesToWrite") & QScriptValue::QObjectMember)) {
+ return QTemporaryFile::bytesToWrite();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_QTemporaryFile::canReadLine() const
+{
+ QScriptValue _q_function = __qtscript_self.property("canReadLine");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("canReadLine") & QScriptValue::QObjectMember)) {
+ return QTemporaryFile::canReadLine();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+void QtScriptShell_QTemporaryFile::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QTemporaryFile::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_QTemporaryFile::close()
+{
+ QScriptValue _q_function = __qtscript_self.property("close");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("close") & QScriptValue::QObjectMember)) {
+ QTemporaryFile::close();
+ } else {
+ _q_function.call(__qtscript_self);
+ }
+}
+
+void QtScriptShell_QTemporaryFile::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QTemporaryFile::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QTemporaryFile::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QTemporaryFile::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_QTemporaryFile::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QTemporaryFile::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+QAbstractFileEngine* QtScriptShell_QTemporaryFile::fileEngine() const
+{
+ QScriptValue _q_function = __qtscript_self.property("fileEngine");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("fileEngine") & QScriptValue::QObjectMember)) {
+ return QTemporaryFile::fileEngine();
+ } else {
+ return qscriptvalue_cast<QAbstractFileEngine* >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_QTemporaryFile::isSequential() const
+{
+ QScriptValue _q_function = __qtscript_self.property("isSequential");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("isSequential") & QScriptValue::QObjectMember)) {
+ return QTemporaryFile::isSequential();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_QTemporaryFile::open(QIODevice::OpenMode flags)
+{
+ QScriptValue _q_function = __qtscript_self.property("open");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("open") & QScriptValue::QObjectMember)) {
+ return QTemporaryFile::open(flags);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, flags)));
+ }
+}
+
+qint64 QtScriptShell_QTemporaryFile::pos() const
+{
+ QScriptValue _q_function = __qtscript_self.property("pos");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("pos") & QScriptValue::QObjectMember)) {
+ return QTemporaryFile::pos();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+qint64 QtScriptShell_QTemporaryFile::readData(char* data, qint64 maxlen)
+{
+ QScriptValue _q_function = __qtscript_self.property("readData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("readData") & QScriptValue::QObjectMember)) {
+ return QTemporaryFile::readData(data, maxlen);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, data)
+ << qScriptValueFromValue(_q_engine, maxlen)));
+ }
+}
+
+qint64 QtScriptShell_QTemporaryFile::readLineData(char* data, qint64 maxlen)
+{
+ QScriptValue _q_function = __qtscript_self.property("readLineData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("readLineData") & QScriptValue::QObjectMember)) {
+ return QTemporaryFile::readLineData(data, maxlen);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, data)
+ << qScriptValueFromValue(_q_engine, maxlen)));
+ }
+}
+
+bool QtScriptShell_QTemporaryFile::reset()
+{
+ QScriptValue _q_function = __qtscript_self.property("reset");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("reset") & QScriptValue::QObjectMember)) {
+ return QTemporaryFile::reset();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+bool QtScriptShell_QTemporaryFile::seek(qint64 offset)
+{
+ QScriptValue _q_function = __qtscript_self.property("seek");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("seek") & QScriptValue::QObjectMember)) {
+ return QTemporaryFile::seek(offset);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, offset)));
+ }
+}
+
+qint64 QtScriptShell_QTemporaryFile::size() const
+{
+ QScriptValue _q_function = __qtscript_self.property("size");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("size") & QScriptValue::QObjectMember)) {
+ return QTemporaryFile::size();
+ } else {
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self));
+ }
+}
+
+void QtScriptShell_QTemporaryFile::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QTemporaryFile::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QTemporaryFile::waitForBytesWritten(int msecs)
+{
+ QScriptValue _q_function = __qtscript_self.property("waitForBytesWritten");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("waitForBytesWritten") & QScriptValue::QObjectMember)) {
+ return QTemporaryFile::waitForBytesWritten(msecs);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, msecs)));
+ }
+}
+
+bool QtScriptShell_QTemporaryFile::waitForReadyRead(int msecs)
+{
+ QScriptValue _q_function = __qtscript_self.property("waitForReadyRead");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("waitForReadyRead") & QScriptValue::QObjectMember)) {
+ return QTemporaryFile::waitForReadyRead(msecs);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, msecs)));
+ }
+}
+
+qint64 QtScriptShell_QTemporaryFile::writeData(const char* data, qint64 len)
+{
+ QScriptValue _q_function = __qtscript_self.property("writeData");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("writeData") & QScriptValue::QObjectMember)) {
+ return QTemporaryFile::writeData(data, len);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<qint64 >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, const_cast<char *>(data))
+ << qScriptValueFromValue(_q_engine, len)));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QTemporaryFile.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QTemporaryFile.h
new file mode 100644
index 0000000..d2e651b
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QTemporaryFile.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QTEMPORARYFILE_H
+#define QTSCRIPTSHELL_QTEMPORARYFILE_H
+
+#include <qtemporaryfile.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QTemporaryFile : public QTemporaryFile
+{
+public:
+ QtScriptShell_QTemporaryFile();
+ QtScriptShell_QTemporaryFile(QObject* parent);
+ QtScriptShell_QTemporaryFile(const QString& templateName);
+ QtScriptShell_QTemporaryFile(const QString& templateName, QObject* parent);
+ ~QtScriptShell_QTemporaryFile();
+
+ bool atEnd() const;
+ qint64 bytesAvailable() const;
+ qint64 bytesToWrite() const;
+ bool canReadLine() const;
+ void childEvent(QChildEvent* arg__1);
+ void close();
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ QAbstractFileEngine* fileEngine() const;
+ bool isSequential() const;
+ bool open(QIODevice::OpenMode flags);
+ qint64 pos() const;
+ qint64 readData(char* data, qint64 maxlen);
+ qint64 readLineData(char* data, qint64 maxlen);
+ bool reset();
+ bool seek(qint64 offset);
+ qint64 size() const;
+ void timerEvent(QTimerEvent* arg__1);
+ bool waitForBytesWritten(int msecs);
+ bool waitForReadyRead(int msecs);
+ qint64 writeData(const char* data, qint64 len);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QTEMPORARYFILE_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QTextCodec.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QTextCodec.cpp
new file mode 100644
index 0000000..67752a4
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QTextCodec.cpp
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QTextCodec.h"
+
+#include <QtScript/QScriptEngine>
+#include <QTextCodec>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qlist.h>
+#include <qtextcodec.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QList<QByteArray>)
+Q_DECLARE_METATYPE(QChar*)
+Q_DECLARE_METATYPE(QTextCodec::ConverterState*)
+Q_DECLARE_METATYPE(char*)
+
+QtScriptShell_QTextCodec::QtScriptShell_QTextCodec()
+ : QTextCodec() {}
+
+QtScriptShell_QTextCodec::~QtScriptShell_QTextCodec() {}
+
+QList<QByteArray > QtScriptShell_QTextCodec::aliases() const
+{
+ QScriptValue _q_function = __qtscript_self.property("aliases");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("aliases") & QScriptValue::QObjectMember)) {
+ return QTextCodec::aliases();
+ } else {
+ return qscriptvalue_cast<QList<QByteArray > >(_q_function.call(__qtscript_self));
+ }
+}
+
+QByteArray QtScriptShell_QTextCodec::convertFromUnicode(const QChar* in, int length, QTextCodec::ConverterState* state) const
+{
+ QScriptValue _q_function = __qtscript_self.property("convertFromUnicode");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("convertFromUnicode") & QScriptValue::QObjectMember)) {
+ qFatal("QTextCodec::convertFromUnicode() is abstract!");
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QByteArray >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, const_cast<QChar *>(in))
+ << qScriptValueFromValue(_q_engine, length)
+ << qScriptValueFromValue(_q_engine, state)));
+ }
+}
+
+QString QtScriptShell_QTextCodec::convertToUnicode(const char* in, int length, QTextCodec::ConverterState* state) const
+{
+ QScriptValue _q_function = __qtscript_self.property("convertToUnicode");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("convertToUnicode") & QScriptValue::QObjectMember)) {
+ qFatal("QTextCodec::convertToUnicode() is abstract!");
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QString >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, const_cast<char *>(in))
+ << qScriptValueFromValue(_q_engine, length)
+ << qScriptValueFromValue(_q_engine, state)));
+ }
+}
+
+int QtScriptShell_QTextCodec::mibEnum() const
+{
+ QScriptValue _q_function = __qtscript_self.property("mibEnum");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("mibEnum") & QScriptValue::QObjectMember)) {
+ qFatal("QTextCodec::mibEnum() is abstract!");
+ } else {
+ return qscriptvalue_cast<int >(_q_function.call(__qtscript_self));
+ }
+}
+
+QByteArray QtScriptShell_QTextCodec::name() const
+{
+ QScriptValue _q_function = __qtscript_self.property("name");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("name") & QScriptValue::QObjectMember)) {
+ qFatal("QTextCodec::name() is abstract!");
+ } else {
+ return qscriptvalue_cast<QByteArray >(_q_function.call(__qtscript_self));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QTextCodec.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QTextCodec.h
new file mode 100644
index 0000000..daabf63
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QTextCodec.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QTEXTCODEC_H
+#define QTSCRIPTSHELL_QTEXTCODEC_H
+
+#include <qtextcodec.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QTextCodec : public QTextCodec
+{
+public:
+ QtScriptShell_QTextCodec();
+ ~QtScriptShell_QTextCodec();
+
+ QList<QByteArray > aliases() const;
+ QByteArray convertFromUnicode(const QChar* in, int length, QTextCodec::ConverterState* state) const;
+ QString convertToUnicode(const char* in, int length, QTextCodec::ConverterState* state) const;
+ int mibEnum() const;
+ QByteArray name() const;
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QTEXTCODEC_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QTextCodecPlugin.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QTextCodecPlugin.cpp
new file mode 100644
index 0000000..785e9ba
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QTextCodecPlugin.cpp
@@ -0,0 +1,199 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QTextCodecPlugin.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qstringlist.h>
+#include <qtextcodec.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QList<QByteArray>)
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QTextCodec*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QList<int>)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_QTextCodecPlugin::QtScriptShell_QTextCodecPlugin(QObject* parent)
+ : QTextCodecPlugin(parent) {}
+
+QtScriptShell_QTextCodecPlugin::~QtScriptShell_QTextCodecPlugin() {}
+
+QList<QByteArray > QtScriptShell_QTextCodecPlugin::aliases() const
+{
+ QScriptValue _q_function = __qtscript_self.property("aliases");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("aliases") & QScriptValue::QObjectMember)) {
+ qFatal("QTextCodecPlugin::aliases() is abstract!");
+ } else {
+ return qscriptvalue_cast<QList<QByteArray > >(_q_function.call(__qtscript_self));
+ }
+}
+
+void QtScriptShell_QTextCodecPlugin::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QTextCodecPlugin::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+QTextCodec* QtScriptShell_QTextCodecPlugin::createForMib(int mib)
+{
+ QScriptValue _q_function = __qtscript_self.property("createForMib");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("createForMib") & QScriptValue::QObjectMember)) {
+ qFatal("QTextCodecPlugin::createForMib() is abstract!");
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QTextCodec* >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, mib)));
+ }
+}
+
+QTextCodec* QtScriptShell_QTextCodecPlugin::createForName(const QByteArray& name)
+{
+ QScriptValue _q_function = __qtscript_self.property("createForName");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("createForName") & QScriptValue::QObjectMember)) {
+ qFatal("QTextCodecPlugin::createForName() is abstract!");
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QTextCodec* >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, name)));
+ }
+}
+
+void QtScriptShell_QTextCodecPlugin::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QTextCodecPlugin::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QTextCodecPlugin::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QTextCodecPlugin::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_QTextCodecPlugin::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QTextCodecPlugin::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+QList<int > QtScriptShell_QTextCodecPlugin::mibEnums() const
+{
+ QScriptValue _q_function = __qtscript_self.property("mibEnums");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("mibEnums") & QScriptValue::QObjectMember)) {
+ qFatal("QTextCodecPlugin::mibEnums() is abstract!");
+ } else {
+ return qscriptvalue_cast<QList<int > >(_q_function.call(__qtscript_self));
+ }
+}
+
+QList<QByteArray > QtScriptShell_QTextCodecPlugin::names() const
+{
+ QScriptValue _q_function = __qtscript_self.property("names");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("names") & QScriptValue::QObjectMember)) {
+ qFatal("QTextCodecPlugin::names() is abstract!");
+ } else {
+ return qscriptvalue_cast<QList<QByteArray > >(_q_function.call(__qtscript_self));
+ }
+}
+
+void QtScriptShell_QTextCodecPlugin::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QTextCodecPlugin::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QTextCodecPlugin.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QTextCodecPlugin.h
new file mode 100644
index 0000000..d40f41a
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QTextCodecPlugin.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QTEXTCODECPLUGIN_H
+#define QTSCRIPTSHELL_QTEXTCODECPLUGIN_H
+
+#include <qtextcodecplugin.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QTextCodecPlugin : public QTextCodecPlugin
+{
+public:
+ QtScriptShell_QTextCodecPlugin(QObject* parent = 0);
+ ~QtScriptShell_QTextCodecPlugin();
+
+ QList<QByteArray > aliases() const;
+ void childEvent(QChildEvent* arg__1);
+ QTextCodec* createForMib(int mib);
+ QTextCodec* createForName(const QByteArray& name);
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ QList<int > mibEnums() const;
+ QList<QByteArray > names() const;
+ void timerEvent(QTimerEvent* arg__1);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QTEXTCODECPLUGIN_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QTextStream.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QTextStream.cpp
new file mode 100644
index 0000000..4d6eaa7
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QTextStream.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QTextStream.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qiodevice.h>
+#include <qlocale.h>
+#include <qtextcodec.h>
+#include <qtextstream.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+
+QtScriptShell_QTextStream::QtScriptShell_QTextStream()
+ : QTextStream() {}
+
+QtScriptShell_QTextStream::QtScriptShell_QTextStream(QIODevice* device)
+ : QTextStream(device) {}
+
+QtScriptShell_QTextStream::QtScriptShell_QTextStream(const QByteArray& array, QIODevice::OpenMode openMode)
+ : QTextStream(array, openMode) {}
+
+QtScriptShell_QTextStream::~QtScriptShell_QTextStream() {}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QTextStream.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QTextStream.h
new file mode 100644
index 0000000..7f005c3
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QTextStream.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QTEXTSTREAM_H
+#define QTSCRIPTSHELL_QTEXTSTREAM_H
+
+#include <qtextstream.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QTextStream : public QTextStream
+{
+public:
+ QtScriptShell_QTextStream();
+ QtScriptShell_QTextStream(QByteArray* array, QIODevice::OpenMode openMode = QIODevice::ReadWrite);
+ QtScriptShell_QTextStream(QIODevice* device);
+ QtScriptShell_QTextStream(QString* string, QIODevice::OpenMode openMode = QIODevice::ReadWrite);
+ QtScriptShell_QTextStream(const QByteArray& array, QIODevice::OpenMode openMode = QIODevice::ReadOnly);
+ ~QtScriptShell_QTextStream();
+
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QTEXTSTREAM_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QThreadPool.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QThreadPool.cpp
new file mode 100644
index 0000000..01f67a1
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QThreadPool.cpp
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QThreadPool.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qrunnable.h>
+#include <qthreadpool.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_QThreadPool::QtScriptShell_QThreadPool(QObject* parent)
+ : QThreadPool(parent) {}
+
+QtScriptShell_QThreadPool::~QtScriptShell_QThreadPool() {}
+
+void QtScriptShell_QThreadPool::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QThreadPool::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_QThreadPool::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QThreadPool::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QThreadPool::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QThreadPool::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_QThreadPool::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QThreadPool::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+void QtScriptShell_QThreadPool::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QThreadPool::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QThreadPool.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QThreadPool.h
new file mode 100644
index 0000000..3f9a354
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QThreadPool.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QTHREADPOOL_H
+#define QTSCRIPTSHELL_QTHREADPOOL_H
+
+#include <qthreadpool.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QThreadPool : public QThreadPool
+{
+public:
+ QtScriptShell_QThreadPool(QObject* parent = 0);
+ ~QtScriptShell_QThreadPool();
+
+ void childEvent(QChildEvent* arg__1);
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ void timerEvent(QTimerEvent* arg__1);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QTHREADPOOL_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QTimeLine.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QTimeLine.cpp
new file mode 100644
index 0000000..b363ed5
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QTimeLine.cpp
@@ -0,0 +1,148 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QTimeLine.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qtimeline.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_QTimeLine::QtScriptShell_QTimeLine(int duration, QObject* parent)
+ : QTimeLine(duration, parent) {}
+
+QtScriptShell_QTimeLine::~QtScriptShell_QTimeLine() {}
+
+void QtScriptShell_QTimeLine::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QTimeLine::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_QTimeLine::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QTimeLine::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QTimeLine::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QTimeLine::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_QTimeLine::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QTimeLine::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+void QtScriptShell_QTimeLine::timerEvent(QTimerEvent* event)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QTimeLine::timerEvent(event);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, event));
+ }
+}
+
+qreal QtScriptShell_QTimeLine::valueForTime(int msec) const
+{
+ QScriptValue _q_function = __qtscript_self.property("valueForTime");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("valueForTime") & QScriptValue::QObjectMember)) {
+ return QTimeLine::valueForTime(msec);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<qreal >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, msec)));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QTimeLine.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QTimeLine.h
new file mode 100644
index 0000000..570d851
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QTimeLine.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QTIMELINE_H
+#define QTSCRIPTSHELL_QTIMELINE_H
+
+#include <qtimeline.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QTimeLine : public QTimeLine
+{
+public:
+ QtScriptShell_QTimeLine(int duration = 1000, QObject* parent = 0);
+ ~QtScriptShell_QTimeLine();
+
+ void childEvent(QChildEvent* arg__1);
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ void timerEvent(QTimerEvent* event);
+ qreal valueForTime(int msec) const;
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QTIMELINE_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QTimer.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QTimer.cpp
new file mode 100644
index 0000000..b4875b7
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QTimer.cpp
@@ -0,0 +1,134 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QTimer.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qtimer.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+
+QtScriptShell_QTimer::QtScriptShell_QTimer(QObject* parent)
+ : QTimer(parent) {}
+
+QtScriptShell_QTimer::~QtScriptShell_QTimer() {}
+
+void QtScriptShell_QTimer::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QTimer::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_QTimer::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QTimer::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QTimer::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QTimer::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_QTimer::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QTimer::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+void QtScriptShell_QTimer::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QTimer::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QTimer.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QTimer.h
new file mode 100644
index 0000000..71f72a5
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QTimer.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QTIMER_H
+#define QTSCRIPTSHELL_QTIMER_H
+
+#include <qtimer.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QTimer : public QTimer
+{
+public:
+ QtScriptShell_QTimer(QObject* parent = 0);
+ ~QtScriptShell_QTimer();
+
+ void childEvent(QChildEvent* arg__1);
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ void timerEvent(QTimerEvent* arg__1);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QTIMER_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QTimerEvent.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QTimerEvent.cpp
new file mode 100644
index 0000000..e30a056
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QTimerEvent.cpp
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QTimerEvent.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+
+QtScriptShell_QTimerEvent::QtScriptShell_QTimerEvent(int timerId)
+ : QTimerEvent(timerId) {}
+
+QtScriptShell_QTimerEvent::~QtScriptShell_QTimerEvent() {}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QTimerEvent.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QTimerEvent.h
new file mode 100644
index 0000000..cc07652
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QTimerEvent.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QTIMEREVENT_H
+#define QTSCRIPTSHELL_QTIMEREVENT_H
+
+#include <qcoreevent.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QTimerEvent : public QTimerEvent
+{
+public:
+ QtScriptShell_QTimerEvent(int timerId);
+ ~QtScriptShell_QTimerEvent();
+
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QTIMEREVENT_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QTranslator.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QTranslator.cpp
new file mode 100644
index 0000000..aafbacf
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QTranslator.cpp
@@ -0,0 +1,162 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QTranslator.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qbytearray.h>
+#include <qcoreevent.h>
+#include <qlist.h>
+#include <qobject.h>
+#include <qtranslator.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+Q_DECLARE_METATYPE(QChildEvent*)
+Q_DECLARE_METATYPE(QEvent*)
+Q_DECLARE_METATYPE(QTimerEvent*)
+Q_DECLARE_METATYPE(char*)
+
+QtScriptShell_QTranslator::QtScriptShell_QTranslator(QObject* parent)
+ : QTranslator(parent) {}
+
+QtScriptShell_QTranslator::~QtScriptShell_QTranslator() {}
+
+void QtScriptShell_QTranslator::childEvent(QChildEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("childEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("childEvent") & QScriptValue::QObjectMember)) {
+ QTranslator::childEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+void QtScriptShell_QTranslator::customEvent(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("customEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("customEvent") & QScriptValue::QObjectMember)) {
+ QTranslator::customEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+bool QtScriptShell_QTranslator::event(QEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("event");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("event") & QScriptValue::QObjectMember)) {
+ return QTranslator::event(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)));
+ }
+}
+
+bool QtScriptShell_QTranslator::eventFilter(QObject* arg__1, QEvent* arg__2)
+{
+ QScriptValue _q_function = __qtscript_self.property("eventFilter");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("eventFilter") & QScriptValue::QObjectMember)) {
+ return QTranslator::eventFilter(arg__1, arg__2);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1)
+ << qScriptValueFromValue(_q_engine, arg__2)));
+ }
+}
+
+bool QtScriptShell_QTranslator::isEmpty() const
+{
+ QScriptValue _q_function = __qtscript_self.property("isEmpty");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("isEmpty") & QScriptValue::QObjectMember)) {
+ return QTranslator::isEmpty();
+ } else {
+ return qscriptvalue_cast<bool >(_q_function.call(__qtscript_self));
+ }
+}
+
+void QtScriptShell_QTranslator::timerEvent(QTimerEvent* arg__1)
+{
+ QScriptValue _q_function = __qtscript_self.property("timerEvent");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("timerEvent") & QScriptValue::QObjectMember)) {
+ QTranslator::timerEvent(arg__1);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ _q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, arg__1));
+ }
+}
+
+QString QtScriptShell_QTranslator::translate(const char* context, const char* sourceText, const char* disambiguation) const
+{
+ QScriptValue _q_function = __qtscript_self.property("translate");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("translate") & QScriptValue::QObjectMember)) {
+ return QTranslator::translate(context, sourceText, disambiguation);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QString >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, const_cast<char *>(context))
+ << qScriptValueFromValue(_q_engine, const_cast<char *>(sourceText))
+ << qScriptValueFromValue(_q_engine, const_cast<char *>(disambiguation))));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QTranslator.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QTranslator.h
new file mode 100644
index 0000000..fff8f4e
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QTranslator.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QTRANSLATOR_H
+#define QTSCRIPTSHELL_QTRANSLATOR_H
+
+#include <qtranslator.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QTranslator : public QTranslator
+{
+public:
+ QtScriptShell_QTranslator(QObject* parent = 0);
+ ~QtScriptShell_QTranslator();
+
+ void childEvent(QChildEvent* arg__1);
+ void customEvent(QEvent* arg__1);
+ bool event(QEvent* arg__1);
+ bool eventFilter(QObject* arg__1, QEvent* arg__2);
+ bool isEmpty() const;
+ void timerEvent(QTimerEvent* arg__1);
+ QString translate(const char* context, const char* sourceText, const char* disambiguation = 0) const;
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QTRANSLATOR_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QUuid.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QUuid.cpp
new file mode 100644
index 0000000..5224f93
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QUuid.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QUuid.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qdatastream.h>
+#include <quuid.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+
+QtScriptShell_QUuid::QtScriptShell_QUuid()
+ : QUuid() {}
+
+QtScriptShell_QUuid::QtScriptShell_QUuid(const QString& arg__1)
+ : QUuid(arg__1) {}
+
+QtScriptShell_QUuid::QtScriptShell_QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8)
+ : QUuid(l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) {}
+
+QtScriptShell_QUuid::~QtScriptShell_QUuid() {}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QUuid.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QUuid.h
new file mode 100644
index 0000000..86e6bec
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QUuid.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QUUID_H
+#define QTSCRIPTSHELL_QUUID_H
+
+#include <quuid.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QUuid : public QUuid
+{
+public:
+ QtScriptShell_QUuid();
+ QtScriptShell_QUuid(const QString& arg__1);
+ QtScriptShell_QUuid(const char* arg__1);
+ QtScriptShell_QUuid(uint l, ushort w1, ushort w2, uchar b1, uchar b2, uchar b3, uchar b4, uchar b5, uchar b6, uchar b7, uchar b8);
+ ~QtScriptShell_QUuid();
+
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QUUID_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QXmlStreamAttributes.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QXmlStreamAttributes.cpp
new file mode 100644
index 0000000..65e3b94
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QXmlStreamAttributes.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QXmlStreamAttributes.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+#include <qlist.h>
+#include <qvector.h>
+#include <qxmlstream.h>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+
+QtScriptShell_QXmlStreamAttributes::QtScriptShell_QXmlStreamAttributes()
+ : QXmlStreamAttributes() {}
+
+QtScriptShell_QXmlStreamAttributes::~QtScriptShell_QXmlStreamAttributes() {}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QXmlStreamAttributes.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QXmlStreamAttributes.h
new file mode 100644
index 0000000..a4e3f37
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QXmlStreamAttributes.h
@@ -0,0 +1,60 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QXMLSTREAMATTRIBUTES_H
+#define QTSCRIPTSHELL_QXMLSTREAMATTRIBUTES_H
+
+#include <qxmlstream.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QXmlStreamAttributes : public QXmlStreamAttributes
+{
+public:
+ QtScriptShell_QXmlStreamAttributes();
+ ~QtScriptShell_QXmlStreamAttributes();
+
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QXMLSTREAMATTRIBUTES_H
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QXmlStreamEntityResolver.cpp b/qtbindings/com_nokia_qt_core/qtscriptshell_QXmlStreamEntityResolver.cpp
new file mode 100644
index 0000000..f07d2d3
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QXmlStreamEntityResolver.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qtscriptshell_QXmlStreamEntityResolver.h"
+
+#include <QtScript/QScriptEngine>
+#include <QVariant>
+
+#define QTSCRIPT_IS_GENERATED_FUNCTION(fun) ((fun.data().toUInt32() & 0xFFFF0000) == 0xBABE0000)
+
+
+QtScriptShell_QXmlStreamEntityResolver::QtScriptShell_QXmlStreamEntityResolver()
+ : QXmlStreamEntityResolver() {}
+
+QtScriptShell_QXmlStreamEntityResolver::~QtScriptShell_QXmlStreamEntityResolver() {}
+
+QString QtScriptShell_QXmlStreamEntityResolver::resolveEntity(const QString& publicId, const QString& systemId)
+{
+ QScriptValue _q_function = __qtscript_self.property("resolveEntity");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("resolveEntity") & QScriptValue::QObjectMember)) {
+ return QXmlStreamEntityResolver::resolveEntity(publicId, systemId);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QString >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, publicId)
+ << qScriptValueFromValue(_q_engine, systemId)));
+ }
+}
+
+QString QtScriptShell_QXmlStreamEntityResolver::resolveUndeclaredEntity(const QString& name)
+{
+ QScriptValue _q_function = __qtscript_self.property("resolveUndeclaredEntity");
+ if (!_q_function.isFunction() || QTSCRIPT_IS_GENERATED_FUNCTION(_q_function)
+ || (__qtscript_self.propertyFlags("resolveUndeclaredEntity") & QScriptValue::QObjectMember)) {
+ return QXmlStreamEntityResolver::resolveUndeclaredEntity(name);
+ } else {
+ QScriptEngine *_q_engine = __qtscript_self.engine();
+ return qscriptvalue_cast<QString >(_q_function.call(__qtscript_self,
+ QScriptValueList()
+ << qScriptValueFromValue(_q_engine, name)));
+ }
+}
+
diff --git a/qtbindings/com_nokia_qt_core/qtscriptshell_QXmlStreamEntityResolver.h b/qtbindings/com_nokia_qt_core/qtscriptshell_QXmlStreamEntityResolver.h
new file mode 100644
index 0000000..2ca01f5
--- /dev/null
+++ b/qtbindings/com_nokia_qt_core/qtscriptshell_QXmlStreamEntityResolver.h
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QTSCRIPTSHELL_QXMLSTREAMENTITYRESOLVER_H
+#define QTSCRIPTSHELL_QXMLSTREAMENTITYRESOLVER_H
+
+#include <qxmlstream.h>
+
+#include <QtScript/qscriptvalue.h>
+
+class QtScriptShell_QXmlStreamEntityResolver : public QXmlStreamEntityResolver
+{
+public:
+ QtScriptShell_QXmlStreamEntityResolver();
+ ~QtScriptShell_QXmlStreamEntityResolver();
+
+ QString resolveEntity(const QString& publicId, const QString& systemId);
+ QString resolveUndeclaredEntity(const QString& name);
+
+ QScriptValue __qtscript_self;
+};
+
+#endif // QTSCRIPTSHELL_QXMLSTREAMENTITYRESOLVER_H
diff --git a/qtbindings/qtbindings.pro b/qtbindings/qtbindings.pro
new file mode 100644
index 0000000..0bc08f5
--- /dev/null
+++ b/qtbindings/qtbindings.pro
@@ -0,0 +1,2 @@
+TEMPLATE = subdirs
+SUBDIRS = qtscript_core
diff --git a/qtbindings/qtbindingsbase.pri b/qtbindings/qtbindingsbase.pri
new file mode 100644
index 0000000..c5d0f35
--- /dev/null
+++ b/qtbindings/qtbindingsbase.pri
@@ -0,0 +1,8 @@
+TEMPLATE = lib
+DEPENDPATH += .
+INCLUDEPATH += .
+DESTDIR = $$OUT_PWD/../plugins/script
+QT += script
+CONFIG += debug_and_release
+GENERATEDCPP = $$PWD
+TARGET=$$qtLibraryTarget($$TARGET)
diff --git a/qtbindings/qtscript_core/qtscript_core.pro b/qtbindings/qtscript_core/qtscript_core.pro
new file mode 100644
index 0000000..c1da436
--- /dev/null
+++ b/qtbindings/qtscript_core/qtscript_core.pro
@@ -0,0 +1,8 @@
+TARGET = qtscript_core
+include(../qtbindingsbase.pri)
+SOURCES += $$GENERATEDCPP/com_nokia_qt_core/main.cpp
+include($$GENERATEDCPP/com_nokia_qt_core/com_nokia_qt_core.pri)
+
+symbian {
+ TARGET.EPOCALLOWDLLDATA=1
+}
diff --git a/qtuitest-orbit.pro b/qtuitest-orbit.pro
new file mode 100644
index 0000000..76b431c
--- /dev/null
+++ b/qtuitest-orbit.pro
@@ -0,0 +1,37 @@
+TEMPLATE=subdirs
+SUBDIRS=lib qtslave qtwidgets qgraphicsviewwidgets hbwidgets qtbindings libqsystemtest interpreter
+CONFIG+=ordered
+
+system(echo DEFINES+=QTUITEST_IMAGE_PATH=$$OUT_PWD > $$OUT_PWD/.qmake.cache)
+system(echo QMAKEFEATURES+=$$PWD/features:$HB_INSTALL_DIR:$HB_SOURCE_DIR >> $$OUT_PWD/.qmake.cache)
+
+unix:!mac:!symbian {
+ SUBDIRS+=style tests examples
+ system(if ! [ -e $$OUT_PWD/features ]; then ln -sf $$PWD/features $$OUT_PWD/features; fi)
+ system(echo SRCROOT=$(readlink -f $$PWD) >> $$OUT_PWD/.qmake.cache)
+ system(echo BUILDROOT=$(readlink -f $$OUT_PWD) >> $$OUT_PWD/.qmake.cache)
+}
+
+mac {
+ SUBDIRS+=style tests
+ system(if ! [ -e $$OUT_PWD/features ]; then ln -sf $$PWD/features $$OUT_PWD/features; fi)
+ system(echo SRCROOT='$$PWD' >> $$OUT_PWD/.qmake.cache)
+ system(echo BUILDROOT='$$OUT_PWD' >> $$OUT_PWD/.qmake.cache)
+}
+
+symbian {
+ SUBDIRS-=qgraphicsviewwidgets qtbindings libqsystemtest interpreter
+ SUBDIRS+=style
+ system(echo SRCROOT=$$PWD >> $$OUT_PWD/.qmake.cache)
+ system(echo BUILDROOT=$$OUT_PWD >> $$OUT_PWD/.qmake.cache)
+}
+
+win32 {
+ SUBDIRS+=style tests
+ WIN_PWD=$$replace(PWD,/,\)
+ WIN_OUT_PWD=$$replace(OUT_PWD,/,\)
+ system(xcopy $$WIN_PWD\features $$WIN_OUT_PWD\features /E /I /D /Y)
+ system(echo SRCROOT=$$PWD >> $$OUT_PWD/.qmake.cache)
+ system(echo BUILDROOT=$$OUT_PWD >> $$OUT_PWD/.qmake.cache)
+ system(echo INSTALLROOT=$$OUT_PWD/bin >> $$OUT_PWD/.qmake.cache)
+}
diff --git a/qtuitest-qml.pro b/qtuitest-qml.pro
new file mode 100644
index 0000000..9aea5d8
--- /dev/null
+++ b/qtuitest-qml.pro
@@ -0,0 +1,37 @@
+TEMPLATE=subdirs
+SUBDIRS=lib qtslave qtwidgets qmlwidgets qgraphicsviewwidgets qtbindings libqsystemtest interpreter
+CONFIG+=ordered
+
+system(echo DEFINES+=QTUITEST_IMAGE_PATH=$$OUT_PWD > $$OUT_PWD/.qmake.cache)
+system(echo QMAKEFEATURES+=$$PWD/features >> $$OUT_PWD/.qmake.cache)
+
+unix:!mac:!symbian {
+ SUBDIRS+=style tests examples
+ system(if ! [ -e $$OUT_PWD/features ]; then ln -sf $$PWD/features $$OUT_PWD/features; fi)
+ system(echo SRCROOT=$(readlink -f $$PWD) >> $$OUT_PWD/.qmake.cache)
+ system(echo BUILDROOT=$(readlink -f $$OUT_PWD) >> $$OUT_PWD/.qmake.cache)
+}
+
+mac {
+ SUBDIRS+=style tests
+ system(if ! [ -e $$OUT_PWD/features ]; then ln -sf $$PWD/features $$OUT_PWD/features; fi)
+ system(echo SRCROOT='$$PWD' >> $$OUT_PWD/.qmake.cache)
+ system(echo BUILDROOT='$$OUT_PWD' >> $$OUT_PWD/.qmake.cache)
+}
+
+symbian {
+ SUBDIRS-=qgraphicsviewwidgets qtbindings libqsystemtest interpreter
+ SUBDIRS+=style
+ system(echo SRCROOT=$$PWD >> $$OUT_PWD/.qmake.cache)
+ system(echo BUILDROOT=$$OUT_PWD >> $$OUT_PWD/.qmake.cache)
+}
+
+win32 {
+ SUBDIRS+=style tests
+ WIN_PWD=$$replace(PWD,/,\)
+ WIN_OUT_PWD=$$replace(OUT_PWD,/,\)
+ system(xcopy $$WIN_PWD\features $$WIN_OUT_PWD\features /E /I /D /Y)
+ system(echo SRCROOT=$$PWD >> $$OUT_PWD/.qmake.cache)
+ system(echo BUILDROOT=$$OUT_PWD >> $$OUT_PWD/.qmake.cache)
+ system(echo INSTALLROOT=$$OUT_PWD/bin >> $$OUT_PWD/.qmake.cache)
+}
diff --git a/qtuitest.pro b/qtuitest.pro
new file mode 100644
index 0000000..d74e833
--- /dev/null
+++ b/qtuitest.pro
@@ -0,0 +1,37 @@
+TEMPLATE=subdirs
+SUBDIRS=libqtuitest libqtslave plugins qtbindings libqsystemtest interpreter
+CONFIG+=ordered
+
+!no_examples:SUBDIRS+=examples
+!no_tests:SUBDIRS+=tests
+
+system(echo DEFINES+=QTUITEST_IMAGE_PATH=$$OUT_PWD > $$OUT_PWD/.qmake.cache)
+system(echo QMAKEFEATURES+=$$PWD/features >> $$OUT_PWD/.qmake.cache)
+
+unix:!mac:!symbian {
+ system(if ! [ -e $$OUT_PWD/features ]; then ln -sf $$PWD/features $$OUT_PWD/features; fi)
+ system(echo SRCROOT=$(readlink -f $$PWD) >> $$OUT_PWD/.qmake.cache)
+ system(echo BUILDROOT=$(readlink -f $$OUT_PWD) >> $$OUT_PWD/.qmake.cache)
+}
+
+mac {
+ system(if ! [ -e $$OUT_PWD/features ]; then ln -sf $$PWD/features $$OUT_PWD/features; fi)
+ system(echo SRCROOT='$$PWD' >> $$OUT_PWD/.qmake.cache)
+ system(echo BUILDROOT='$$OUT_PWD' >> $$OUT_PWD/.qmake.cache)
+}
+
+
+symbian {
+ SUBDIRS-=qtbindings libqsystemtest interpreter
+ system(echo SRCROOT=$$PWD >> $$OUT_PWD/.qmake.cache)
+ system(echo BUILDROOT=$$OUT_PWD >> $$OUT_PWD/.qmake.cache)
+}
+
+win32 {
+ WIN_PWD=$$replace(PWD,/,\)
+ WIN_OUT_PWD=$$replace(OUT_PWD,/,\)
+ system(xcopy $$WIN_PWD\features $$WIN_OUT_PWD\features /E /I /D /Y)
+ system(echo SRCROOT=$$PWD >> $$OUT_PWD/.qmake.cache)
+ system(echo BUILDROOT=$$OUT_PWD >> $$OUT_PWD/.qmake.cache)
+ system(echo INSTALLROOT=$$OUT_PWD/bin >> $$OUT_PWD/.qmake.cache)
+}
diff --git a/qtuitest_config.h b/qtuitest_config.h
new file mode 100644
index 0000000..a2959c1
--- /dev/null
+++ b/qtuitest_config.h
@@ -0,0 +1,8 @@
+#ifndef QTUITEST_CONFIG_H
+#define QTUITEST_CONFIG_H
+
+#ifndef DEFAULT_AUT_PORT
+#define DEFAULT_AUT_PORT 5656
+#endif
+
+#endif
diff --git a/scripts/qtestxml2junitxml.xsl b/scripts/qtestxml2junitxml.xsl
new file mode 100644
index 0000000..aab2d0f
--- /dev/null
+++ b/scripts/qtestxml2junitxml.xsl
@@ -0,0 +1,82 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+<xsl:output method="xml" indent="yes" />
+<xsl:decimal-format decimal-separator="." grouping-separator="," />
+
+<!-- misc variables -->
+<xsl:variable name="classname" select="/TestCase/@name" />
+<xsl:variable name="total-tests" select="count(/TestCase/TestFunction)" />
+<xsl:variable name="total-failures" select="count(/TestCase/TestFunction/Incident[@type='fail'])" />
+
+<!-- main template call -->
+<xsl:template match="/">
+ <xsl:apply-templates select="TestCase"/>
+</xsl:template>
+
+<xsl:template match="TestCase">
+ <testsuite name="{$classname}" tests="{$total-tests}" failures="{$total-failures}" errors="0" time="0.0">
+ <xsl:apply-templates select="Environment"/>
+ <xsl:apply-templates select="TestFunction" />
+ <xsl:call-template name="display-system-out" />
+ <xsl:call-template name="display-system-err" />
+ </testsuite>
+</xsl:template>
+
+<xsl:template match="Environment">
+ <properties>
+ <xsl:for-each select="*">
+ <property name="{name()}" value="{text()}" />
+ </xsl:for-each>
+ </properties>
+</xsl:template>
+
+<xsl:template match="TestFunction">
+ <testcase classname="{$classname}" name="{@name}" time="0.0">
+ <!-- handle fail -->
+ <xsl:if test="Incident/@type = 'fail'">
+ <!-- will be used to generate "nice" error message -->
+ <xsl:variable name="file" select="Incident/@file" />
+ <xsl:variable name="line" select="Incident/@line" />
+ <xsl:variable name="description">
+ <xsl:value-of select="Incident/Description" />
+ </xsl:variable>
+
+ <!-- display a reasonable error message -->
+ <xsl:element name="failure">
+ <xsl:attribute name="type">Standard</xsl:attribute>
+ <xsl:attribute name="message">
+ <xsl:value-of select="concat($file,':',$line,' :: ',$description)" />
+ </xsl:attribute>
+ </xsl:element>
+
+ </xsl:if>
+
+ <!-- handle skip -->
+ <xsl:if test="Incident/@type = 'skip'">
+
+ </xsl:if>
+ </testcase>
+</xsl:template>
+
+<xsl:template name="display-system-out">
+ <system-out>
+ <xsl:for-each select="/TestCase/TestFunction/Incident[@type='fail'] | /TestCase/TestFunction/Message[@type='skip']">
+ <xsl:choose>
+ <xsl:when test="@type='fail'">
+ <xsl:value-of select="Description"/>
+ </xsl:when>
+ <xsl:when test="@type='skip'">
+ <xsl:value-of select="Description"/>
+ </xsl:when>
+ </xsl:choose>
+ </xsl:for-each>
+ </system-out>
+</xsl:template>
+
+<xsl:template name="display-system-err">
+ <!-- do nothing for now -->
+ <system-err />
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/scripts/storetest b/scripts/storetest
new file mode 100755
index 0000000..8153c07
--- /dev/null
+++ b/scripts/storetest
@@ -0,0 +1,75 @@
+#!/bin/sh
+
+STORETESTRESULTS=storetestresults
+
+if ! command -v $STORETESTRESULTS 2&>1 > /dev/null; then
+ STORETESTRESULTS=`dirname $0`/$STORETESTRESULTS
+ if ! [ -e $STORETESTRESULTS ]; then
+ echo $STORETESTRESULTS not found
+ exit 1
+ fi
+fi
+
+echo -n "Test platform [$QTUITEST_PLATFORM] : "
+read TESTPLATFORM
+if [ "$TESTPLATFORM" = "" ]; then
+ TESTPLATFORM=$QTUITEST_PLATFORM
+fi
+case "$TESTPLATFORM" in *symbian*|*linux*|*maemo*|*windows*|*wince*|*mac*)
+ ;;
+*)
+ echo Test platform must contain one of symbian, linux, maemo, windows, wince, mac
+ exit 1
+ ;;
+esac
+
+echo -n "Change or build number [$QTUITEST_CHANGE] : "
+read TESTCHANGE
+if [ "$TESTCHANGE" = "" ]; then
+ if [ "$QTUITEST_CHANGE" = "" ]; then
+ echo Change or build number must be specified
+ exit 1
+ fi
+ TESTCHANGE=$QTUITEST_CHANGE
+fi
+
+echo -n "Branch [$QTUITEST_BRANCH] : "
+read TESTBRANCH
+if [ "$TESTBRANCH" = "" ]; then
+ if [ "$QTUITEST_BRANCH" = "" ]; then
+ echo Branch must be specified
+ exit 1
+ fi
+ TESTBRANCH=$QTUITEST_BRANCH
+fi
+
+if [ "$QTUITEST_TESTR" = "" ]; then
+ QTUITEST_TESTR=qt@gitestr.nokia.troll.no:/home/qt/results
+fi
+echo -n "Upload location [$QTUITEST_TESTR] : "
+read TESTTESTR
+if [ "$TESTTESTR" = "" ]; then
+ TESTTESTR=$QTUITEST_TESTR
+fi
+
+TIMESTAMP=`date +%s`
+TESTNAME=`basename $BUILDDIR`
+RESULTSDIR=/tmp/qtuitest_results_$TIMESTAMP
+mkdir $RESULTSDIR
+TESTPLATFORM=$TESTPLATFORM PATH=$BUILDDIR:$PATH QTUITEST_INCLUDE_PATH=$SRCROOT/tests/shared:$QTUITEST_INCLUDE_PATH LD_LIBRARY_PATH=$BUILDROOT/libqsystemtest:$BUILDROOT/lib:$LD_LIBRARY_PATH $BUILDROOT/interpreter/qtuitestrunner $* -xml -o $RESULTSDIR/$TESTNAME.xml
+
+if [ -e $RESULTSDIR/$TESTNAME.xml ]; then
+ echo Results are in $RESULTSDIR/$TESTNAME.xml
+else
+ echo Results are not in expected location!
+ exit 1
+fi
+
+$STORETESTRESULTS -in $RESULTSDIR -number $TIMESTAMP -testr $TESTTESTR -prefix $TESTPLATFORM -testrchange $TESTCHANGE -testrbranch $TESTBRANCH
+if [ $? != "0" ]; then
+ echo FAILED: Please check you have entered the correct details.
+ echo You can retry sending the results using the scp command above
+ exit 1
+else
+ echo OK
+fi \ No newline at end of file
diff --git a/scripts/storetestresults b/scripts/storetestresults
new file mode 100755
index 0000000..a834431
--- /dev/null
+++ b/scripts/storetestresults
Binary files differ
diff --git a/symbian/qtuitest.pro b/symbian/qtuitest.pro
new file mode 100644
index 0000000..31e51c6
--- /dev/null
+++ b/symbian/qtuitest.pro
@@ -0,0 +1,20 @@
+# Use subdirs template to suppress generation of unnecessary files
+TEMPLATE = subdirs
+
+symbian: {
+ load(data_caging_paths)
+
+ SUBDIRS=
+ TARGET = "QtUiTest"
+
+ qtresources.sources = $${EPOCROOT}$$HW_ZDIR$$APP_RESOURCE_DIR/s60main.rsc
+ qtresources.path = $$APP_RESOURCE_DIR
+
+ qtuitest.sources = qtwidgets.dll
+ qtuitest.path = /sys/bin
+
+ style_plugins.sources = qtuiteststyle.dll
+ style_plugins.path = $$QT_PLUGINS_BASE_DIR/styles
+
+ DEPLOYMENT += qtuitest style_plugins
+}
diff --git a/symbian/scripts/startProcess.bat b/symbian/scripts/startProcess.bat
new file mode 100644
index 0000000..abe33f8
--- /dev/null
+++ b/symbian/scripts/startProcess.bat
@@ -0,0 +1,44 @@
+@rem = '--*-Perl-*--
+@echo off
+if "%OS%" == "Windows_NT" goto WinNT
+perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
+goto endofperl
+:WinNT
+perl -x -S %0 %*
+if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
+if %errorlevel% == 9009 echo You do not have Perl in your PATH.
+if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
+goto endofperl
+@rem ';
+#!perl
+#line 15
+use SOAP::Lite;
+
+$wsdl = $ENV{HTI_WSDL} or die("HTI_WSDL not set");
+$htiSystem = SOAP::Lite->service("file:$wsdl/HtiSystem.wsdl");
+$htiEcho = SOAP::Lite->service("file:$wsdl/HtiEcho.wsdl");
+$htiSysInfo = SOAP::Lite->service("file:$wsdl/HtiSysInfo.wsdl");
+$htiApplication = SOAP::Lite->service("file:$wsdl/HtiApplication.wsdl");
+
+$process = shift @ARGV or die "ERROR: Process name not specified";
+$args = join " ", @ARGV;
+
+# Authenticate - doesn't matter what the token is but HTI won't work otherwise
+$htiSystem->authentication("hello");
+
+# HTI connectivity check
+$htiEcho->echo("Connected to device...");
+
+# Toggle key lock. This also ensures display is visible.
+$htiSysInfo->keyLockToggle(1,0);
+$htiSysInfo->keyLockToggle(0,0);
+
+# Start process
+$result = $htiApplication->startProcess($process, "-style qtuitest $args");
+$pid = $$result{"pid"};
+
+sleep(5);
+print "$pid\n";
+
+__END__
+:endofperl
diff --git a/symbian/scripts/stopProcess.bat b/symbian/scripts/stopProcess.bat
new file mode 100644
index 0000000..727be66
--- /dev/null
+++ b/symbian/scripts/stopProcess.bat
@@ -0,0 +1,37 @@
+@rem = '--*-Perl-*--
+@echo off
+if "%OS%" == "Windows_NT" goto WinNT
+perl -x -S "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9
+goto endofperl
+:WinNT
+perl -x -S %0 %*
+if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endofperl
+if %errorlevel% == 9009 echo You do not have Perl in your PATH.
+if errorlevel 1 goto script_failed_so_exit_with_non_zero_val 2>nul
+goto endofperl
+@rem ';
+#!perl
+#line 15
+use SOAP::Lite;
+
+$wsdl = $ENV{HTI_WSDL} or die("HTI_WSDL not set");
+$htiSystem = SOAP::Lite->service("file:$wsdl/HtiSystem.wsdl");
+$htiEcho = SOAP::Lite->service("file:$wsdl/HtiEcho.wsdl");
+$htiSysInfo = SOAP::Lite->service("file:$wsdl/HtiSysInfo.wsdl");
+$htiApplication = SOAP::Lite->service("file:$wsdl/HtiApplication.wsdl");
+
+$proc = shift @ARGV or die "ERROR: Process not specified";
+
+# Authenticate - doesn't matter what the token is but HTI won't work otherwise
+print $htiSystem->authentication("hello");
+
+# HTI connectivity check
+print $htiEcho->echo("Connected to device...");
+
+# Start process
+#$result = $htiApplication->stopProcessById($proc);
+$result = $htiApplication->stopApp($proc);
+
+sleep(2);
+__END__
+:endofperl
diff --git a/tests/qtuitest/qtuitest.pro b/tests/qtuitest/qtuitest.pro
new file mode 100644
index 0000000..f1dbaa4
--- /dev/null
+++ b/tests/qtuitest/qtuitest.pro
@@ -0,0 +1,33 @@
+TEMPLATE=subdirs
+SUBDIRS+= \
+ testapps \
+ sys_input \
+ sys_assistant \
+ sys_designer \
+ sys_graphicsView \
+ sys_linguist \
+ tst_qalternatestack \
+ tst_qelapsedtimer \
+ tst_qinputgenerator \
+ tst_qtuitestnamespace
+
+# Tests which should run in Pulse (currently, those which do not require X server)
+PULSE_TESTS = \
+ tst_qalternatestack \
+ tst_qelapsedtimer \
+ tst_qtestprotocol \
+
+!win32 {
+ SUBDIRS+=tst_qtestprotocol tst_qtuitestwidgets
+}
+
+symbian {
+ SUBDIRS-=tst_qalternatestack tst_qtestprotocol tst_qtuitestwidgets
+}
+
+pulsetest.CONFIG = recursive
+pulsetest.recurse = $$PULSE_TESTS
+pulsetest.target = pulsetest
+pulsetest.recurse_target = junittest
+QMAKE_EXTRA_TARGETS += pulsetest
+
diff --git a/tests/qtuitest/sys_assistant/sys_assistant.js b/tests/qtuitest/sys_assistant/sys_assistant.js
new file mode 100644
index 0000000..f2449d4
--- /dev/null
+++ b/tests/qtuitest/sys_assistant/sys_assistant.js
@@ -0,0 +1,231 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+testcase = {
+
+ //TODO: In Progress. Not expected to pass (or even work correctly) yet.
+
+ init: function() {
+ startApplication("assistant");
+ if (getLabels().contains("Updating search index")) {
+ print("Waiting for search index update to complete...");
+ waitFor(60000) {
+ return (!getLabels().contains("Updating search index"));
+ }
+ }
+ },
+
+ check_registered_docs: function() {
+ select("Edit/Preferences...", menuBar());
+ select("Documentation", tabBar());
+ setLabelOrientation(LabelAbove);
+ var docs = getText("Registered Documentation:");
+ if (!docs.contains("com.trolltech.assistant.") ||
+ !docs.contains("com.trolltech.designer.") ||
+ !docs.contains("com.trolltech.linguist.") ||
+ !docs.contains("com.trolltech.qmake.") ||
+ !docs.contains("com.trolltech.qt.")) {
+ fail("Documentation has not been registered. Subsequent tests will fail.");
+ }
+ },
+
+ browse_contents: function() {
+ select("Contents", tabBar());
+ var content = helpContent();
+
+ select("Qt Linguist Manual/Manual", content);
+ waitFor() { return(getText(tabBar(1)).contains("Qt Linguist Manual")); }
+
+ select("Qt Reference Documentation/Overviews/An Introduction to Model\\/View Programming", content);
+ waitFor() { return(getText(tabBar(1)).contains("An Introduction to Model/View Programming")); }
+
+ select("Qt Reference Documentation/Classes/QList Class Reference/List of all members", content);
+ waitFor() { return(getText(tabBar(1)).contains("List of All Members for QList")); }
+ },
+
+ browse_index_data: {
+ countryToString: [ "countryToString", "QLocale Class Reference" ]
+ },
+
+ browse_index: function(item, pageTitle) {
+ select("Index", tabBar());
+ var indexWidget = helpIndex();
+
+ select(item, indexWidget);
+ select("Open Link", contextMenu());
+ waitFor() { return(getText(tabBar(1)).contains(pageTitle)); }
+ },
+
+ create_bookmark_data: {
+ one: [ "sys_assistant", "test_subfolder" ]
+ },
+
+ create_bookmark: function(topLevelFolder, subFolder) {
+ select("Bookmarks", tabBar());
+ var bookmarkTree = helpBookmarks();
+
+ // If there is already a folder with the same name, remove it
+ if (getList(bookmarkTree).contains(topLevelFolder)) {
+ select(topLevelFolder, bookmarkTree);
+ select("Bookmarks/Remove");
+ select("Yes");
+ }
+
+ // Create a new bookmark
+ select("Bookmarks/Add");
+ var pageName = getText("Bookmark:").replace(/\//g, "\\\\/");;
+ select("+");
+ select("New Folder");
+ select("Rename Folder", contextMenu());
+ enter(topLevelFolder);
+ select("New Folder");
+ select("Rename Folder", contextMenu());
+ enter(subFolder);
+ select("OK");
+
+ // Verify that it is in the list
+ var bookmarkList = getList(bookmarkTree);
+ verify(bookmarkList.contains(topLevelFolder));
+ verify(bookmarkList.contains(topLevelFolder + "/" + subFolder));
+ verify(bookmarkList.contains(topLevelFolder + "/" + subFolder + "/" + pageName));
+
+ // Remove it
+ select(topLevelFolder, bookmarkTree);
+ select("Bookmarks/Remove");
+ select("Yes");
+
+ // Verify that it is no longer in the list
+ var bookmarkList = getList(bookmarkTree);
+ verify(!bookmarkList.contains(topLevelFolder));
+ verify(!bookmarkList.contains(topLevelFolder + "/" + subFolder));
+ verify(!bookmarkList.contains(topLevelFolder + "/" + subFolder + "/" + pageName));
+ },
+
+ search_data: {
+ simpleText: [ "Simple Text", "Simple Text Viewer Example" ],
+ designerWidgets: [ "Designer Widgets", "Creating Custom Widgets for Qt Designer" ],
+ includePath: [ "INCLUDEPATH", "qmake Variable Reference" ]
+ },
+
+ search: function(query, expectedResult) {
+ select("View/Search", menuBar());
+ select("Search", tabBar(1));
+ enter(query, "Search for:");
+ select("Search");
+ var results = searchResults();
+ waitFor() { return(getText(results).contains(expectedResult)); }
+ select(expectedResult, results);
+ waitFor() { return(getText(tabBar(1)).contains(expectedResult)); }
+ verify(getText(helpViewer()).contains(expectedResult));
+ },
+
+ follow_links_data: {
+ one: [ "Qt Reference Documentation/Overviews/View Classes", "View Classes",
+ [ ["delegates", "Delegate Classes"],
+ ["Spin Box Delegate", "Spin Box Delegate Example"],
+ ["QItemDelegate", "QItemDelegate Class Reference"],
+ ["QSqlRelationalDelegate","QSqlRelationalDelegate Class Reference"] ] ]
+ },
+
+ follow_links: function(browseItem, firstTitle, links) {
+
+ // Select browseItem from the Contents
+ select("Contents", tabBar());
+ var content = helpContent();
+ select(browseItem, content);
+ waitFor() { return(getText(tabBar(1)).contains(firstTitle)); }
+
+ // Get a handle for the Help Viewer widget
+ var viewer = helpViewer(); //findByProperty( { inherits: "QWebView" } );
+
+ // Click on each link in turn
+ for (var i=0; i<links.length; ++i) {
+ select(links[i][0], viewer);
+ waitFor() { return(getText(tabBar(1)).contains(links[i][1])); }
+ }
+
+ // Now navigate back...
+ for (var i=links.length-1; i>=0; --i) {
+ verify(getText(tabBar(1)).contains(links[i][1]));
+ select("Back");
+ }
+
+ // ... and confirm that we're back to the first page
+ verify(getText(tabBar(1)).contains(firstTitle));
+ }
+
+}
+
+function contextMenu()
+{
+ keyClick(Qt.Key_Menu);
+ var menu = findByProperty( { inherits: "QMenu" } );
+ if (menu.isEmpty()) {
+ fail("Context menu did not appear.");
+ }
+ return menu[0];
+}
+
+function helpViewer()
+{
+ return findByProperty( { className: "HelpViewer" } );
+}
+
+function helpContent()
+{
+ return findByProperty( { className: "QHelpContentWidget" } );
+}
+
+function helpIndex()
+{
+ return findByProperty( { className: "QHelpIndexWidget" } );
+}
+
+function helpBookmarks()
+{
+ return findByProperty( { child_of: "Bookmarks", inherits: "QTreeView" } );
+}
+
+function searchResults()
+{
+ return findByProperty( { className: "QCLuceneResultWidget" } );
+}
diff --git a/tests/qtuitest/sys_assistant/sys_assistant.pro b/tests/qtuitest/sys_assistant/sys_assistant.pro
new file mode 100644
index 0000000..8d30486
--- /dev/null
+++ b/tests/qtuitest/sys_assistant/sys_assistant.pro
@@ -0,0 +1,2 @@
+SOURCES=sys_assistant.js
+CONFIG+=systemtest
diff --git a/tests/qtuitest/sys_designer/sys_designer.js b/tests/qtuitest/sys_designer/sys_designer.js
new file mode 100644
index 0000000..7defc99
--- /dev/null
+++ b/tests/qtuitest/sys_designer/sys_designer.js
@@ -0,0 +1,419 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+testcase = {
+
+ //TODO: In Progress. Not expected to pass (or even work correctly) yet.
+
+ init: function() {
+ clearCachedWidgets();
+ startApplication("designer");
+
+ if (currentTitle() == translate("QDesignerWorkbench", "Backup Information")) {
+ select(translate("QDialogButtonBox", "&No"));
+ }
+
+ select("Widgets/QFrame");
+ select("Create");
+
+ select("Expand all", contextMenu(widgetBoxTree()));
+ select("List View", contextMenu(widgetBoxTree()));
+ },
+
+ test1: function() {
+ var fc = getGeometry(formWindow()).center();
+
+ // Create a form layout and add some rows to it...
+ dragItem("Layouts/Form Layout", widgetBoxTree(), fc);
+
+ select("Frame/formLayout", objectInspector());
+ select("Add form layout row...", contextMenu());
+ enter("LineEdit1", "Label text:");
+ select("QLineEdit", "Field type:");
+ select("OK");
+
+ select("Frame/formLayout", objectInspector());
+ select("Add form layout row...", contextMenu());
+ enter("ComboBox1", "Label text:");
+ select("QComboBox", "Field type:");
+ select("OK");
+
+ // Set the available items in the combobox...
+ select("Edit Items...", contextMenu("ComboBox1"));
+ select("New");
+ enter("One");
+ select("New");
+ enter("Two");
+ select("New");
+ enter("Three");
+ select("New");
+ enter("Four");
+ select("New");
+ enter("Five");
+ select("OK");
+
+ // Edit signal/slot connections using the interactive editor...
+ select("Edit/Edit Signals\\/Slots", mainMenuBar());
+
+ // The labels don't seem to have buddy widgets set, although they are set
+ // correctly when previewed. So the combobox ends up being self-labelled
+ drag(getGeometry("One").center(), getGeometry("LineEdit1").center());
+ var sigSlotList = findByProperty( { className: "QListWidget" } );
+ select("activated(QString)", sigSlotList[0]);
+ select("setText(QString)", sigSlotList[1]);
+ select("OK");
+
+ // Preview, ensure that changing the combobox value also changes the lineedit value...
+ select("Form/Preview...", mainMenuBar());
+
+ select("Three", "ComboBox1");
+ compare(getText("LineEdit1"), "Three");
+ },
+
+ test2: function() {
+ // Add some radio buttons to the form...
+ var fc = getGeometry(formWindow()).center();
+ dragItem("Buttons/Radio Button", widgetBoxTree(), fc);
+ dragItem("Buttons/Radio Button", widgetBoxTree(), fc);
+ dragItem("Buttons/Radio Button", widgetBoxTree(), fc);
+ dragItem("Buttons/Radio Button", widgetBoxTree(), fc);
+
+ // Set widget properties...
+ select("Frame/radioButton", objectInspector());
+ selectProperty("QAbstractButton/text");
+ enter("Radio 1");
+
+ select("Frame/radioButton_2", objectInspector());
+ selectProperty("QAbstractButton/text");
+ enter("Radio 2");
+
+ select("Frame/radioButton_3", objectInspector());
+ selectProperty("QAbstractButton/text");
+ enter("Radio 3");
+
+ select("Frame/radioButton_4", objectInspector());
+ selectProperty("QAbstractButton/text");
+ enter("Radio 4");
+
+ // Set layout...
+ select("Edit/Select All", mainMenuBar());
+ select("Assign to button group/New button group", contextMenu("Radio 1"));
+ select("Form/Lay Out Vertically", mainMenuBar());
+
+ // Preview, to ensure only one radio button can be active at a time...
+ select("Form/Preview...", mainMenuBar());
+
+ setChecked(true, "Radio 1");
+ verify(!isChecked("Radio 2"));
+ verify(!isChecked("Radio 3"));
+ verify(!isChecked("Radio 4"));
+
+ setChecked(true, "Radio 2");
+ verify(!isChecked("Radio 1"));
+ verify(!isChecked("Radio 3"));
+ verify(!isChecked("Radio 4"));
+
+ setChecked(true, "Radio 3");
+ verify(!isChecked("Radio 1"));
+ verify(!isChecked("Radio 2"));
+ verify(!isChecked("Radio 4"));
+
+ setChecked(true, "Radio 4");
+ verify(!isChecked("Radio 1"));
+ verify(!isChecked("Radio 2"));
+ verify(!isChecked("Radio 3"));
+
+ // Close the preview window...
+ invokeMethod(activeWindow(), "close()");
+
+ // Change the exclusive property of the button group...
+ select("Frame/buttonGroup", objectInspector());
+ selectProperty("QButtonGroup/exclusive");
+ setChecked(false);
+
+ // Preview, ensure that all buttons can be set at once...
+ select("Form/Preview...", mainMenuBar());
+
+ setChecked(true, "Radio 1");
+ setChecked(true, "Radio 2");
+ setChecked(true, "Radio 3");
+ setChecked(true, "Radio 4");
+ verify(isChecked("Radio 1"));
+ verify(isChecked("Radio 2"));
+ verify(isChecked("Radio 3"));
+ verify(isChecked("Radio 4"));
+ },
+
+ test3: function() {
+ var fc = getGeometry(formWindow()).center();
+
+ // Add some widgets to the form...
+ dragItem("Input Widgets/Line Edit", widgetBoxTree(), new QPoint(fc.x()+30, fc.y()-20));
+ dragItem("Input Widgets/Spin Box", widgetBoxTree(), new QPoint(fc.x()-30, fc.y()+20));
+ dragItem("Display Widgets/Label", widgetBoxTree(), new QPoint(fc.x()-30, fc.y()-20));
+ dragItem("Display Widgets/Label", widgetBoxTree(), new QPoint(fc.x()+30, fc.y()+20));
+ dragItem("Buttons/Push Button", widgetBoxTree(), new QPoint(fc.x()-30, fc.y()+40));
+ dragItem("Buttons/Push Button", widgetBoxTree(), new QPoint(fc.x()+30, fc.y()+40));
+
+ select("Edit/Select All", mainMenuBar());
+ select("Form/Lay Out in a Grid", mainMenuBar());
+
+ // Set widget properties...
+ select("Frame/gridLayout/label", objectInspector());
+ selectProperty("QLabel/text");
+ enter("LineEdit1");
+
+ select("Frame/gridLayout/label_2", objectInspector());
+ selectProperty("QLabel/text");
+ enter("SpinBox1");
+
+ select("Frame/gridLayout/pushButton", objectInspector());
+ selectProperty("QAbstractButton/text");
+ enter("Down");
+
+ select("Frame/gridLayout/pushButton_2", objectInspector());
+ selectProperty("QAbstractButton/text");
+ enter("Up");
+
+ select("Frame/gridLayout/spinBox", objectInspector());
+ selectProperty("QSpinBox/maximum");
+ enter(100);
+
+ selectProperty("QAbstractSpinBox/specialValueText");
+ enter("Infinity");
+
+ // Set buddies...
+ select("Edit/Edit Buddies", mainMenuBar());
+ drag(getGeometry(findByProperty( { text: "LineEdit1" } )).center(), getGeometry(findByProperty( { className: "QLineEdit"} )).center());
+ drag(getGeometry(findByProperty( { text: "SpinBox1" } )).center(), getGeometry(findByProperty( { className: "QSpinBox"} )).center());
+
+ // Set up signal/slot connections...
+ connectSignalSlot("spinBox", "valueChanged(QString)", "lineEdit", "setText(QString)");
+ connectSignalSlot("pushButton", "clicked()", "spinBox", "stepDown()")
+ connectSignalSlot("pushButton_2", "clicked()","spinBox" , "stepUp()");
+
+ // Preview the form, and make sure it behaves as expected...
+ select("Form/Preview...", mainMenuBar());
+
+ enter(50, "SpinBox1");
+ compare(50, getText("LineEdit1"));
+
+ for (var i=0; i<8; ++i) {
+ select("Down");
+ }
+ compare(42, getText("LineEdit1"));
+
+ enter(5, "SpinBox1");
+ compare(5, getText("LineEdit1"));
+
+ for (var i=0; i<4; ++i) {
+ select("Down");
+ }
+ compare(1, getText("LineEdit1"));
+ select("Down");
+ compare("Infinity", getText("LineEdit1"));
+ select("Down");
+ compare("Infinity", getText("LineEdit1"));
+
+ enter(95, "SpinBox1");
+ compare(95, getText("LineEdit1"));
+
+ for (var i=0; i<4; ++i) {
+ select("Up");
+ }
+ compare(99, getText("LineEdit1"));
+ select("Up");
+ compare(100, getText("LineEdit1"));
+ select("Up");
+ compare(100, getText("LineEdit1"));
+
+ enter("Goodbye", "LineEdit1");
+ compare(100, getText("SpinBox1"));
+ }
+
+}
+
+function dragItem(item, widget, point)
+{
+ ensureVisible(item, widget);
+ var center = getCenter(item, widget);
+ drag(center, point);
+}
+
+function drag(a, b)
+{
+ var dx = (b.x() - a.x());
+ var dy = (b.y() - a.y());
+ var steps = 2 + (Math.abs(dx) + Math.abs(dy))/20;
+ dx = dx/steps;
+ dy = dy/steps;
+ var x=a.x();
+ var y=a.y();
+ mousePress(x, y);
+ wait(200);
+ for (var i=0; i<steps; i++) {
+ x += dx;
+ y += dy;
+ mousePress(x, y);
+ wait(1);
+ }
+ mousePress(b.x(), b.y());
+ wait(50);
+ mouseRelease(b.x(), b.y());
+ wait(500);
+}
+
+function clearCachedWidgets()
+{
+ testcase.cachedWidgets = {};
+}
+
+function formWindow()
+{
+ return findByProperty( { className: "QDesignerFormWindow" } );
+}
+
+function propertyEditor()
+{
+ selectDockedWindow("Property Editor");
+ if (testcase.cachedWidgets.propertyEditor == undefined) {
+ testcase.cachedWidgets.propertyEditor = findByProperty( { className: "QtPropertyEditorView" } );
+ }
+ return testcase.cachedWidgets.propertyEditor;
+}
+
+function widgetBoxTree()
+{
+ selectDockedWindow("Qt Designer");
+ if (testcase.cachedWidgets.widgetBoxTree == undefined) {
+ testcase.cachedWidgets.widgetBoxTree = findByProperty( { className: "qdesigner_internal::WidgetBoxTreeWidget" } );
+ }
+ return testcase.cachedWidgets.widgetBoxTree;
+}
+
+function objectInspector()
+{
+ selectDockedWindow("Object Inspector");
+ if (testcase.cachedWidgets.objectInspector == undefined) {
+ testcase.cachedWidgets.objectInspector = findByProperty( { descendant_of: "Object Inspector", inherits: "QTreeView"} );
+ }
+ return testcase.cachedWidgets.objectInspector;
+}
+
+function signalSlotEditor()
+{
+ selectDockedWindow("Signal/Slot Editor");
+ if (testcase.cachedWidgets.signalSlotEditor == undefined) {
+ testcase.cachedWidgets.signalSlotEditor = findByProperty( { className: "qdesigner_internal::SignalSlotEditorWindow"} );
+ }
+ return testcase.cachedWidgets.signalSlotEditor;
+}
+
+function mainMenuBar()
+{
+ activateWindow("Qt Designer");
+ if (testcase.cachedWidgets.menuBar == undefined) {
+ testcase.cachedWidgets.menuBar = menuBar();
+ }
+ return testcase.cachedWidgets.menuBar;
+}
+
+function contextMenu(widget)
+{
+ if (widget == undefined) {
+ keyClick(Qt.Key_Menu);
+ } else {
+ mouseClick(widget, new Qt.MouseButtons(Qt.RightButton));
+ }
+ var menu = findByProperty( { inherits: "QMenu" } );
+ if (menu.isEmpty()) {
+ fail("Context menu did not appear.");
+ }
+ return menu[0];
+}
+
+function selectDockedWindow(window)
+{
+ if (getWindowTitles().contains(window)) {
+ activateWindow(window);
+ } else {
+ var tb = tabBar();
+ if (getList(tb).contains(window)) {
+ select(window, tb);
+ }
+ }
+}
+
+function selectProperty(propName)
+{
+ var pe = propertyEditor();
+ select(propName, pe);
+ var idx = getSelectedIndex(pe);
+ idx[idx.length -1]++;
+ selectIndex(idx, pe);
+}
+
+function connectSignalSlot(sender, signal, receiver, slot)
+{
+ selectDockedWindow("Signal/Slot Editor");
+ if (currentTitle() == "Signal/Slot Editor") {
+ if (testcase.cachedWidgets.addConnect == undefined) {
+ testcase.cachedWidgets.addConnect = findByProperty( { className: "QToolButton" } )[0];
+ testcase.cachedWidgets.signalSlotView = findByProperty( { className: "QTreeView" } );
+ }
+ } else {
+ if (testcase.cachedWidgets.addConnect == undefined) {
+ testcase.cachedWidgets.addConnect = findByProperty( { descendant_of: "Signal/Slot Editor", className: "QToolButton" } )[0];
+ testcase.cachedWidgets.signalSlotView = findByProperty( { descendant_of: "Signal/Slot Editor", className: "QTreeView" } );
+ }
+ }
+
+ select(testcase.cachedWidgets.addConnect);
+ select("<sender>", testcase.cachedWidgets.signalSlotView);
+ enter(sender);
+ select("<signal>", testcase.cachedWidgets.signalSlotView);
+ enter(signal);
+ select("<receiver>", testcase.cachedWidgets.signalSlotView);
+ enter(receiver);
+ select("<slot>", testcase.cachedWidgets.signalSlotView);
+ enter(slot);
+} \ No newline at end of file
diff --git a/tests/qtuitest/sys_designer/sys_designer.pro b/tests/qtuitest/sys_designer/sys_designer.pro
new file mode 100644
index 0000000..8ceb9fb
--- /dev/null
+++ b/tests/qtuitest/sys_designer/sys_designer.pro
@@ -0,0 +1,2 @@
+SOURCES=sys_designer.js
+CONFIG+=systemtest
diff --git a/tests/qtuitest/sys_graphicsView/sys_graphicsView.js b/tests/qtuitest/sys_graphicsView/sys_graphicsView.js
new file mode 100644
index 0000000..9e23617
--- /dev/null
+++ b/tests/qtuitest/sys_graphicsView/sys_graphicsView.js
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+testcase = {
+
+ //TODO: In Progress. Not expected to pass (or even work correctly) yet.
+
+ launch_app: function() {
+ startApplication("graphicsViewTest");
+
+ print(getLabels());
+ verifyImage("test1", "here is some text");
+ verifyImage("test2", "and here is some more");
+ prompt(activeWidgetInfo());
+ }
+} \ No newline at end of file
diff --git a/tests/qtuitest/sys_graphicsView/sys_graphicsView.pro b/tests/qtuitest/sys_graphicsView/sys_graphicsView.pro
new file mode 100644
index 0000000..14ec53e
--- /dev/null
+++ b/tests/qtuitest/sys_graphicsView/sys_graphicsView.pro
@@ -0,0 +1,3 @@
+SOURCES=sys_graphicsView.js
+TESTAPPS=graphicsViewTest
+CONFIG+=systemtest
diff --git a/tests/qtuitest/sys_input/sys_input.js b/tests/qtuitest/sys_input/sys_input.js
new file mode 100644
index 0000000..5952c92
--- /dev/null
+++ b/tests/qtuitest/sys_input/sys_input.js
@@ -0,0 +1,343 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+testcase = {
+
+ activate_tabBar: function() {
+ startApplication("testapp1");
+
+ select( "First Tab", tabBar() );
+ compare( getSelectedText(tabBar()), "First Tab" );
+
+ select( "Cow Tab", tabBar() );
+ compare( getSelectedText(tabBar()), "Cow Tab" );
+
+ select( "First Tab", tabBar() );
+ compare( getSelectedText(tabBar()), "First Tab" );
+
+ select( "Awesome Tab", tabBar() );
+ compare( getSelectedText(tabBar()), "Awesome Tab" );
+ },
+
+ enter_single_data: {
+ numeric: "0",
+ asterisk: "*",
+ percent: "%",
+ question: "?",
+ comma: ",",
+ lower1: "a",
+ upper: "B",
+ lower2: "z"
+ },
+
+ enter_single: function(character) {
+ startApplication("testapp1");
+ select( "First Tab", tabBar() );
+ enter(character, "Status");
+ compare(getText("Status"), character);
+
+ },
+
+ enter_text: function(text) {
+ startApplication("testapp1");
+
+ select( "First Tab", tabBar() );
+ enter(text, "LineEdit1");
+ compare( getText("Status"), "LineEdit1 text changed" );
+ compare( getText("LineEdit1"), text );
+
+ enter("clear", "LineEdit2");
+ compare( getText("Status"), "LineEdit2 text changed" );
+ compare( getText("LineEdit2"), "clear" );
+
+ // test that we can erase the whole string when the cursor isn't at the end by hitting the home key to get to the front
+ if (mousePreferred()) {
+ mouseClick("LineEdit1"); keyClick(Qt.Key_Home); mouseClick("LineEdit2");
+ }
+ enter("overwrite", "LineEdit1");
+ compare( getText("LineEdit1"), "overwrite" );
+ },
+
+ enter_text_data: {
+ mixed_case: [ "MiXeD CASe" ],
+ punctuation: [ "!@#$%^&*()-=_+[]{}\|;:',./<>?`~" ],
+ allsorts: [ "$100! How Much?" ],
+ with_numbers: [ "1 2 3SD770 4 25 312" ],
+ in_dict: [ "hello kitty" ],
+ not_in_dict: [ "jtnerlnjas mtrnen" ],
+ long_str: [ "this is a really long string to test we can overwrite properly" ],
+
+ // Test for bug: "Jimmy" sometimes gives "Jinny" in predictive keyboard.
+ jimmy: [ "Jimmy jimmy" ]
+ },
+
+ enter_QTextEdit: function(text) {
+ startApplication("testapp3");
+
+ select("Text", tabBar());
+
+ enter(text, "Text");
+ compare( getText("Text"), text );
+
+ enter("overwrite", "Text");
+ compare( getText("Text"), "overwrite" );
+ },
+
+ enter_QTextEdit_data: {
+ single_line: [ "This is a single line" ],
+ //multi_lines: [ "This is\nmultiple lines of\n\ntext" ]
+ alotta_text: [ "This is a lot of text to ensure we get a scroll bar happening yes this is a lot of text to ensure we get a scroll bar happening yes" ]
+ },
+
+ enter_QTimeEdit: function(time, shouldPass) {
+ startApplication("testapp1");
+
+ select("Awesome Tab", tabBar());
+
+ if (!shouldPass) expectFail("Bad time given");
+ enter(time, "Time");
+
+ compare( getValue("Time"), time );
+ },
+
+ enter_QTimeEdit_data: {
+ simple1: [ new QTime(16, 55, 00), true ],
+ simple2: [ new QTime(14, 10, 38), true ],
+ sdigit1: [ new QTime(1, 33, 10), true ],
+ sdigit2: [ new QTime(19, 7, 11), true ],
+ sdigit3: [ new QTime(22, 21, 1), true ],
+
+ bad1: [ new QTime(25, 21, 1), false ],
+ bad2: [ new QTime(22, 88, 1), false ],
+ bad3: [ new QTime(21, 21, -1), false ]
+ },
+
+ // enter() with QDateEdit fields.
+ enter_QDateEdit: function(date) {
+ startApplication("testapp1");
+
+ select("Awesome Tab", tabBar());
+
+ enter(date, "Date");
+
+ compare( getValue("Date"), date );
+
+ },
+
+ enter_QDateEdit_data: {
+ simple1: [ new Date(2000, 6, 15) ],
+ december: [ new Date(2000, 12, 15) ],
+ end_of_month: [ new Date(2002, 6, 30) ],
+ simple2: [ new Date(2004, 10, 11) ]
+ },
+
+ // Explicit mouse clicks on widgets
+ mouseClick: function() {
+ startApplication("testapp1");
+ select( "Cow Tab", tabBar() );
+ compare( getSelectedText(tabBar()), "Cow Tab" );
+
+ mouseClick("CowButton1");
+ compare( getText("CowStatus"), "CowButton1 clicked" );
+
+ mouseClick("CowButton2");
+ compare( getText("CowStatus"), "CowButton2 clicked" );
+
+ mouseClick("CowButton16");
+ compare( getText("CowStatus"), "CowButton16 clicked" );
+
+ mouseClick("CowButton0");
+ compare( getText("CowStatus"), "CowButton0 clicked" );
+ },
+
+ activate_button: function() {
+ startApplication("testapp1");
+
+ select("First Tab", tabBar());
+ compare( getSelectedText(tabBar()), "First Tab" );
+
+ select("Button1");
+ compare( getText("Status"), "Button1 clicked" );
+ select("Button2");
+ compare( getText("Status"), "Button2 clicked" );
+ },
+
+ activate_combobox: function() {
+ startApplication("testapp1");
+
+ select( "Cow Tab", tabBar() );
+
+ select( "Woof", "Cow Goes?" );
+ compare( getText("CowStatus"), "Cow Goes? changed" );
+ compare( getSelectedText("Cow Goes?"), "Woof" );
+
+ // To clear 'Status'
+ select( "CowButton0" );
+ compare( getText("CowStatus"), "CowButton0 clicked" );
+
+ select( "Moo", "Cow Goes?" );
+ compare( getText("CowStatus"), "Cow Goes? changed" );
+ compare( getSelectedText("Cow Goes?"), "Moo" );
+ },
+
+ activate_editable_combobox: function() {
+ startApplication("testapp1");
+
+ select( "First Tab", tabBar() );
+
+ select( "Yellow", "Colour" );
+ compare( getText("Status"), "Colour changed" );
+ compare( getSelectedText("Colour"), "Yellow" );
+
+ // To clear 'Status'
+ select("Button1");
+ compare( getText("Status"), "Button1 clicked" );
+
+ select( "Blue", "Colour" );
+ compare( getText("Status"), "Colour changed" );
+ compare( getSelectedText("Colour"), "Blue" );
+ },
+
+ scroll_scrollarea_vertical: function() {
+ startApplication("testapp1");
+
+ select( "Cow Tab", tabBar() );
+
+ select( "CowButton0" );
+ compare( getText("CowStatus"), "CowButton0 clicked" );
+
+ // Scroll down to the bottom
+ select( "CowButton15" );
+ compare( getText("CowStatus"), "CowButton15 clicked" );
+
+ // Scroll up to the top
+ select( "CowButton0" );
+ compare( getText("CowStatus"), "CowButton0 clicked" );
+ },
+
+ scroll_combobox: function() {
+ startApplication("testapp1");
+
+ select( "Cow Tab", tabBar() );
+
+ select( "Woof", "Cow Goes?" );
+ compare( getText("CowStatus"), "Cow Goes? changed" );
+ compare( getSelectedText("Cow Goes?"), "Woof" );
+
+ // This item is the last one in the combobox
+ select( "Choo choo!", "Cow Goes?" );
+ compare( getText("CowStatus"), "Cow Goes? changed" );
+ compare( getSelectedText("Cow Goes?"), "Choo choo!" );
+ },
+
+ setChecked_checkbox: function() {
+ startApplication("testapp1");
+
+ select( "Awesome Tab", tabBar() );
+
+ select( "Clear" );
+ compare( getText("Status"), "'Clear' clicked" );
+
+ setChecked( true, "Checkbox" );
+ compare( getText("Status"), "'Checkbox' clicked" );
+ verify( isChecked("Checkbox") );
+
+ select( "Clear" );
+ compare( getText("Status"), "'Clear' clicked" );
+
+ setChecked( false, "Checkbox" );
+ compare( getText("Status"), "'Checkbox' clicked" );
+ verify( !isChecked("Checkbox") );
+
+ select( "Clear" );
+ compare( getText("Status"), "'Clear' clicked" );
+
+ setChecked( true, "Checkbox" );
+ compare( getText("Status"), "'Checkbox' clicked" );
+ verify( isChecked("Checkbox") );
+ },
+
+ select_groupbox_subitem: function() {
+ startApplication("testapp2");
+
+ setChecked(true, "Checkable");
+ select("Checkable/Groupie");
+ compare("'Groupie' clicked", getText("Status"));
+
+ setChecked(false, "Checkable");
+ expectFail("Can't select disabled button");
+ select("Checkable/Groupie");
+ },
+
+ select_from_popup: function() {
+ startApplication("testapp2");
+ select( "Tab Two", tabBar() );
+
+ select("Popup");
+ select("&No");
+ compare("No", getText("Popup response"));
+
+ select("Popup");
+ select("&Yes");
+ compare("Yes", getText("Popup response"));
+ },
+
+ enter_invisible: function() {
+ startApplication("testapp2");
+ select( "Tab Two", tabBar() );
+
+ setChecked(true, "Checkbox");
+ enter("hello world", "Silly 1");
+
+ setChecked(false, "Checkbox");
+ expectFail("Can't enter text into non-visible widget");
+ enter("hello again world", "Silly 2");
+ },
+
+ select_menu: function() {
+ startApplication("testapp2");
+ select( "Tab Free", tabBar() );
+
+ select("Menu Item #3", "Menu");
+ compare("Menu Item #3", getText("Menu"));
+ }
+}
diff --git a/tests/qtuitest/sys_input/sys_input.pro b/tests/qtuitest/sys_input/sys_input.pro
new file mode 100644
index 0000000..55f9413
--- /dev/null
+++ b/tests/qtuitest/sys_input/sys_input.pro
@@ -0,0 +1,3 @@
+SOURCES=sys_input.js
+TESTAPPS=testapp1 testapp2 testapp3
+CONFIG+=systemtest
diff --git a/tests/qtuitest/sys_input/testdata/enter_invisible/failure_.png b/tests/qtuitest/sys_input/testdata/enter_invisible/failure_.png
new file mode 100644
index 0000000..73cde9b
--- /dev/null
+++ b/tests/qtuitest/sys_input/testdata/enter_invisible/failure_.png
Binary files differ
diff --git a/tests/qtuitest/sys_input/testdata/enter_invisible/failure_.txt b/tests/qtuitest/sys_input/testdata/enter_invisible/failure_.txt
new file mode 100644
index 0000000..8c3ee3d
--- /dev/null
+++ b/tests/qtuitest/sys_input/testdata/enter_invisible/failure_.txt
@@ -0,0 +1,48 @@
+ERROR: Buddy widget for 'Silly 2' not found.
+Available labels: Popup,Dialog,Popup response,Checkbox,CheckGroup,CheckGroup/Do Nothing
+Application :
+Active Widget: TestWidget[fvvvvvuvqpn9o]
+Focus Widget : QCheckBox[40u930]
+Buddypairs:
+ Label: QPushButton[40tjn8] 'Popup' -- Buddy: QPushButton[40tjn8] 'Popup' x:15 y:714 h:28 w:618
+ Label: QGroupBox[40vi90] 'CheckGroup' -- Buddy: QGroupBox[40vi90] 'CheckGroup' x:15 y:853 h:68 w:618
+ Label: QCheckBox[40u930] 'Checkbox' -- Buddy: QCheckBox[40u930] 'Checkbox' x:15 y:812 h:23 w:618
+ Label: QPushButton[40u72o] 'Dialog' -- Buddy: QPushButton[40u72o] 'Dialog' x:15 y:748 h:28 w:618
+ Label: QLabel[40ua88] 'Popup response' -- Buddy: QLineEdit[4146ho] '' x:128 y:782 h:24 w:505
+ Label: QPushButton[413pv0] 'CheckGroup/Do Nothing' -- Buddy: QPushButton[413pv0] 'CheckGroup/Do Nothing' x:26 y:882 h:28 w:596
+Widgets without a buddy Label:
+ QTabBar[40icko] x:4 y:679 h:26 w:238
+Disabled widgets without a buddy Label:
+ QTabBar[40icko] x:4 y:679 h:26 w:238
+Buddy widgets sorted on position:
+ QTabBar[40icko] x:4 y:679 h:26 w:238
+ QPushButton[40tjn8] x:15 y:714 h:28 w:618
+ QPushButton[40u72o] x:15 y:748 h:28 w:618
+ QLineEdit[4146ho] x:128 y:782 h:24 w:505
+ QCheckBox[40u930] x:15 y:812 h:23 w:618
+ QGroupBox[40vi90] x:15 y:853 h:68 w:618
+ QPushButton[413pv0] x:26 y:882 h:28 w:596
+Location: /home/daviclar/build/qtuitest-rd/tests/qtuitest/sys_input/sys_input.js:333
+Also see failure_.png for a screenshot.
+Application :
+Active Widget: TestWidget[fvvvvvuvqpn9o]
+Focus Widget : QCheckBox[40u930]
+Buddypairs:
+ Label: QPushButton[40tjn8] 'Popup' -- Buddy: QPushButton[40tjn8] 'Popup' x:15 y:714 h:28 w:618
+ Label: QGroupBox[40vi90] 'CheckGroup' -- Buddy: QGroupBox[40vi90] 'CheckGroup' x:15 y:853 h:68 w:618
+ Label: QCheckBox[40u930] 'Checkbox' -- Buddy: QCheckBox[40u930] 'Checkbox' x:15 y:812 h:23 w:618
+ Label: QPushButton[40u72o] 'Dialog' -- Buddy: QPushButton[40u72o] 'Dialog' x:15 y:748 h:28 w:618
+ Label: QLabel[40ua88] 'Popup response' -- Buddy: QLineEdit[4146ho] '' x:128 y:782 h:24 w:505
+ Label: QPushButton[413pv0] 'CheckGroup/Do Nothing' -- Buddy: QPushButton[413pv0] 'CheckGroup/Do Nothing' x:26 y:882 h:28 w:596
+Widgets without a buddy Label:
+ QTabBar[40icko] x:4 y:679 h:26 w:238
+Disabled widgets without a buddy Label:
+ QTabBar[40icko] x:4 y:679 h:26 w:238
+Buddy widgets sorted on position:
+ QTabBar[40icko] x:4 y:679 h:26 w:238
+ QPushButton[40tjn8] x:15 y:714 h:28 w:618
+ QPushButton[40u72o] x:15 y:748 h:28 w:618
+ QLineEdit[4146ho] x:128 y:782 h:24 w:505
+ QCheckBox[40u930] x:15 y:812 h:23 w:618
+ QGroupBox[40vi90] x:15 y:853 h:68 w:618
+ QPushButton[413pv0] x:26 y:882 h:28 w:596
diff --git a/tests/qtuitest/sys_input/testdata/select_groupbox_subitem/failure_.txt b/tests/qtuitest/sys_input/testdata/select_groupbox_subitem/failure_.txt
new file mode 100644
index 0000000..fadfa4b
--- /dev/null
+++ b/tests/qtuitest/sys_input/testdata/select_groupbox_subitem/failure_.txt
@@ -0,0 +1,46 @@
+Object QPushButton(0x817be90 "") was expected to emit pressed() within 2000 milliseconds, but it didn't.
+Location: /home/daviclar/build/qtuitest-rd/tests/qtuitest/sys_input/sys_input.js:308
+Failed to save failure screenshot: AUT returned a null screenshot.
+Application :
+Active Widget: TestWidget[fvvvvvuvu9928]
+Focus Widget : QGroupBox[410k10]
+Buddypairs:
+ Label: QGroupBox[410k10] 'Checkable' -- Buddy: QGroupBox[410k10] 'Checkable' x:15 y:812 h:68 w:602
+ Label: QPushButton[41eboo] 'Spacer 3' -- Buddy: QPushButton[41eboo] 'Spacer 3' x:15 y:1058 h:28 w:602
+ Label: QPushButton[41bac0] 'Spacer 0' -- Buddy: QPushButton[41bac0] 'Spacer 0' x:15 y:956 h:28 w:602
+ Label: QPushButton[40t330] 'Spacer 1' -- Buddy: QPushButton[40t330] 'Spacer 1' x:15 y:990 h:28 w:602
+ Label: QPushButton[41e8d0] 'Spacer 4' -- Buddy: QPushButton[41e8d0] 'Spacer 4' x:15 y:1092 h:28 w:602
+ Label: QPushButton[41ffkg] 'Checkable/Groupie' -- Buddy: QPushButton[41ffkg] 'Checkable/Groupie' x:26 y:841 h:28 w:580
+ Label: QLabel[40ve50] 'Status' -- Buddy: QLineEdit[40ss1g] '' x:63 y:714 h:24 w:554
+ Label: QPushButton[40tt90] 'Show Modal Dialog' -- Buddy: QPushButton[40tt90] 'Show Modal Dialog' x:15 y:778 h:28 w:602
+ Label: QGroupBox[40vfro] 'Bug206084' -- Buddy: QLineEdit[41cfj0] '' x:26 y:915 h:24 w:580
+ Label: QLabel[4161e8] 'Time' -- Buddy: QTimeEdit[41e2p0] '' x:63 y:1126 h:24 w:554
+ Label: QPushButton[41ee20] 'Spacer 2' -- Buddy: QPushButton[41ee20] 'Spacer 2' x:15 y:1024 h:28 w:602
+ Label: QPushButton[41f4k0] 'Do Nothing' -- Buddy: QPushButton[41f4k0] 'Do Nothing' x:15 y:744 h:28 w:602
+Widgets without a buddy Label:
+ QGroupBox[40vfro] x:15 y:886 h:64 w:602
+ QScrollBar[415o30] x:626 y:705 h:452 w:16
+ QScrollArea[4189ig] x:6 y:705 h:452 w:636
+ QTabBar[40icko] x:4 y:679 h:26 w:238
+Disabled widgets without a buddy Label:
+ QGroupBox[40vfro] x:15 y:886 h:64 w:602
+ QScrollBar[415o30] x:626 y:705 h:452 w:16
+ QScrollArea[4189ig] x:6 y:705 h:452 w:636
+ QTabBar[40icko] x:4 y:679 h:26 w:238
+Buddy widgets sorted on position:
+ QTabBar[40icko] x:4 y:679 h:26 w:238
+ QScrollArea[4189ig] x:6 y:705 h:452 w:636
+ QScrollBar[415o30] x:626 y:705 h:452 w:16
+ QLineEdit[40ss1g] x:63 y:714 h:24 w:554
+ QPushButton[41f4k0] x:15 y:744 h:28 w:602
+ QPushButton[40tt90] x:15 y:778 h:28 w:602
+ QGroupBox[410k10] x:15 y:812 h:68 w:602
+ QPushButton[41ffkg] x:26 y:841 h:28 w:580
+ QGroupBox[40vfro] x:15 y:886 h:64 w:602
+ QLineEdit[41cfj0] x:26 y:915 h:24 w:580
+ QPushButton[41bac0] x:15 y:956 h:28 w:602
+ QPushButton[40t330] x:15 y:990 h:28 w:602
+ QPushButton[41ee20] x:15 y:1024 h:28 w:602
+ QPushButton[41eboo] x:15 y:1058 h:28 w:602
+ QPushButton[41e8d0] x:15 y:1092 h:28 w:602
+ QTimeEdit[41e2p0] x:63 y:1126 h:24 w:554
diff --git a/tests/qtuitest/sys_linguist/sys_linguist.js b/tests/qtuitest/sys_linguist/sys_linguist.js
new file mode 100644
index 0000000..da1aa41
--- /dev/null
+++ b/tests/qtuitest/sys_linguist/sys_linguist.js
@@ -0,0 +1,152 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+
+include("filedialog.js");
+
+testcase = {
+
+ //TODO: In Progress. Not expected to pass (or even work correctly) yet.
+
+ init: function() {
+ // Start the application
+ startApplication("linguist");
+
+ // Open file
+ select("File/Open...", menuBar());
+ FileDialog.openFile(baseDataPath() + "test_fr.ts");
+
+ // Make sure all views are shown
+ setChecked(true, "View/Views/Context", menuBar());
+ setChecked(true, "View/Views/Strings", menuBar());
+ setChecked(true, "View/Views/Phrases and guesses", menuBar());
+ setChecked(true, "View/Views/Sources and Forms", menuBar());
+ setChecked(true, "View/Views/Warnings", menuBar());
+
+ // Switch on all validation
+ setChecked(true, "Validation/Accelerators", menuBar());
+ setChecked(true, "Validation/Ending Punctuation", menuBar());
+ setChecked(true, "Validation/Phrase matches", menuBar());
+ setChecked(true, "Validation/Place Marker Matches", menuBar());
+
+ // Switch off Length Variants
+ setChecked(false, "View/Length Variants", menuBar());
+
+ // Labels are above their buddy widgets
+ setLabelOrientation(LabelAbove);
+ },
+
+ check_translation_data: {
+ blue: [ "Colours", "blue", "bleu" ],
+ third: [ "Ordinals", "third", "troisième" ],
+ nine: [ "Numbers", "nine", "neuf" ]
+ },
+
+ check_translation: function(context, sourceText, translated) {
+ select( context, "Context" );
+ select( sourceText, "Strings" );
+ compare(getText("Source text"), sourceText);
+ compare(getText("French translation"), translated);
+ },
+
+ check_warnings_data: {
+ warn1: [ "Placemarkers", "Read error reading from %1: %2",
+ "Translation does not refer to the same place markers as in the source text." ],
+ warn2: [ "Accelerators", "&hello world", "Accelerator possibly missing in translation." ]
+ },
+
+ check_warnings: function(context, sourceText, warning) {
+ select( context, "Context" );
+ select( sourceText, "Strings" );
+ compare(getText("Source text"), sourceText);
+ verify(getList("Warnings").contains(warning));
+ },
+
+ missing_translations: function() {
+ select( "Translation/Next Unfinished" );
+ var list = new Array();
+ var val = getSelectedValue("Context")[1] + " : " + getText("Source text");
+ var first = val;
+
+ do {
+ list.push(val);
+ select( "Translation/Next Unfinished" );
+ var val = getSelectedValue("Context")[1] + " : " + getText("Source text");
+ } while (val != first);
+
+ verify(list.contains("Numbers : four"));
+ verify(list.contains("Ordinals : sixth"));
+ verify(list.contains("Colours : a mauvy shade of pinky russet"));
+ },
+
+ check_statistics: function() {
+ //TODO: Should also check word count, however this is not easy to do
+ // in JavaScript for Unicode strings.
+
+ var sourceChars = 0;
+ var translatedChars = 0;
+ var sourceNonSpaceChars = 0;
+ var translatedNonSpaceChars = 0;
+ var first = getSelectedValue("Context")[1] + " : " + getText("Source text");
+
+ do {
+ var sourceText = getText("Source text");
+ var translatedText = getText("French translation");
+ sourceChars += sourceText.length;
+ translatedChars += translatedText.length;
+
+ sourceNonSpaceChars += sourceText.replace(/\s/g, "").length;
+ translatedNonSpaceChars += translatedText.replace(/\s/g, "").length;
+ select( "Translation/Next" );
+ var val = getSelectedValue("Context")[1] + " : " + getText("Source text");
+ } while (val != first);
+
+ select("View/Statistics", menuBar());
+ var labels = getLabels();
+
+ compare(sourceNonSpaceChars, labels[labels.indexOf("Characters:")+1]);
+ compare(translatedNonSpaceChars, labels[labels.indexOf("Characters:")+2]);
+ compare(sourceChars, labels[labels.indexOf("Characters (with spaces):")+1]);
+ compare(translatedChars, labels[labels.indexOf("Characters (with spaces):")+2]);
+ }
+
+} \ No newline at end of file
diff --git a/tests/qtuitest/sys_linguist/sys_linguist.pro b/tests/qtuitest/sys_linguist/sys_linguist.pro
new file mode 100644
index 0000000..d5537aa
--- /dev/null
+++ b/tests/qtuitest/sys_linguist/sys_linguist.pro
@@ -0,0 +1,2 @@
+SOURCES=sys_linguist.js
+CONFIG+=systemtest
diff --git a/tests/qtuitest/sys_linguist/testdata/test_fr.ts b/tests/qtuitest/sys_linguist/testdata/test_fr.ts
new file mode 100644
index 0000000..60108f5
--- /dev/null
+++ b/tests/qtuitest/sys_linguist/testdata/test_fr.ts
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS>
+<TS version="2.0" language="fr">
+<context>
+ <name>Numbers</name>
+ <message>
+ <source>one</source>
+ <translation>un</translation>
+ </message>
+ <message>
+ <source>two</source>
+ <translation>deux</translation>
+ </message>
+ <message>
+ <source>three</source>
+ <translation>trois</translation>
+ </message>
+ <message>
+ <source>four</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>five</source>
+ <translation>cinq</translation>
+ </message>
+ <message>
+ <source>six</source>
+ <translation>six</translation>
+ </message>
+ <message>
+ <source>seven</source>
+ <translation>sept</translation>
+ </message>
+ <message>
+ <source>eight</source>
+ <translation>huit</translation>
+ </message>
+ <message>
+ <source>nine</source>
+ <translation>neuf</translation>
+ </message>
+ <message>
+ <source>ten</source>
+ <translation>dix</translation>
+ </message>
+</context>
+<context>
+ <name>Ordinals</name>
+ <message>
+ <source>first</source>
+ <translation>premier</translation>
+ </message>
+ <message>
+ <source>second</source>
+ <translation>deuxième</translation>
+ </message>
+ <message>
+ <source>third</source>
+ <translation>troisième</translation>
+ </message>
+ <message>
+ <source>fourth</source>
+ <translation>quatrième</translation>
+ </message>
+ <message>
+ <source>fifth</source>
+ <translation>cinquième</translation>
+ </message>
+ <message>
+ <source>sixth</source>
+ <translation type="unfinished"></translation>
+ </message>
+ <message>
+ <source>seventh</source>
+ <translation>septième</translation>
+ </message>
+ <message>
+ <source>eighth</source>
+ <translation>huitième</translation>
+ </message>
+ <message>
+ <source>ninth</source>
+ <translation>neuvième</translation>
+ </message>
+ <message>
+ <source>tenth</source>
+ <translation>dixième.</translation>
+ </message>
+</context>
+<context>
+ <name>Colours</name>
+ <message>
+ <source>red</source>
+ <translation>rouge</translation>
+ </message>
+ <message>
+ <source>orange</source>
+ <translation>orange</translation>
+ </message>
+ <message>
+ <source>yellow</source>
+ <translation>jaune</translation>
+ </message>
+ <message>
+ <source>green</source>
+ <translation>vert</translation>
+ </message>
+ <message>
+ <source>blue</source>
+ <translation>bleu</translation>
+ </message>
+ <message>
+ <source>a mauvy shade of pinky russet</source>
+ <translation type="unfinished"></translation>
+ </message>
+</context>
+<context>
+ <name>Placemarkers</name>
+ <message>
+ <source>Read: %1</source>
+ <translation>Lecture : %1</translation>
+ </message>
+ <message>
+ <source>Write: %1</source>
+ <translation>Écriture : %1</translation>
+ </message>
+ <message>
+ <source>Delete: %1</source>
+ <translation>Supprimer: %1</translation>
+ </message>
+ <message>
+ <source>Read error reading from %1: %2</source>
+ <translation>Erreur de lecture sur %1</translation>
+ </message>
+ <message>
+ <source>Write error writing to %1: %2</source>
+ <translation>Erreur d&apos;écriture sur %1: %2</translation>
+ </message>
+</context>
+<context>
+ <name>Accelerators</name>
+ <message>
+ <source>&amp;hello world</source>
+ <translation>bonjour tout le monde</translation>
+ </message>
+ <message>
+ <source>&amp;goodbye</source>
+ <translation>au &amp;revoir</translation>
+ </message>
+</context>
+<context>
+ <name>Other</name>
+ <message>
+ <source>all for one, one for all.</source>
+ <translation>tout pour un, un pour tout</translation>
+ </message>
+</context>
+</TS>
diff --git a/tests/qtuitest/testapps/fileDialogSaveApp/fileDialogSaveApp.pro b/tests/qtuitest/testapps/fileDialogSaveApp/fileDialogSaveApp.pro
new file mode 100644
index 0000000..0d5640d
--- /dev/null
+++ b/tests/qtuitest/testapps/fileDialogSaveApp/fileDialogSaveApp.pro
@@ -0,0 +1,11 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Wed Jul 12 13:50:18 2006
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+# Input
+SOURCES += main.cpp
diff --git a/tests/qtuitest/testapps/fileDialogSaveApp/main.cpp b/tests/qtuitest/testapps/fileDialogSaveApp/main.cpp
new file mode 100644
index 0000000..ac651f1
--- /dev/null
+++ b/tests/qtuitest/testapps/fileDialogSaveApp/main.cpp
@@ -0,0 +1,10 @@
+#include <QtGui>
+
+int main (int argc, char* argv[])
+{
+ QApplication app( argc, argv );
+ QFileDialog fd;
+ fd.show();
+
+ return app.exec();
+}
diff --git a/tests/qtuitest/testapps/graphicsViewTest/graphicsViewTest.pro b/tests/qtuitest/testapps/graphicsViewTest/graphicsViewTest.pro
new file mode 100644
index 0000000..45dfc16
--- /dev/null
+++ b/tests/qtuitest/testapps/graphicsViewTest/graphicsViewTest.pro
@@ -0,0 +1,7 @@
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+
+HEADERS += mainwindow.h
+SOURCES += main.cpp mainwindow.cpp
diff --git a/tests/qtuitest/testapps/graphicsViewTest/main.cpp b/tests/qtuitest/testapps/graphicsViewTest/main.cpp
new file mode 100644
index 0000000..d5a6826
--- /dev/null
+++ b/tests/qtuitest/testapps/graphicsViewTest/main.cpp
@@ -0,0 +1,15 @@
+
+#include <QtGui>
+
+#include "mainwindow.h"
+
+int main(int argv, char *args[])
+{
+ QApplication gearsofwartactics(argv, args);
+ MainWindow mainWindow;
+ mainWindow.setGeometry(100, 100, 1024, 768);
+ mainWindow.show();
+
+ return gearsofwartactics.exec();
+}
+
diff --git a/tests/qtuitest/testapps/graphicsViewTest/mainwindow.cpp b/tests/qtuitest/testapps/graphicsViewTest/mainwindow.cpp
new file mode 100644
index 0000000..45e3c88
--- /dev/null
+++ b/tests/qtuitest/testapps/graphicsViewTest/mainwindow.cpp
@@ -0,0 +1,35 @@
+#include <QtGui>
+
+
+#include "mainwindow.h"
+
+MainWindow::MainWindow()
+{
+ const QString pixmapString = "qtlogo4.png";
+ item = new QGraphicsPixmapItem(pixmapString);
+
+ textItem = new QGraphicsTextItem("here is some text");
+ textItem->setTextInteractionFlags(Qt::TextEditable);
+ QGraphicsTextItem *textItem2 = new QGraphicsTextItem("and here is some more");
+ textItem2->setTextInteractionFlags(Qt::TextEditable);
+ textItem2->setPos(20, 30);
+ scene = new QGraphicsScene();
+// scene->addItem(item);
+ scene->addItem(textItem);
+ scene->addItem(textItem2);
+ scene->setBackgroundBrush(Qt::lightGray);
+
+ view = new QGraphicsView(scene);
+ view->rotate(-30);
+ QHBoxLayout *layout = new QHBoxLayout;
+ layout->addWidget(view);
+ QLabel *label = new QLabel("hello world");
+ layout->addWidget(label);
+ QWidget *widget = new QWidget;
+ widget->setLayout(layout);
+
+ setCentralWidget(widget);
+ setWindowTitle(tr("Diagramscene"));
+
+
+}
diff --git a/tests/qtuitest/testapps/graphicsViewTest/mainwindow.h b/tests/qtuitest/testapps/graphicsViewTest/mainwindow.h
new file mode 100644
index 0000000..c8b68aa
--- /dev/null
+++ b/tests/qtuitest/testapps/graphicsViewTest/mainwindow.h
@@ -0,0 +1,27 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+class QGraphicsView;
+class QGraphicsScene;
+class QGraphicsItem;
+class QGraphicsTextItem;
+class QGraphicsPixmapItem;
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow();
+private:
+
+ QGraphicsView *view;
+ QGraphicsScene *scene;
+ QGraphicsItem *item;
+ QGraphicsTextItem *textItem;
+ QGraphicsPixmapItem *gowtPixmapItem;
+};
+
+#endif
diff --git a/tests/qtuitest/testapps/testapp1/main.cpp b/tests/qtuitest/testapps/testapp1/main.cpp
new file mode 100644
index 0000000..1bc3581
--- /dev/null
+++ b/tests/qtuitest/testapps/testapp1/main.cpp
@@ -0,0 +1,237 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+class TestWidget : public QTabWidget
+{
+Q_OBJECT
+public:
+ TestWidget(QWidget *parent = 0, Qt::WindowFlags f = 0);
+private slots:
+ void setupWidgets();
+
+private:
+ QLineEdit *testEdit;
+};
+#include "main.moc"
+
+TestWidget::TestWidget(QWidget *parent, Qt::WindowFlags f)
+ : QTabWidget(parent)
+{
+ setWindowFlags(f);
+ setWindowTitle("testapp1");
+ QTimer::singleShot(0, this, SLOT(setupWidgets()));
+}
+
+void TestWidget::setupWidgets() {
+ {
+ QWidget *page = new QWidget(this);
+ QSignalMapper *sm = new QSignalMapper(page);
+
+ QFormLayout *fl(new QFormLayout);
+
+ QLineEdit *statusEdit = new QLineEdit;
+ fl->addRow("Status", statusEdit);
+
+ QLineEdit *le1 = new QLineEdit;
+ QPushButton *pb1 = new QPushButton("Button1");
+ QLineEdit *le2 = new QLineEdit;
+ QPushButton *pb2 = new QPushButton("Button2");
+
+ fl->addRow("LineEdit1", le1);
+ fl->addRow(pb1);
+ fl->addRow("LineEdit2", le2);
+ fl->addRow(pb2);
+
+ QComboBox *ecb = new QComboBox;
+ ecb->setEditable(true);
+ ecb->addItem("Red");
+ ecb->addItem("Green");
+ ecb->addItem("Blue");
+ ecb->addItem("Cyan");
+ ecb->addItem("Magenta");
+ ecb->addItem("Yellow");
+ ecb->addItem("Black");
+ ecb->addItem("White");
+ fl->addRow("Colour", ecb);
+
+ QMenu *menu = new QMenu(page);
+ QAction *action1 = menu->addAction("Action 1", sm, SLOT(map()));
+ QAction *action2 = menu->addAction("Action 2", sm, SLOT(map()));
+ QAction *actionWithSubmenu = menu->addAction("Submenu", sm, SLOT(map()));
+ for ( int i = 1; i <= 8; ++i ) {
+ QString menuName = QString("Menu Item #%1").arg(i);
+ menu->addAction(menuName);
+ }
+
+ QAction *actionLast = menu->addAction("Last!", sm, SLOT(map()));
+
+ QMenu *submenu = new QMenu(page);
+ actionWithSubmenu->setMenu(submenu);
+ QAction *subaction1 = submenu->addAction( "Subaction 1", sm, SLOT(map()) );
+ QAction *subaction2 = submenu->addAction( "Subaction 2", sm, SLOT(map()) );
+
+ connect(le1, SIGNAL(textChanged(QString)), sm, SLOT(map()));
+ connect(le2, SIGNAL(textChanged(QString)), sm, SLOT(map()));
+ connect(pb1, SIGNAL(clicked()), sm, SLOT(map()));
+ connect(pb2, SIGNAL(clicked()), sm, SLOT(map()));
+ connect(ecb, SIGNAL(activated(int)), sm, SLOT(map()));
+
+ sm->setMapping(le1, "LineEdit1 text changed");
+ sm->setMapping(le2, "LineEdit2 text changed");
+ sm->setMapping(pb1, "Button1 clicked");
+ sm->setMapping(pb2, "Button2 clicked");
+ sm->setMapping(ecb, "Colour changed");
+ sm->setMapping(action1, "Action 1 activated");
+ sm->setMapping(action2, "Action 2 activated");
+ sm->setMapping(actionWithSubmenu, "Submenu activated");
+ sm->setMapping(actionLast, "Last activated");
+ sm->setMapping(subaction1, "Subaction 1 activated");
+ sm->setMapping(subaction2, "Subaction 2 activated");
+
+ connect(sm, SIGNAL(mapped(QString)), statusEdit, SLOT(setText(QString)));
+
+ page->setLayout(fl);
+
+ addTab(page, "First Tab");
+ }
+
+ {
+ QWidget *page = new QWidget;
+ QSignalMapper *sm = new QSignalMapper(page);
+
+ QFormLayout *fl(new QFormLayout);
+
+ QLineEdit *statusEdit = new QLineEdit;
+ fl->addRow("CowStatus", statusEdit);
+
+ QComboBox *cb = new QComboBox;
+ cb->addItem("Neigh");
+ cb->addItem("Woof");
+ cb->addItem("Moo");
+ cb->addItem("Meow");
+ cb->addItem("Quack");
+ cb->addItem("Honk");
+ cb->addItem("Vrooooom");
+ cb->addItem("\"Hi Frank\"");
+ cb->addItem("Choo choo!");
+ fl->addRow("Cow Goes?", cb);
+ connect(cb, SIGNAL(activated(int)), sm, SLOT(map()));
+ sm->setMapping(cb, "Cow Goes? changed");
+
+ for (int i = 0; i < 20; ++i) {
+ QString name( QString("CowButton%1").arg(i) );
+ QPushButton *pb1 = new QPushButton(name);
+ fl->addRow(pb1);
+ connect(pb1, SIGNAL(clicked()), sm, SLOT(map()));
+ sm->setMapping(pb1, name + " clicked");
+ }
+
+ connect(sm, SIGNAL(mapped(QString)), statusEdit, SLOT(setText(QString)));
+
+ page->setLayout(fl);
+
+ QScrollArea *sa = new QScrollArea(this);
+ sa->setWidget(page);
+ sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ sa->setFocusPolicy(Qt::NoFocus);
+ sa->setFrameStyle(QFrame::NoFrame);
+ sa->setWidgetResizable(true);
+ addTab(sa, "Cow Tab");
+ }
+
+ {
+ QWidget *page = new QWidget;
+ QSignalMapper *sm = new QSignalMapper(page);
+
+ QFormLayout *fl(new QFormLayout);
+
+ QLineEdit *statusEdit = new QLineEdit;
+ fl->addRow("Status", statusEdit);
+
+ QCheckBox *cb = new QCheckBox("Checkbox");
+ cb->setChecked(false);
+ fl->addRow(cb);
+
+ QPushButton *pb = new QPushButton("Clear");
+ fl->addRow(pb);
+
+ QTimeEdit *te = new QTimeEdit;
+ te->setTime(QTime(12, 30, 30));
+ te->setDisplayFormat("hh:mm:ss");
+ fl->addRow("Time", te);
+
+ QDateEdit *de = new QDateEdit;
+ de->setDate(QDate(2001, 1, 1));
+ fl->addRow("Date", de);
+
+ connect(cb, SIGNAL(clicked()), sm, SLOT(map()));
+ connect(pb, SIGNAL(clicked()), sm, SLOT(map()));
+ connect(te, SIGNAL(editingFinished()), sm, SLOT(map()));
+ connect(de, SIGNAL(editingFinished()), sm, SLOT(map()));
+ sm->setMapping(cb, "'Checkbox' clicked");
+ sm->setMapping(pb, "'Clear' clicked");
+ sm->setMapping(te, "'Time' edited");
+ sm->setMapping(de, "'Date' edited");
+
+ connect(sm, SIGNAL(mapped(QString)), statusEdit, SLOT(setText(QString)));
+
+ page->setLayout(fl);
+
+ addTab(page, "Awesome Tab");
+ }
+
+ for (int i = 0; i < 5; ++i) {
+ QWidget* widget = new QWidget(this);
+ addTab(widget, QString("Distant Tab %1").arg(i));
+ }
+}
+
+int main(int argc, char** argv)
+{
+ QApplication app(argc, argv);
+ TestWidget tw;
+ tw.resize(640,480);
+ tw.show();
+ return app.exec();
+}
+
diff --git a/tests/qtuitest/testapps/testapp1/testapp1.pro b/tests/qtuitest/testapps/testapp1/testapp1.pro
new file mode 100644
index 0000000..3052b11
--- /dev/null
+++ b/tests/qtuitest/testapps/testapp1/testapp1.pro
@@ -0,0 +1,19 @@
+SOURCES*=main.cpp
+TEMPLATE=app
+DEFINES*=TARGET=$$TARGET
+
+QT+=network
+
+symbian {
+ TARGET.EPOCALLOWDLLDATA=1
+ TARGET.CAPABILITY += AllFiles ReadDeviceData ReadUserData SwEvent WriteUserData NetworkServices
+}
+
+win32 {
+ target.path=$$INSTALLROOT
+ INSTALLS+=target
+}
+
+mac {
+ CONFIG-=app_bundle
+}
diff --git a/tests/qtuitest/testapps/testapp2/main.cpp b/tests/qtuitest/testapps/testapp2/main.cpp
new file mode 100644
index 0000000..43193c1
--- /dev/null
+++ b/tests/qtuitest/testapps/testapp2/main.cpp
@@ -0,0 +1,262 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+class TestWidget : public QTabWidget
+{
+Q_OBJECT
+public:
+ TestWidget(QWidget *parent = 0, Qt::WindowFlags f = 0);
+private slots:
+ void setupWidgets();
+ void raiseDialog();
+ void doPopup();
+ void doDialog();
+ void setButtonText(const QString &text);
+private:
+ QLineEdit *popupEdit;
+ QPushButton *menuButton;
+};
+#include "main.moc"
+
+TestWidget::TestWidget(QWidget *parent, Qt::WindowFlags f)
+ : QTabWidget(parent)
+{
+ setWindowFlags(f);
+ setWindowTitle("testapp2");
+ QTimer::singleShot(0, this, SLOT(setupWidgets()));
+}
+
+void TestWidget::setupWidgets() {
+ {
+ QWidget *page(new QWidget);
+ QFormLayout *fl(new QFormLayout);
+ QSignalMapper *sm(new QSignalMapper(page));
+
+ QLineEdit *statusEdit = new QLineEdit;
+ fl->addRow("Status", statusEdit);
+ QTimer::singleShot(0, statusEdit, SLOT(setFocus()));
+
+ QPushButton *nothing = new QPushButton("Do Nothing");
+ QPushButton *dialog = new QPushButton("Show Modal Dialog");
+ connect(dialog, SIGNAL(pressed()), this, SLOT(raiseDialog()));
+
+ QGroupBox *checkableGroupBox = new QGroupBox;
+ checkableGroupBox->setCheckable(true);
+ checkableGroupBox->setChecked(false);
+ checkableGroupBox->setTitle("Checkable");
+ QPushButton *buttonInGroupBox = new QPushButton("Groupie");
+ {
+ QFormLayout *subFl(new QFormLayout);
+ subFl->addRow(buttonInGroupBox);
+ checkableGroupBox->setLayout(subFl);
+ }
+
+ /*
+ Test that a focusable widget located in a noncheckable group box
+ which contains no other focusable widgets can be referred to using
+ the group box label.
+ */
+ QGroupBox *lineEditGroupBox = new QGroupBox;
+ {
+ lineEditGroupBox->setCheckable(false);
+ lineEditGroupBox->setTitle("Bug206084");
+ QHBoxLayout* hbox = new QHBoxLayout;
+ hbox->addWidget(new QLineEdit);
+ lineEditGroupBox->setLayout(hbox);
+ }
+
+ fl->addRow(nothing);
+ fl->addRow(dialog);
+ fl->addRow(checkableGroupBox);
+ fl->addRow(lineEditGroupBox);
+
+ for (int i = 0; i < 5; ++i) {
+ fl->addRow(new QPushButton(QString("Spacer %1").arg(i)));
+ }
+
+ QTimeEdit *te = new QTimeEdit;
+ te->setTime(QTime(12, 30));
+ te->setDisplayFormat("hh:mm");
+ fl->addRow("Time", te);
+
+ connect(nothing, SIGNAL(clicked()), sm, SLOT(map()));
+ connect(checkableGroupBox, SIGNAL(clicked(bool)), sm, SLOT(map()));
+ connect(buttonInGroupBox, SIGNAL(clicked()), sm, SLOT(map()));
+
+ sm->setMapping(nothing, "'Do Nothing' clicked");
+ sm->setMapping(checkableGroupBox, "'Checkable' clicked");
+ sm->setMapping(buttonInGroupBox, "'Groupie' clicked");
+
+ connect(sm, SIGNAL(mapped(QString)), statusEdit, SLOT(setText(QString)));
+
+ page->setLayout(fl);
+ QScrollArea *sa = new QScrollArea(this);
+ sa->setWidget(page);
+ sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ sa->setFocusPolicy(Qt::NoFocus);
+ sa->setFrameStyle(QFrame::NoFrame);
+ sa->setWidgetResizable(true);
+ addTab(sa, "Tab One");
+ }
+
+ {
+ QWidget *page(new QWidget);
+ QFormLayout *fl(new QFormLayout);
+
+ QPushButton *messageButton(new QPushButton("Popup"));
+ fl->addRow(messageButton);
+ connect(messageButton, SIGNAL(clicked()), this, SLOT(doPopup()));
+
+ QPushButton *dialogButton(new QPushButton("Dialog"));
+ fl->addRow(dialogButton);
+ connect(dialogButton, SIGNAL(clicked()), this, SLOT(doDialog()), Qt::QueuedConnection);
+
+ popupEdit = new QLineEdit;
+ fl->addRow("Popup response", popupEdit);
+
+ QCheckBox *cb = new QCheckBox("Checkbox");
+
+ QLineEdit *sillyLineEdit1 = new QLineEdit;
+ QLineEdit *sillyLineEdit2 = new QLineEdit;
+ QLabel *sillyLabel1 = new QLabel("Silly 1");
+ QLabel *sillyLabel2 = new QLabel("Silly 2");
+
+ sillyLineEdit1->setVisible(false);
+ sillyLineEdit2->setVisible(false);
+ sillyLabel1->setVisible(false);
+ sillyLabel2->setVisible(false);
+
+ connect(cb, SIGNAL(toggled(bool)), sillyLineEdit1, SLOT(setVisible(bool)));
+ connect(cb, SIGNAL(toggled(bool)), sillyLineEdit2, SLOT(setVisible(bool)));
+ connect(cb, SIGNAL(toggled(bool)), sillyLabel1, SLOT(setVisible(bool)));
+ connect(cb, SIGNAL(toggled(bool)), sillyLabel2, SLOT(setVisible(bool)));
+
+ fl->addRow(cb);
+ fl->addRow(sillyLabel1, sillyLineEdit1);
+ fl->addRow(sillyLabel2, sillyLineEdit2);
+
+ QGroupBox *gb = new QGroupBox("CheckGroup");
+ gb->setCheckable(true);
+ gb->setChecked(false);
+ {
+ QFormLayout *subFl(new QFormLayout);
+ subFl->addRow(new QPushButton("Do Nothing"));
+ gb->setLayout(subFl);
+ }
+ fl->addRow(gb);
+
+ page->setLayout(fl);
+ addTab(page, "Tab Two");
+ }
+
+ {
+ QWidget *page(new QWidget);
+ QFormLayout *fl(new QFormLayout);
+ QSignalMapper *sm(new QSignalMapper(page));
+
+ menuButton = new QPushButton("Menu");
+ QMenu *menu(new QMenu);
+ for ( int i = 1; i <= 6; ++i ) {
+ QString menuName = QString("Menu Item #%1").arg(i);
+ QAction *a = menu->addAction(menuName, sm, SLOT(map()));
+ sm->setMapping(a, a->text());
+ }
+ menuButton->setMenu(menu);
+ fl->addRow("Menu", menuButton);
+
+ connect(sm, SIGNAL(mapped(QString)), this, SLOT(setButtonText(QString)));
+
+ QTimeEdit *te(new QTimeEdit);
+ te->setDisplayFormat("hh:mm:ss");
+ te->setTime(QTime(12, 34, 56));
+ fl->addRow("Time", te);
+
+ QGroupBox *gb(new QGroupBox("Groupbox"));
+ QVBoxLayout *vb(new QVBoxLayout);
+ vb->addWidget( new QPushButton("Child Button 1") );
+ vb->addWidget( new QPushButton("Child Button 2") );
+ gb->setLayout(vb);
+ fl->addRow(gb);
+
+ page->setLayout(fl);
+ addTab(page, "Tab Free");
+ }
+
+}
+
+void TestWidget::raiseDialog() {
+ QDialog dlg;
+ QPushButton pb("Close", &dlg);
+ connect(&pb, SIGNAL(clicked()), &dlg, SLOT(accept()));
+ dlg.exec();
+}
+
+void TestWidget::doPopup() {
+ QString opt = (
+ QMessageBox::warning(this, "A Message Box", "Please choose yes or no",
+ QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) ? "Yes" : "No";
+ popupEdit->setText(opt);
+}
+
+void TestWidget::doDialog() {
+ QDialog dlg;
+ dlg.setWindowTitle("New Dialog");
+
+ QPushButton closeButton("Close", &dlg);
+ connect(&closeButton, SIGNAL(clicked()), &dlg, SLOT(accept()));
+
+ dlg.exec();
+}
+
+void TestWidget::setButtonText(const QString &text) {
+ menuButton->setText(text);
+}
+
+int main(int argc, char** argv)
+{
+ QApplication app(argc, argv);
+ TestWidget tw;
+ tw.resize(640,480);
+ tw.show();
+ return app.exec();
+}
diff --git a/tests/qtuitest/testapps/testapp2/testapp2.pro b/tests/qtuitest/testapps/testapp2/testapp2.pro
new file mode 100644
index 0000000..eac1fd3
--- /dev/null
+++ b/tests/qtuitest/testapps/testapp2/testapp2.pro
@@ -0,0 +1,16 @@
+SOURCES*=main.cpp
+TEMPLATE=app
+
+symbian {
+ TARGET.EPOCALLOWDLLDATA=1
+ TARGET.CAPABILITY += AllFiles ReadDeviceData ReadUserData SwEvent WriteUserData NetworkServices
+}
+
+win32 {
+ target.path=$$INSTALLROOT
+ INSTALLS+=target
+}
+
+mac {
+ CONFIG-=app_bundle
+}
diff --git a/tests/qtuitest/testapps/testapp3/main.cpp b/tests/qtuitest/testapps/testapp3/main.cpp
new file mode 100644
index 0000000..0763484
--- /dev/null
+++ b/tests/qtuitest/testapps/testapp3/main.cpp
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+
+class TestWidget : public QTabWidget
+{
+Q_OBJECT
+public:
+ TestWidget(QWidget *parent = 0, Qt::WindowFlags f = 0);
+private slots:
+ void setupWidgets();
+};
+#include "main.moc"
+
+TestWidget::TestWidget(QWidget *parent, Qt::WindowFlags f)
+ : QTabWidget(parent)
+{
+ setWindowFlags(f);
+ setWindowTitle("testapp3");
+ QTimer::singleShot(0, this, SLOT(setupWidgets()));
+}
+
+void TestWidget::setupWidgets() {
+ {
+ QWidget *page(new QWidget);
+ QFormLayout *fl(new QFormLayout);
+
+ QComboBox *cb = new QComboBox;
+ cb->addItems( QStringList() << "Off" << "Ask" << "On" );
+ fl->addRow("Automatic", cb);
+
+ cb = new QComboBox;
+ cb->addItems( QStringList() << "New York" << "Los Angeles" );
+ fl->addRow("Time Zone", cb);
+
+ page->setLayout(fl);
+ QScrollArea *sa = new QScrollArea(this);
+ sa->setWidget(page);
+ sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ sa->setFocusPolicy(Qt::NoFocus);
+ sa->setFrameStyle(QFrame::NoFrame);
+ sa->setWidgetResizable(true);
+ addTab(sa, "Time");
+ }
+
+ {
+ QWidget *page(new QWidget);
+ QFormLayout *fl(new QFormLayout);
+
+ QTextEdit *textEdit = new QTextEdit;
+ fl->addRow("Text", textEdit);
+
+ page->setLayout(fl);
+ addTab(page, "Text");
+ }
+
+ {
+ QWidget *page = new QWidget;
+ QSignalMapper *sm = new QSignalMapper(page);
+
+ QFormLayout *fl(new QFormLayout);
+
+ QLineEdit *statusEdit = new QLineEdit;
+ statusEdit->setFocusPolicy(Qt::NoFocus);
+ fl->addRow("Status", statusEdit);
+
+ QPushButton *button1 = new QPushButton("NoFocus1");
+ button1->setFocusPolicy(Qt::NoFocus);
+ button1->setShortcut(QKeySequence(Qt::Key_Select));
+ connect(button1, SIGNAL(clicked()), sm, SLOT(map()));
+ sm->setMapping(button1, "NoFocus1 clicked");
+ fl->addRow(button1);
+
+ QPushButton *button2 = new QPushButton("NoFocus2");
+ button2->setFocusPolicy(Qt::NoFocus);
+ button2->setShortcut(QKeySequence(Qt::Key_0));
+ connect(button2, SIGNAL(clicked()), sm, SLOT(map()));
+ sm->setMapping(button2, "NoFocus2 clicked");
+ fl->addRow(button2);
+
+ connect(sm, SIGNAL(mapped(QString)), statusEdit, SLOT(setText(QString)));
+ page->setLayout(fl);
+
+ QScrollArea *sa = new QScrollArea(this);
+ sa->setWidget(page);
+ sa->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+ sa->setFocusPolicy(Qt::NoFocus);
+ sa->setFrameStyle(QFrame::NoFrame);
+ sa->setWidgetResizable(true);
+ addTab(sa, "Shortcuts");
+ }
+
+}
+
+int main(int argc, char** argv)
+{
+ QApplication app(argc, argv);
+ TestWidget tw;
+ tw.resize(640,480);
+ tw.show();
+ return app.exec();
+}
+
diff --git a/tests/qtuitest/testapps/testapp3/testapp3.pro b/tests/qtuitest/testapps/testapp3/testapp3.pro
new file mode 100644
index 0000000..eac1fd3
--- /dev/null
+++ b/tests/qtuitest/testapps/testapp3/testapp3.pro
@@ -0,0 +1,16 @@
+SOURCES*=main.cpp
+TEMPLATE=app
+
+symbian {
+ TARGET.EPOCALLOWDLLDATA=1
+ TARGET.CAPABILITY += AllFiles ReadDeviceData ReadUserData SwEvent WriteUserData NetworkServices
+}
+
+win32 {
+ target.path=$$INSTALLROOT
+ INSTALLS+=target
+}
+
+mac {
+ CONFIG-=app_bundle
+}
diff --git a/tests/qtuitest/testapps/testapp4/main.cpp b/tests/qtuitest/testapps/testapp4/main.cpp
new file mode 100644
index 0000000..5882949
--- /dev/null
+++ b/tests/qtuitest/testapps/testapp4/main.cpp
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtGui>
+#include <QtCore>
+
+class TestWidget : public QWidget
+{
+Q_OBJECT
+public:
+ TestWidget(QWidget *parent = 0, Qt::WindowFlags f = 0);
+private slots:
+ void setupWidgets();
+};
+#include "main.moc"
+
+TestWidget::TestWidget(QWidget *parent, Qt::WindowFlags f)
+ : QWidget(parent,f)
+{
+ setWindowTitle("testapp4");
+ QTimer::singleShot(0, this, SLOT(setupWidgets()));
+}
+
+void TestWidget::setupWidgets() {
+
+ QTabWidget* tw = new QTabWidget;
+ QPushButton* tab1 = new QPushButton("A Button", this);
+ QPushButton* tab2 = new QPushButton("A Nother Button", this);
+
+ tw->addTab(tab1, "Thirst");
+ tw->addTab(tab2, "Sekond");
+
+ QLineEdit* le = new QLineEdit;
+
+ QFormLayout* form = new QFormLayout;
+ form->addRow("Thing", le);
+ form->addRow(tw);
+
+ setLayout(form);
+
+ le->setFocus();
+}
+
+int main(int argc, char** argv)
+{
+ QApplication app(argc, argv);
+ TestWidget tw;
+ tw.resize(640,480);
+ tw.show();
+ return app.exec();
+}
+
diff --git a/tests/qtuitest/testapps/testapp4/testapp4.pro b/tests/qtuitest/testapps/testapp4/testapp4.pro
new file mode 100644
index 0000000..eac1fd3
--- /dev/null
+++ b/tests/qtuitest/testapps/testapp4/testapp4.pro
@@ -0,0 +1,16 @@
+SOURCES*=main.cpp
+TEMPLATE=app
+
+symbian {
+ TARGET.EPOCALLOWDLLDATA=1
+ TARGET.CAPABILITY += AllFiles ReadDeviceData ReadUserData SwEvent WriteUserData NetworkServices
+}
+
+win32 {
+ target.path=$$INSTALLROOT
+ INSTALLS+=target
+}
+
+mac {
+ CONFIG-=app_bundle
+}
diff --git a/tests/qtuitest/testapps/testapps.pro b/tests/qtuitest/testapps/testapps.pro
new file mode 100644
index 0000000..13079d1
--- /dev/null
+++ b/tests/qtuitest/testapps/testapps.pro
@@ -0,0 +1,8 @@
+TEMPLATE=subdirs
+SUBDIRS+= \
+ testapp1 \
+ testapp2 \
+ testapp3 \
+ testapp4 \
+ graphicsViewTest \
+ fileDialogSaveApp
diff --git a/tests/qtuitest/tst_qalternatestack/tst_qalternatestack.cpp b/tests/qtuitest/tst_qalternatestack/tst_qalternatestack.cpp
new file mode 100644
index 0000000..7b4e745
--- /dev/null
+++ b/tests/qtuitest/tst_qalternatestack/tst_qalternatestack.cpp
@@ -0,0 +1,418 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QTest>
+#include <QObject>
+#include <qalternatestack_p.h>
+#include <QCoreApplication>
+//#include <shared/qtopiaunittest.h>
+
+#ifdef Q_OS_UNIX
+#include <signal.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <string.h>
+#include <errno.h>
+#endif
+
+//TESTED_COMPONENT=QA: Testing Framework (18707)
+
+class tst_QAlternateStack : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void start();
+ void switching();
+
+ void init();
+
+ void sigaltstack();
+
+ void multipleInstances();
+
+private:
+ static void stack_entry(QAlternateStack*, QVariant const&);
+
+ static void stack_entry1(QAlternateStack*, QVariant const&);
+ static void stack_entry2(QAlternateStack*, QVariant const&);
+ static void stack_entry3(QAlternateStack*, QVariant const&);
+ static void stack_entry4(QAlternateStack*, QVariant const&);
+ static void stack_entry_handler(QAlternateStack*,QVariant const&,int);
+
+ int m_shouldSwitchFrom;
+
+ QAlternateStack* m_stack;
+ QVariant m_data;
+ bool m_isActive;
+ bool m_isCurrentStack;
+
+ QList<QPair<int,QAlternateStack*> > m_stackEntries;
+};
+
+class tst_QAlternateStackWithStackBuffer : public tst_QAlternateStack
+{
+ Q_OBJECT
+};
+
+#ifdef Q_OS_UNIX
+extern char*& qalternatestack_stackbuf();
+extern int& qalternatestack_stackbuf_len();
+#endif
+
+int main(int argc, char** argv)
+{
+ QCoreApplication app(argc, argv);
+
+ int ret = 0;
+
+ // First, test the regular heap-allocated alternate stack.
+ {
+ tst_QAlternateStack test;
+ ret += QTest::qExec(&test, argc, argv);
+ }
+
+#ifdef Q_OS_UNIX
+ // Now try using memory allocated from the main stack only.
+ {
+ char buf[65536*4];
+ qalternatestack_stackbuf() = buf;
+ qalternatestack_stackbuf_len() = 256*1024;
+ tst_QAlternateStackWithStackBuffer test;
+ ret += QTest::qExec(&test, argc, argv);
+ }
+#endif
+
+ return ret;
+}
+
+void tst_QAlternateStack::stack_entry(QAlternateStack* stack, QVariant const& data)
+{
+ QVariantList list = data.toList();
+ if (!list.count()) return;
+ if (!stack) return;
+
+ tst_QAlternateStack* test = qobject_cast<tst_QAlternateStack*>(list.at(0).value<QObject*>());
+ if (!test) return;
+
+ test->m_stack = stack;
+ test->m_data = data;
+ test->m_isActive = stack->isActive();
+ test->m_isCurrentStack = stack->isCurrentStack();
+
+ for (; test->m_shouldSwitchFrom > 0; --test->m_shouldSwitchFrom) {
+ stack->switchFrom();
+ test->m_isActive = stack->isActive();
+ test->m_isCurrentStack = stack->isCurrentStack();
+ }
+}
+
+void tst_QAlternateStack::stack_entry1(QAlternateStack* stack, QVariant const& data)
+{ stack_entry_handler(stack, data, 1); }
+void tst_QAlternateStack::stack_entry2(QAlternateStack* stack, QVariant const& data)
+{ stack_entry_handler(stack, data, 2); }
+void tst_QAlternateStack::stack_entry3(QAlternateStack* stack, QVariant const& data)
+{ stack_entry_handler(stack, data, 3); }
+void tst_QAlternateStack::stack_entry4(QAlternateStack* stack, QVariant const& data)
+{ stack_entry_handler(stack, data, 4); }
+
+void tst_QAlternateStack::stack_entry_handler(QAlternateStack* stack, QVariant const& data, int number)
+{
+ QVariantList list = data.toList();
+ if (!list.count()) return;
+
+ tst_QAlternateStack* test = qobject_cast<tst_QAlternateStack*>(list.at(0).value<QObject*>());
+ if (!test) return;
+
+ test->m_stackEntries << qMakePair(number, stack);
+ test->m_stack = stack;
+ test->m_isActive = stack->isActive();
+ test->m_isCurrentStack = stack->isCurrentStack();
+
+ // It is possible we've been called on a stack which overlaps some other memory.
+ // When this happens, try to increase the chances of causing a crash by corrupting memory.
+ static const int LEN = 32768;
+ char buf[LEN];
+ for (int i = 0; i < LEN; i += 4) {
+ buf[i] = 0xDE;
+ buf[i+1] = 0xAD;
+ buf[i+2] = 0xBE;
+ buf[i+3] = 0xEF;
+ }
+ // Make sure compiler doesn't optimize it out
+ qChecksum(buf, LEN);
+}
+
+/*
+ \req QTOPIA-78
+
+ \groups
+*/
+void tst_QAlternateStack::start()
+{
+ if (!QAlternateStack::isAvailable()) {
+ QSKIP("QAlternateStack is not available on this platform.", SkipAll);
+ }
+
+ QAlternateStack stack;
+
+ QCOMPARE(stack.isActive(), false);
+ QCOMPARE(stack.isCurrentStack(), false);
+
+ QVariantList list;
+ list.append( qVariantFromValue((QObject*)this) );
+
+ // Switch to the stack...
+ stack.start(tst_QAlternateStack::stack_entry, list);
+ // ... it should have returned almost immediately.
+
+ // Check that our private members were set to the expected values.
+ QCOMPARE(m_stack, &stack);
+ QCOMPARE(m_data, qVariantFromValue(list));
+ QCOMPARE(m_isActive, true);
+ QCOMPARE(m_isCurrentStack, true);
+
+ QCOMPARE(stack.isActive(), false);
+ QCOMPARE(stack.isCurrentStack(), false);
+}
+
+/*
+ \req QTOPIA-78
+
+ \groups
+*/
+void tst_QAlternateStack::switching()
+{
+ if (!QAlternateStack::isAvailable()) {
+ QSKIP("QAlternateStack is not available on this platform.", SkipAll);
+ }
+
+ QAlternateStack stack;
+
+ QCOMPARE(stack.isActive(), false);
+ QCOMPARE(stack.isCurrentStack(), false);
+
+ QVariantList list;
+ list.append( qVariantFromValue((QObject*)this) );
+
+ // Set it up so the alternate stack calls switchFrom() several times.
+ const int switchCount = 5;
+ m_shouldSwitchFrom = switchCount;
+
+ stack.start(tst_QAlternateStack::stack_entry, list);
+
+ for (int i = switchCount; i > 0; --i) {
+ // Check that our private members were set to the expected values.
+ QCOMPARE(m_stack, &stack);
+ QCOMPARE(m_data, qVariantFromValue(list));
+ QCOMPARE(m_isActive, true);
+ QCOMPARE(m_isCurrentStack, true);
+
+ QCOMPARE(m_shouldSwitchFrom, i);
+
+ // Still active, since we switched using switchFrom().
+ QCOMPARE(stack.isActive(), true);
+ QCOMPARE(stack.isCurrentStack(), false);
+
+ // Switch to the stack...
+ stack.switchTo();
+ }
+
+ // No longer active.
+ QCOMPARE(m_shouldSwitchFrom, 0);
+ QCOMPARE(stack.isActive(), false);
+ QCOMPARE(stack.isCurrentStack(), false);
+}
+
+char* addressof_dummy;
+int got_signal;
+
+void test_sighandler(int signum)
+{
+ got_signal = signum;
+
+ int dummy = 1;
+ addressof_dummy = (char*)&dummy;
+}
+
+/*
+ \req QTOPIA-78
+
+ \groups
+
+ Tests that sigaltstack() actually works on the target platform.
+
+ On some platforms, like the Greenphone, sigaltstack seems to be broken
+ and always causes a segfault. When porting QtUitest to a new platform,
+ run this testfunction to make sure QAlternateStack will work properly.
+*/
+void tst_QAlternateStack::sigaltstack()
+{
+#ifdef Q_OS_UNIX
+ // isAvailable() returns false on platforms where sigaltstack is known
+ // to be broken.
+ if (!QAlternateStack::isAvailable()) {
+ QSKIP("QAlternateStack is not available on this platform.", SkipAll);
+ }
+ QByteArray buffer;
+ buffer.resize(SIGSTKSZ);
+
+ stack_t stack;
+ stack.ss_sp = (qalternatestack_stackbuf() ? qalternatestack_stackbuf() : buffer.data());
+ stack.ss_size = SIGSTKSZ;
+ stack.ss_flags = 0;
+
+ QVERIFY( 0 == ::sigaltstack(&stack, 0) );
+
+ stack_t newstack;
+ QVERIFY( 0 == ::sigaltstack(0, &newstack) );
+ QVERIFY(stack.ss_sp == newstack.ss_sp);
+ QVERIFY(stack.ss_size == newstack.ss_size);
+ QVERIFY(stack.ss_flags == newstack.ss_flags);
+
+ struct sigaction action;
+ action.sa_handler = test_sighandler;
+ action.sa_flags = SA_ONSTACK;
+ sigemptyset(&action.sa_mask);
+
+ QVERIFY2( 0 == sigaction(SIGUSR2, &action, 0), strerror(errno) );
+
+ struct sigaction newaction;
+ QVERIFY2( 0 == sigaction(SIGUSR2,0,&newaction), strerror(errno) );
+ QVERIFY(newaction.sa_handler == action.sa_handler);
+ QVERIFY(newaction.sa_flags & SA_ONSTACK);
+
+ addressof_dummy = 0;
+ got_signal = 0;
+ //qLog(Autotest) << "About to raise";
+
+ // Greenphone crashes here.
+ raise(SIGUSR2);
+
+ QCOMPARE(got_signal, SIGUSR2);
+ //qLog(Autotest) << "dummy:" << (void*)addressof_dummy << "stack:" << stack.ss_sp;
+ QVERIFY( (addressof_dummy > (char*)stack.ss_sp) && (addressof_dummy < (char*)stack.ss_sp + stack.ss_size) );
+#else
+ QSKIP("Test not valid on this platform", SkipAll);
+#endif
+}
+
+void tst_QAlternateStack::multipleInstances()
+{
+ if (!QAlternateStack::isAvailable()) {
+ QSKIP("QAlternateStack is not available on this platform.", SkipAll);
+ }
+
+ QVariantList list;
+ list.append( qVariantFromValue((QObject*)this) );
+
+ QAlternateStack stack1;
+ QAlternateStack stack2;
+ QAlternateStack stack3;
+ QAlternateStack stack4;
+
+ QList<QAlternateStack*> stacks;
+ stacks << &stack1 << &stack2 << &stack3 << &stack4;
+
+ // Verify the usual stack functions work as expected.
+ foreach (QAlternateStack* stack, stacks) {
+ m_stack = 0;
+ m_isActive = false;
+ m_isCurrentStack = false;
+ QVERIFY(!stack->isActive());
+ QVERIFY(!stack->isCurrentStack());
+
+ stack->start(stack_entry1, list);
+
+ QCOMPARE(m_stack, stack);
+ QVERIFY(m_isActive);
+ QVERIFY(m_isCurrentStack);
+ QVERIFY(!stack->isActive());
+ QVERIFY(!stack->isCurrentStack());
+ }
+
+ {
+ QList<QPair<int,QAlternateStack*> > expected;
+ expected
+ << qMakePair(1, &stack1)
+ << qMakePair(1, &stack2)
+ << qMakePair(1, &stack3)
+ << qMakePair(1, &stack4)
+ ;
+ QCOMPARE(m_stackEntries, expected);
+ m_stackEntries.clear();
+ }
+
+ // Verify the correct functions all get called as expected.
+ stack1.start(stack_entry1, list);
+ stack4.start(stack_entry4, list);
+ stack2.start(stack_entry2, list);
+ stack3.start(stack_entry3, list);
+ stack1.start(stack_entry1, list);
+ stack4.start(stack_entry4, list);
+ stack3.start(stack_entry3, list);
+
+ {
+ QList<QPair<int,QAlternateStack*> > expected;
+ expected
+ << qMakePair(1, &stack1)
+ << qMakePair(4, &stack4)
+ << qMakePair(2, &stack2)
+ << qMakePair(3, &stack3)
+ << qMakePair(1, &stack1)
+ << qMakePair(4, &stack4)
+ << qMakePair(3, &stack3)
+ ;
+
+ QCOMPARE(m_stackEntries, expected);
+ }
+}
+
+void tst_QAlternateStack::init()
+{
+ m_shouldSwitchFrom = 0;
+ m_stack = 0;
+ m_data = QVariant();
+ m_isActive = false;
+ m_isCurrentStack = false;
+}
+
+#include "tst_qalternatestack.moc"
diff --git a/tests/qtuitest/tst_qalternatestack/tst_qalternatestack.pro b/tests/qtuitest/tst_qalternatestack/tst_qalternatestack.pro
new file mode 100644
index 0000000..905e99c
--- /dev/null
+++ b/tests/qtuitest/tst_qalternatestack/tst_qalternatestack.pro
@@ -0,0 +1,10 @@
+TEMPLATE=app
+CONFIG+=unittest
+QT = core
+TARGET=tst_qalternatestack
+
+CONFIG-=debug_and_release_target
+
+SOURCES+= \
+ tst_qalternatestack.cpp
+
diff --git a/tests/qtuitest/tst_qelapsedtimer/tst_qelapsedtimer.cpp b/tests/qtuitest/tst_qelapsedtimer/tst_qelapsedtimer.cpp
new file mode 100644
index 0000000..feb2b56
--- /dev/null
+++ b/tests/qtuitest/tst_qelapsedtimer/tst_qelapsedtimer.cpp
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QTest>
+#include <QObject>
+#include <qtuitestelapsedtimer_p.h>
+
+//TESTED_COMPONENT=QA: Testing Framework (18707)
+
+class tst_QElapsedTimer : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void elapsed();
+};
+
+QTEST_MAIN(tst_QElapsedTimer)
+
+/*
+ \req QTOPIA-78
+
+ \groups
+*/
+void tst_QElapsedTimer::elapsed()
+{
+ QtUiTestElapsedTimer et;
+ et.start();
+
+ // Allow a lot of latency so the test doesn't break when the
+ // machine is under extreme load.
+ QVERIFY(et.elapsed() <= 1000);
+
+ QTest::qWait(5000);
+
+ QVERIFY(et.elapsed() >= 5000);
+ QVERIFY(et.elapsed() <= 30000);
+}
+
+#include "tst_qelapsedtimer.moc"
diff --git a/tests/qtuitest/tst_qelapsedtimer/tst_qelapsedtimer.pro b/tests/qtuitest/tst_qelapsedtimer/tst_qelapsedtimer.pro
new file mode 100644
index 0000000..e915e3b
--- /dev/null
+++ b/tests/qtuitest/tst_qelapsedtimer/tst_qelapsedtimer.pro
@@ -0,0 +1,9 @@
+TEMPLATE=app
+CONFIG+=unittest
+QT = core
+TARGET=tst_qelapsedtimer
+
+CONFIG-=debug_and_release_target
+
+SOURCES+= \
+ tst_qelapsedtimer.cpp
diff --git a/tests/qtuitest/tst_qinputgenerator/nativeevent.h b/tests/qtuitest/tst_qinputgenerator/nativeevent.h
new file mode 100644
index 0000000..f3b95ef
--- /dev/null
+++ b/tests/qtuitest/tst_qinputgenerator/nativeevent.h
@@ -0,0 +1,19 @@
+#ifndef NATIVEEVENT_H
+#define NATIVEEVENT_H
+
+#include <QList>
+#include <QPair>
+#include <QString>
+
+struct NativeEvent
+{
+ NativeEvent(void*);
+
+ static bool isInteresting(void*);
+
+ QString type;
+ QList<QPair<QString,QString> > things;
+};
+
+#endif
+
diff --git a/tests/qtuitest/tst_qinputgenerator/nativeevent_noop.cpp b/tests/qtuitest/tst_qinputgenerator/nativeevent_noop.cpp
new file mode 100644
index 0000000..411f2d4
--- /dev/null
+++ b/tests/qtuitest/tst_qinputgenerator/nativeevent_noop.cpp
@@ -0,0 +1,17 @@
+#include "nativeevent.h"
+
+NativeEvent::NativeEvent(void*)
+{}
+
+bool NativeEvent::isInteresting(void*)
+{
+ static bool warned = false;
+ if (!warned) {
+ warned = true;
+ qWarning("Don't understand native events, only logging Qt events.");
+ }
+
+ return false;
+}
+
+
diff --git a/tests/qtuitest/tst_qinputgenerator/nativeevent_x11.cpp b/tests/qtuitest/tst_qinputgenerator/nativeevent_x11.cpp
new file mode 100644
index 0000000..fc53441
--- /dev/null
+++ b/tests/qtuitest/tst_qinputgenerator/nativeevent_x11.cpp
@@ -0,0 +1,85 @@
+#include "nativeevent.h"
+
+#include <X11/Xlib.h>
+
+template <typename T>
+QString hexstr(T const& thing)
+{ return QString("0x%1").arg(thing, 8, 16, QLatin1Char('0')); }
+
+NativeEvent::NativeEvent(void* event)
+{
+ XEvent* e = static_cast<XEvent*>(event);
+
+#define GET_COMMON_THINGS(event) \
+ things << qMakePair(QString("serial"), hexstr(event->serial)); \
+ things << qMakePair(QString("send_event"), QString::number(event->send_event)); \
+ things << qMakePair(QString("x"), QString::number(event->x)); \
+ things << qMakePair(QString("y"), QString::number(event->y)); \
+ things << qMakePair(QString("x_root"), QString::number(event->x_root)); \
+ things << qMakePair(QString("y_root"), QString::number(event->y_root)); \
+ things << qMakePair(QString("state"), hexstr(event->state)); \
+ things << qMakePair(QString("same_screen"),QString("%1").arg(event->same_screen));
+
+ switch (e->type) {
+ case KeyPress:
+ case KeyRelease: {
+ if (e->type == KeyPress) type = "XKeyPressedEvent";
+ if (e->type == KeyRelease) type = "XKeyReleasedEvent";
+ XKeyEvent* xe = static_cast<XKeyEvent*>(event);
+ things << qMakePair(QString("keycode"), hexstr(xe->keycode));
+ GET_COMMON_THINGS(xe); }
+ break;
+
+ case ButtonPress:
+ case ButtonRelease: {
+ if (e->type == ButtonPress) type = "XButtonPressedEvent";
+ if (e->type == ButtonRelease) type = "XButtonReleasedEvent";
+ XButtonEvent* xe = static_cast<XButtonEvent*>(event);
+ things << qMakePair(QString("button"), hexstr(xe->button));
+ GET_COMMON_THINGS(xe); }
+ break;
+
+ case MotionNotify: {
+ type = "XMotionEvent";
+ XMotionEvent* xe = static_cast<XMotionEvent*>(event);
+ GET_COMMON_THINGS(xe); }
+ break;
+
+ case EnterNotify:
+ case LeaveNotify: {
+ if (e->type == EnterNotify) type = "XEnterWindowEvent";
+ if (e->type == LeaveNotify) type = "XLeaveWindowEvent";
+ XCrossingEvent* xe = static_cast<XCrossingEvent*>(event);
+ things << qMakePair(QString("focus"), QString("%1").arg(xe->focus));
+ GET_COMMON_THINGS(xe); }
+ break;
+
+ default:
+ type = QString("XEvent(type=%1)").arg(e->type);
+ break;
+ }
+}
+
+/* Returns true if the event is related to key or mouse inputs */
+bool NativeEvent::isInteresting(void* event)
+{
+ if (!event) return false;
+
+ XEvent* e = static_cast<XEvent*>(event);
+ switch (e->type) {
+ case KeyPress:
+ case KeyRelease:
+ case ButtonPress:
+ case ButtonRelease:
+ case MotionNotify:
+ case EnterNotify:
+ case LeaveNotify:
+ return true;
+ default:
+ break;
+ }
+
+ return false;
+}
+
+
diff --git a/tests/qtuitest/tst_qinputgenerator/tst_qinputgenerator.cpp b/tests/qtuitest/tst_qinputgenerator/tst_qinputgenerator.cpp
new file mode 100644
index 0000000..2c7d484
--- /dev/null
+++ b/tests/qtuitest/tst_qinputgenerator/tst_qinputgenerator.cpp
@@ -0,0 +1,756 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QAbstractEventDispatcher>
+#include <QDebug>
+#include <QObject>
+#include <QTest>
+#include <qinputgenerator_p.h>
+
+#include "nativeevent.h"
+
+//TESTED_COMPONENT=QA: Testing Framework (18707)
+
+struct TestKeyEvent {
+ enum Type { KeyPress, KeyRelease, KeyClick };
+
+ TestKeyEvent(TestKeyEvent::Type _type, Qt::Key _key, Qt::KeyboardModifiers _modifiers,
+ bool _autorepeat)
+ : type(_type)
+ , key(_key)
+ , modifiers(_modifiers)
+ , autorepeat(_autorepeat)
+ {}
+
+ TestKeyEvent::Type type;
+ Qt::Key key;
+ Qt::KeyboardModifiers modifiers;
+ bool autorepeat;
+};
+
+typedef QList<TestKeyEvent> TestKeyEventList;
+Q_DECLARE_METATYPE(TestKeyEventList);
+
+typedef QList<QKeyEvent> QKeyEventList;
+Q_DECLARE_METATYPE(QKeyEventList);
+
+struct TestMouseEvent {
+ enum Type {
+ MouseButtonPress,
+ MouseButtonRelease,
+ MouseButtonClick
+ };
+
+ TestMouseEvent(TestMouseEvent::Type _type, const QPoint& _pos, Qt::MouseButtons _buttons)
+ : type(_type)
+ , pos(_pos)
+ , buttons(_buttons)
+ {}
+
+ TestMouseEvent::Type type;
+ QPoint pos;
+ Qt::MouseButtons buttons;
+};
+
+typedef QList<TestMouseEvent> TestMouseEventList;
+Q_DECLARE_METATYPE(TestMouseEventList);
+
+typedef QList<QMouseEvent> QMouseEventList;
+Q_DECLARE_METATYPE(QMouseEventList);
+
+QString toString(QKeyEvent const& e)
+{
+ QString out;
+ out += (e.type() == QEvent::KeyPress) ? "press" : "release";
+ out += ", " + QString("key:0x%1").arg(e.key(),8,16,QLatin1Char('0'));
+ out += "," + QString("modifiers:0x%1").arg(e.modifiers(),8,16,QLatin1Char('0'));
+ out += "," + QString("isAutoRepeat:%1").arg(e.isAutoRepeat());
+ out += "," + QString("nativeModifiers:0x%1").arg(e.nativeModifiers(),8,16,QLatin1Char('0'));
+ out += "," + QString("nativeScanCode:0x%1").arg(e.nativeScanCode(),8,16,QLatin1Char('0'));
+ out += "," + QString("nativeVirtualKey:0x%1").arg(e.nativeVirtualKey(),8,16,QLatin1Char('0'));
+ out += ",text:" + e.text();
+ /*
+ Only check count if it has some text.
+ When doing a 'Shift' key or similar, whether or not there's a count depends on
+ the platform, so we'll treat it as undefined.
+ */
+ if (!e.text().isEmpty())
+ out += "," + QString("count:%1").arg(e.count());
+ return out;
+}
+
+QString toString(QKeyEventList const& l)
+{
+ QString out;
+ QString sep = " ";
+ for (int i = 0; i < l.count(); ++i) {
+ out += sep + toString(l.at(i));
+ sep = "\n ";
+ }
+ return out;
+}
+
+QString toString(QPoint const& p)
+{
+ return QString("(%1,%2)").arg(p.x()).arg(p.y());
+}
+
+QString toString(Qt::MouseButton b)
+{
+ switch (b) {
+ case Qt::NoButton:
+ return "0";
+ case Qt::LeftButton:
+ return "left";
+ case Qt::RightButton:
+ return "right";
+ case Qt::MidButton:
+ return "mid";
+ case Qt::XButton1:
+ return "xbutton1";
+ case Qt::XButton2:
+ return "xbutton2";
+ default:
+ return QString("0x%1").arg(b, 8, 16, QLatin1Char('0'));
+ }
+}
+
+QString toString(Qt::MouseButtons b)
+{
+ QString out;
+ if (!b || (b & (~Qt::MouseButtonMask))) {
+ out = QString("0x%1").arg(b,8,16,QLatin1Char('0'));
+ }
+ else {
+ static const Qt::MouseButton AllButtons[] = {
+ Qt::LeftButton,
+ Qt::RightButton,
+ Qt::MidButton,
+ Qt::XButton1,
+ Qt::XButton2
+ };
+ QString sep;
+ for (unsigned int i = 0; i < sizeof(AllButtons)/sizeof(AllButtons[0]); ++i) {
+ if (b & AllButtons[i]) {
+ out += sep + toString(Qt::MouseButton((int)(b & AllButtons[i])));
+ sep = "|";
+ }
+ }
+ }
+ return out;
+}
+
+QString toString(QMouseEvent const& e)
+{
+ QString out;
+ switch (e.type()) {
+ case QEvent::MouseButtonPress:
+ out += "press";
+ break;
+ case QEvent::MouseButtonRelease:
+ out += "release";
+ break;
+ case QEvent::MouseButtonDblClick:
+ out += "doubleclick";
+ break;
+ case QEvent::MouseMove:
+ out += "move";
+ break;
+ default:
+ out += "unknown_type";
+ }
+ out += ", "+ QString("pos:%1").arg(toString(e.pos()));
+ out += "," + QString("globalPos:%1").arg(toString(e.globalPos()));
+ out += "," + QString("button:%1").arg(toString(e.button()));
+ out += "," + QString("buttons:%1").arg(toString(e.buttons()));
+ out += "," + QString("modifiers:0x%1").arg(e.modifiers(),8,16,QLatin1Char('0'));
+ return out;
+}
+
+QString toString(QMouseEventList const& l)
+{
+ QString out;
+ QString sep = " ";
+ for (int i = 0; i < l.count(); ++i) {
+ out += sep + toString(l.at(i));
+ sep = "\n ";
+ }
+ return out;
+}
+
+QString toString(NativeEvent const& e)
+{
+ QString out;
+ out += e.type;
+
+ QString sep = " ";
+ typedef QPair<QString,QString> StringPair;
+ foreach (StringPair const& p, e.things) {
+ out += sep + p.first + ":" + p.second;
+ sep = ",";
+ }
+
+ return out;
+}
+
+namespace QTest {
+template<>
+inline bool qCompare(QKeyEvent const &e1, QKeyEvent const &e2,
+ const char* actual, const char* expected, const char* file, int line)
+{
+ return qCompare(toString(e1), toString(e2), actual, expected, file, line);
+}
+template<>
+inline bool qCompare(QMouseEvent const &e1, QMouseEvent const &e2,
+ const char* actual, const char* expected, const char* file, int line)
+{
+ return qCompare(toString(e1), toString(e2), actual, expected, file, line);
+}
+}
+
+
+class tst_QInputGenerator : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_QInputGenerator();
+ void eventTest();
+
+private slots:
+ void keyEvent();
+ void keyEvent_data();
+ void mouseEvent();
+ void mouseEvent_data();
+ void initTestCase();
+ void init();
+
+private:
+ template <typename T>
+ bool waitForCount(QList<T> const* list, int howmany, int timeout = 5000);
+ bool eventFilter(QObject*, QEvent*);
+ template <typename T1, typename T2>
+ static void dumpEvents(QList<T1> const& actual, QList<T2> const& expected);
+ static bool nativeEventFilter(void* event);
+
+private:
+ QList<QKeyEvent> m_keyEvents;
+ QList<QMouseEvent> m_mouseEvents;
+ QEventLoop* m_eventTestLoop;
+ QTime m_eventTestTime;
+ static tst_QInputGenerator* s_eventTestInstance;
+};
+tst_QInputGenerator* tst_QInputGenerator::s_eventTestInstance = 0;
+
+tst_QInputGenerator::tst_QInputGenerator()
+ : QObject()
+ , m_keyEvents()
+ , m_mouseEvents()
+ , m_eventTestLoop(0)
+ , m_eventTestTime()
+{
+}
+
+void tst_QInputGenerator::initTestCase()
+{
+ qApp->installEventFilter(this);
+}
+
+void tst_QInputGenerator::init()
+{
+ m_keyEvents.clear();
+ m_mouseEvents.clear();
+}
+
+void tst_QInputGenerator::keyEvent()
+{
+ QFETCH(TestKeyEventList, testEvents);
+ QFETCH(QKeyEventList, qtEvents);
+
+ QWidget w;
+ w.setFocus();
+ w.setFixedSize(1024, 768);
+ w.show();
+
+ QInputGenerator input;
+
+ /* Simulate all test events. */
+ while (testEvents.count()) {
+ TestKeyEvent next = testEvents.takeFirst();
+
+ if (next.type == TestKeyEvent::KeyPress) {
+ input.keyPress(next.key, next.modifiers, next.autorepeat);
+ }
+ else if (next.type == TestKeyEvent::KeyRelease) {
+ input.keyRelease(next.key, next.modifiers);
+ }
+ else if (next.type == TestKeyEvent::KeyClick) {
+ input.keyClick(next.key, next.modifiers);
+ }
+ }
+
+ /* Wait until we get the expected amount of qt events. */
+ if (m_keyEvents.count() < qtEvents.count()) {
+ bool waited = waitForCount(&m_keyEvents, qtEvents.count());
+ if (!waited) {
+ dumpEvents(m_keyEvents, qtEvents);
+ }
+ QVERIFY2(waited, qPrintable(QString("Expected %1 QKeyEvent(s) but got %2").arg(qtEvents.count()).arg(m_keyEvents.count())));
+ }
+
+ /* Compare actual qt events with expected. */
+ for (int i = 0; i < qtEvents.count(); ++i) {
+ const QKeyEvent& actual = m_keyEvents[i];
+ const QKeyEvent& expected = qtEvents[i];
+ if (!QTest::qCompare(actual, expected, "actual", "expected", __FILE__, __LINE__)) {
+ dumpEvents(m_keyEvents, qtEvents);
+ return;
+ }
+ }
+}
+
+void tst_QInputGenerator::keyEvent_data()
+{
+ QTest::addColumn<TestKeyEventList>("testEvents");
+ QTest::addColumn<QKeyEventList> ("qtEvents");
+
+ /* Make event definition a little less verbose... */
+#define TE(Type,K,Mod,Repeat) TestKeyEvent(TestKeyEvent::Key##Type, Qt::Key_##K, Mod, Repeat)
+#define QE(Type,K,Mod,Text,Repeat,Count) QKeyEvent(QEvent::Key##Type, Qt::Key_##K, Mod, QLatin1String(Text), Repeat, Count)
+ QTest::newRow("a (press only)")
+ << (TestKeyEventList() << TE(Press, A, 0, false))
+ << (QKeyEventList() << QE(Press, A, 0, "a", false, 1))
+ ;
+ QTest::newRow("a (release only)")
+ << (TestKeyEventList() << TE(Release, A, 0, false))
+ << (QKeyEventList() << QE(Release, A, 0, "a", false, 1))
+ ;
+ QTest::newRow("autorepeat b")
+ << (TestKeyEventList()
+ << TE(Press, B, 0, false)
+ /*
+ << TE(Press, B, 0, true)
+ << TE(Press, B, 0, true)
+ << TE(Press, B, 0, true)
+ << TE(Press, B, 0, true)
+ << TE(Press, B, 0, true)
+ */
+ << TE(Release, B, 0, false)
+
+ )
+ << (QKeyEventList()
+ << QE(Press, B, 0, "b", false, 1)
+ /*
+ << QE(Press, B, 0, "b", true, 1)
+ << QE(Press, B, 0, "b", true, 1)
+ << QE(Press, B, 0, "b", true, 1)
+ << QE(Press, B, 0, "b", true, 1)
+ << QE(Press, B, 0, "b", true, 1)
+ */
+ << QE(Release, B, 0, "b", false, 1)
+ )
+ ;
+ QTest::newRow("dog")
+ << (TestKeyEventList()
+ << TE(Click, D, 0, false)
+ << TE(Click, O, 0, false)
+ << TE(Click, G, 0, false)
+ )
+ << (QKeyEventList()
+ << QE(Press, D, 0, "d", false, 1) << QE(Release, D, 0, "d", false, 1)
+ << QE(Press, O, 0, "o", false, 1) << QE(Release, O, 0, "o", false, 1)
+ << QE(Press, G, 0, "g", false, 1) << QE(Release, G, 0, "g", false, 1)
+ )
+ ;
+ QTest::newRow("mIXEd caSE")
+ << (TestKeyEventList()
+ << TE(Click, M, 0, false)
+ << TE(Click, I, Qt::ShiftModifier, false)
+ << TE(Click, X, Qt::ShiftModifier, false)
+ << TE(Click, E, Qt::ShiftModifier, false)
+ << TE(Click, D, 0, false)
+ << TE(Click, Space, 0, false)
+ << TE(Click, C, 0, false)
+ << TE(Click, A, 0, false)
+ << TE(Click, S, Qt::ShiftModifier, false)
+ << TE(Click, E, Qt::ShiftModifier, false)
+ )
+ << (QKeyEventList()
+ << QE(Press, M, 0, "m", false, 1) << QE(Release, M, 0, "m", false, 1)
+ << QE(Press, Shift, 0, "", false, 0)
+ << QE(Press, I, Qt::ShiftModifier, "I", false, 1) << QE(Release, I, Qt::ShiftModifier, "I", false, 1)
+ << QE(Press, X, Qt::ShiftModifier, "X", false, 1) << QE(Release, X, Qt::ShiftModifier, "X", false, 1)
+ << QE(Press, E, Qt::ShiftModifier, "E", false, 1) << QE(Release, E, Qt::ShiftModifier, "E", false, 1)
+ << QE(Release, Shift, Qt::ShiftModifier, "", false, 0)
+ << QE(Press, D, 0, "d", false, 1) << QE(Release, D, 0, "d", false, 1)
+ << QE(Press, Space, 0, " ", false, 1) << QE(Release, Space, 0, " ", false, 1)
+ << QE(Press, C, 0, "c", false, 1) << QE(Release, C, 0, "c", false, 1)
+ << QE(Press, A, 0, "a", false, 1) << QE(Release, A, 0, "a", false, 1)
+ << QE(Press, Shift, 0, "", false, 0)
+ << QE(Press, S, Qt::ShiftModifier, "S", false, 1) << QE(Release, S, Qt::ShiftModifier, "S", false, 1)
+ << QE(Press, E, Qt::ShiftModifier, "E", false, 1) << QE(Release, E, Qt::ShiftModifier, "E", false, 1)
+ )
+ ;
+#undef TE
+#undef QE
+}
+
+void tst_QInputGenerator::mouseEvent()
+{
+ QFETCH(TestMouseEventList, testEvents);
+ QFETCH(QMouseEventList, qtEvents);
+
+ QWidget w1(0, Qt::FramelessWindowHint);
+ w1.setFocus();
+ w1.setGeometry(0, 0, 100, 100);
+ w1.setMouseTracking(false);
+ w1.show();
+
+ QWidget w2(0, Qt::FramelessWindowHint);
+ w2.setFocus();
+ w2.setGeometry(100, 0, 100, 100);
+ w2.setMouseTracking(false);
+ w2.show();
+
+ QWidget w3(0, Qt::FramelessWindowHint);
+ w3.setFocus();
+ w3.setGeometry(0, 100, 100, 100);
+ w3.setMouseTracking(false);
+ w3.show();
+
+ QWidget w4(0, Qt::FramelessWindowHint);
+ w4.setFocus();
+ w4.setGeometry(100, 100, 100, 100);
+ w4.setMouseTracking(false);
+ w4.show();
+
+ /* Make sure we go slow enough to avoid accidental double clicks */
+ int dblclick = qApp->doubleClickInterval();
+ QTest::qWait(dblclick);
+
+ QInputGenerator input;
+
+ /* Simulate all test events. */
+ while (testEvents.count()) {
+ TestMouseEvent next = testEvents.takeFirst();
+
+ if (next.type == TestMouseEvent::MouseButtonPress) {
+ input.mousePress(next.pos, next.buttons);
+ }
+ else if (next.type == TestMouseEvent::MouseButtonRelease) {
+ input.mouseRelease(next.pos, next.buttons);
+ }
+ else if (next.type == TestMouseEvent::MouseButtonClick) {
+ input.mouseClick(next.pos, next.buttons);
+ }
+ }
+
+ /* Wait until we get the expected amount of qt events. */
+ if (m_mouseEvents.count() < qtEvents.count()) {
+ bool waited = waitForCount(&m_mouseEvents, qtEvents.count());
+ if (!waited) {
+ dumpEvents(m_mouseEvents, qtEvents);
+ }
+ QVERIFY2(waited, qPrintable(QString("Expected %1 QMouseEvent(s) but got %2").arg(qtEvents.count()).arg(m_mouseEvents.count())));
+ }
+
+ /* Compare actual qt events with expected. */
+ for (int i = 0; i < qtEvents.count(); ++i) {
+ const QMouseEvent& actual = m_mouseEvents[i];
+ const QMouseEvent& expected = qtEvents[i];
+ if (!QTest::qCompare(actual, expected, "actual", "expected", __FILE__, __LINE__)) {
+ dumpEvents(m_mouseEvents, qtEvents);
+ return;
+ }
+ }
+}
+
+void tst_QInputGenerator::mouseEvent_data()
+{
+ QTest::addColumn<TestMouseEventList>("testEvents");
+ QTest::addColumn<QMouseEventList> ("qtEvents");
+
+ /*
+ To test mapping of global to local positions, 4 widgets are laid out in a 2x2 grid.
+ Each widget is 100x100 in size. The widgets are arranged so they sit exactly in the
+ top left 200x200 of the screen. The widgets are asked to be frameless.
+ */
+
+ /* Make event definition a little less verbose... */
+#define TE(Type,Pos,Buttons) TestMouseEvent(TestMouseEvent::Mouse##Type, Pos, Buttons)
+#define QE(Type,Pos,GlobalPos,Button,Buttons,Mod) QMouseEvent(QEvent::Mouse##Type, Pos, GlobalPos,Qt::MouseButton(Button),Buttons,Mod)
+ QTest::newRow("single left press, tl")
+ << (TestMouseEventList() << TE(ButtonPress, QPoint(50,50), Qt::LeftButton))
+ << (QMouseEventList() << QE(ButtonPress, QPoint(50,50), QPoint(50,50), Qt::LeftButton, Qt::LeftButton, 0))
+ ;
+ QTest::newRow("single left press, tr")
+ << (TestMouseEventList() << TE(ButtonPress, QPoint(150,50), Qt::LeftButton))
+ << (QMouseEventList() << QE(ButtonPress, QPoint(50,50), QPoint(150,50), Qt::LeftButton, Qt::LeftButton, 0))
+ ;
+ QTest::newRow("single left press, bl")
+ << (TestMouseEventList() << TE(ButtonPress, QPoint(25,150), Qt::LeftButton))
+ << (QMouseEventList() << QE(ButtonPress, QPoint(25,50), QPoint(25,150), Qt::LeftButton, Qt::LeftButton, 0))
+ ;
+ QTest::newRow("single left press, br")
+ << (TestMouseEventList() << TE(ButtonPress, QPoint(150,125),Qt::LeftButton))
+ << (QMouseEventList() << QE(ButtonPress, QPoint(50,25), QPoint(150,125),Qt::LeftButton, Qt::LeftButton, 0))
+ ;
+
+ QTest::newRow("single right click, tl")
+ << (TestMouseEventList() << TE(ButtonClick, QPoint(50,50), Qt::RightButton))
+ << (QMouseEventList()
+ << QE(ButtonPress, QPoint(50,50), QPoint(50,50), Qt::RightButton, Qt::RightButton, 0)
+ << QE(ButtonRelease, QPoint(50,50), QPoint(50,50), Qt::RightButton, 0, 0)
+ )
+ ;
+ QTest::newRow("single right click, tr")
+ << (TestMouseEventList() << TE(ButtonClick, QPoint(150,50), Qt::RightButton))
+ << (QMouseEventList()
+ << QE(ButtonPress, QPoint(50,50), QPoint(150,50), Qt::RightButton, Qt::RightButton, 0)
+ << QE(ButtonRelease, QPoint(50,50), QPoint(150,50), Qt::RightButton, 0, 0)
+ )
+ ;
+ QTest::newRow("single right click, bl")
+ << (TestMouseEventList() << TE(ButtonClick, QPoint(25,150), Qt::RightButton))
+ << (QMouseEventList()
+ << QE(ButtonPress, QPoint(25,50), QPoint(25,150), Qt::RightButton, Qt::RightButton, 0)
+ << QE(ButtonRelease, QPoint(25,50), QPoint(25,150), Qt::RightButton, 0, 0)
+ )
+ ;
+ QTest::newRow("single right click, br")
+ << (TestMouseEventList() << TE(ButtonClick, QPoint(150,125),Qt::RightButton))
+ << (QMouseEventList()
+ << QE(ButtonPress, QPoint(50,25), QPoint(150,125), Qt::RightButton, Qt::RightButton, 0)
+ << QE(ButtonRelease, QPoint(50,25), QPoint(150,125), Qt::RightButton, 0, 0)
+ )
+ ;
+
+ QTest::newRow("double middle click")
+ << (TestMouseEventList()
+ << TE(ButtonClick, QPoint(20,30),Qt::MidButton)
+ << TE(ButtonClick, QPoint(20,30),Qt::MidButton)
+ )
+ << (QMouseEventList()
+ << QE(ButtonPress, QPoint(20,30), QPoint(20,30), Qt::MidButton, Qt::MidButton, 0)
+ << QE(ButtonRelease, QPoint(20,30), QPoint(20,30), Qt::MidButton, 0, 0)
+ << QE(ButtonDblClick, QPoint(20,30), QPoint(20,30), Qt::MidButton, Qt::MidButton, 0)
+ << QE(ButtonRelease, QPoint(20,30), QPoint(20,30), Qt::MidButton, 0, 0)
+ )
+ ;
+
+ QTest::newRow("middle drag")
+ << (TestMouseEventList()
+ << TE(ButtonPress, QPoint(20,30),Qt::MidButton)
+ << TE(ButtonPress, QPoint(20,31),Qt::MidButton)
+ << TE(ButtonPress, QPoint(21,32),Qt::MidButton)
+ << TE(ButtonPress, QPoint(21,33),Qt::MidButton)
+ << TE(ButtonPress, QPoint(22,34),Qt::MidButton)
+ << TE(ButtonPress, QPoint(22,35),Qt::MidButton)
+ << TE(ButtonPress, QPoint(23,36),Qt::MidButton)
+ << TE(ButtonPress, QPoint(23,37),Qt::MidButton)
+ << TE(ButtonPress, QPoint(24,38),Qt::MidButton)
+ << TE(ButtonPress, QPoint(24,39),Qt::MidButton)
+ << TE(ButtonRelease, QPoint(25,40),Qt::MidButton)
+ )
+ << (QMouseEventList()
+ << QE(ButtonPress, QPoint(20,30), QPoint(20,30), Qt::MidButton, Qt::MidButton, 0)
+ /* Note, exactly how many move events we expect depends on platform... */
+ << QE(Move, QPoint(25,40), QPoint(25,40), 0, Qt::MidButton, 0)
+ << QE(ButtonRelease, QPoint(25,40), QPoint(25,40), Qt::MidButton, 0, 0)
+ )
+ ;
+
+ QTest::newRow("multiple buttons with shaky hands")
+ << (TestMouseEventList()
+ << TE(ButtonPress, QPoint(110,120),Qt::MidButton)
+ << TE(ButtonPress, QPoint(110,125),Qt::RightButton)
+ << TE(ButtonPress, QPoint(105,105),Qt::LeftButton)
+ << TE(ButtonRelease, QPoint(105,107),Qt::RightButton)
+ << TE(ButtonRelease, QPoint(110,119),Qt::MidButton)
+ << TE(ButtonPress, QPoint(110,112),Qt::RightButton)
+ << TE(ButtonRelease, QPoint(103,102),Qt::LeftButton)
+ << TE(ButtonRelease, QPoint(111,103),Qt::RightButton)
+ )
+ << (QMouseEventList()
+ << QE(ButtonPress, QPoint(10,20),QPoint(110,120), Qt::MidButton, Qt::MidButton, 0)
+
+ << QE(Move, QPoint(10,25),QPoint(110,125), 0, Qt::MidButton, 0)
+ << QE(ButtonPress, QPoint(10,25),QPoint(110,125), Qt::RightButton, Qt::MidButton|Qt::RightButton, 0)
+
+ << QE(Move, QPoint(5,5), QPoint(105,105), 0, Qt::MidButton|Qt::RightButton, 0)
+ << QE(ButtonPress, QPoint(5,5), QPoint(105,105), Qt::LeftButton, Qt::MidButton|Qt::RightButton|Qt::LeftButton, 0)
+
+ << QE(Move, QPoint(5,7), QPoint(105,107), 0, Qt::MidButton|Qt::RightButton|Qt::LeftButton, 0)
+ << QE(ButtonRelease, QPoint(5,7), QPoint(105,107), Qt::RightButton, Qt::MidButton|Qt::LeftButton, 0)
+
+ << QE(Move, QPoint(10,19),QPoint(110,119), 0, Qt::MidButton|Qt::LeftButton, 0)
+ << QE(ButtonRelease, QPoint(10,19),QPoint(110,119), Qt::MidButton, Qt::LeftButton, 0)
+
+ << QE(Move, QPoint(10,12),QPoint(110,112), 0, Qt::LeftButton, 0)
+ << QE(ButtonPress, QPoint(10,12),QPoint(110,112), Qt::RightButton, Qt::LeftButton|Qt::RightButton, 0)
+
+ << QE(Move, QPoint(3,2), QPoint(103,102), 0, Qt::LeftButton|Qt::RightButton, 0)
+ << QE(ButtonRelease, QPoint(3,2), QPoint(103,102), Qt::LeftButton, Qt::RightButton, 0)
+
+ << QE(Move, QPoint(11,3), QPoint(111,103), 0, Qt::RightButton, 0)
+ << QE(ButtonRelease, QPoint(11,3), QPoint(111,103), Qt::RightButton, 0, 0)
+ )
+ ;
+#undef TE
+#undef QE
+}
+
+bool tst_QInputGenerator::nativeEventFilter(void* event)
+{
+ tst_QInputGenerator* that = tst_QInputGenerator::s_eventTestInstance;
+ if (!that || !that->m_eventTestLoop) return false;
+
+ if (NativeEvent::isInteresting(event)) {
+ qDebug() << that->m_eventTestTime.elapsed() << qPrintable(toString(NativeEvent(event)));
+ that->m_eventTestLoop->quit();
+ }
+
+ return false;
+}
+
+void tst_QInputGenerator::eventTest()
+{
+ qApp->installEventFilter(this);
+ QAbstractEventDispatcher* dispatch = QAbstractEventDispatcher::instance();
+ dispatch->setEventFilter(tst_QInputGenerator::nativeEventFilter);
+ tst_QInputGenerator::s_eventTestInstance = this;
+
+ m_eventTestTime.start();
+
+ QWidget w;
+ w.setFixedSize(800,600);
+ w.show();
+
+ QEventLoop loop;
+ m_eventTestLoop = &loop;
+
+ qDebug() << "Running event test; use keyboard/mouse to interact with displayed widget.";
+ while (w.isVisible()) {
+ loop.exec();
+ }
+ m_eventTestLoop = 0;
+}
+
+bool tst_QInputGenerator::eventFilter(QObject* o, QEvent* e)
+{
+ QEvent::Type type = e->type();
+ if (type == QEvent::KeyPress || type == QEvent::KeyRelease) {
+ if (m_eventTestLoop) {
+ qDebug() << m_eventTestTime.elapsed() << "key" << qPrintable(toString(*static_cast<QKeyEvent*>(e)));
+ m_eventTestLoop->quit();
+ goto end;
+ }
+ m_keyEvents << *static_cast<QKeyEvent*>(e);
+ }
+ else if (type >= QEvent::MouseButtonPress && type <= QEvent::MouseMove) {
+ /*
+ Even when mouse tracking is turned off, Qt still generates events for mouse
+ moves on some platforms. Discard them, since it's unpredictable how many
+ there might be.
+ */
+ QMouseEvent* me = static_cast<QMouseEvent*>(e);
+ if (type == QEvent::MouseMove && o->isWidgetType()
+ && !static_cast<QWidget*>(o)->hasMouseTracking() && !me->buttons()) {
+ }
+ else {
+ if (m_eventTestLoop) {
+ qDebug() << m_eventTestTime.elapsed() << "mouse" << qPrintable(toString(*me));
+ m_eventTestLoop->quit();
+ goto end;
+ }
+ m_mouseEvents << *me;
+ }
+ }
+
+end:
+ return QObject::eventFilter(o,e);
+}
+
+template <typename T>
+bool tst_QInputGenerator::waitForCount(QList<T> const* list, int howmany, int timeout)
+{
+ while (list->count() < howmany && timeout > 0) {
+ QTest::qWait(10);
+ timeout -= 10;
+ }
+ return (list->count() >= howmany);
+}
+
+template <typename T1, typename T2>
+void tst_QInputGenerator::dumpEvents(QList<T1> const& actual, QList<T2> const& expected)
+{
+ qWarning("Events leading up to failure:");
+ qWarning("Actual:");
+ for (int i = 0; i < actual.count(); ++i) {
+ qWarning(qPrintable(QString(" %1").arg(toString(actual.at(i)))));
+ }
+ qWarning("Expected:");
+ for (int i = 0; i < expected.count(); ++i) {
+ qWarning(qPrintable(QString(" %1").arg(toString(expected.at(i)))));
+ }
+}
+
+#include "tst_qinputgenerator.moc"
+
+int main(int argc, char** argv)
+{
+ QApplication app(argc, argv);
+
+ bool eventTest = false;
+ for (int i = 0; i < argc; ++i) {
+ if (QByteArray(argv[i]) == "eventTest") {
+ eventTest = true;
+ }
+ }
+
+ tst_QInputGenerator test;
+ if (eventTest) {
+ test.eventTest();
+ return 0;
+ }
+ return QTest::qExec(&test, argc, argv);
+}
+
diff --git a/tests/qtuitest/tst_qinputgenerator/tst_qinputgenerator.pro b/tests/qtuitest/tst_qinputgenerator/tst_qinputgenerator.pro
new file mode 100644
index 0000000..ac0d31d
--- /dev/null
+++ b/tests/qtuitest/tst_qinputgenerator/tst_qinputgenerator.pro
@@ -0,0 +1,17 @@
+TEMPLATE=app
+CONFIG+=unittest
+QT = core gui
+TARGET=tst_qinputgenerator
+
+CONFIG-=debug_and_release_target
+
+SOURCES+= \
+ tst_qinputgenerator.cpp
+
+unix:!mac:!embedded:!symbian {
+ SOURCES+=nativeevent_x11.cpp
+}
+else {
+ SOURCES+=nativeevent_noop.cpp
+}
+
diff --git a/tests/qtuitest/tst_qtestprotocol/testprotocol.cpp b/tests/qtuitest/tst_qtestprotocol/testprotocol.cpp
new file mode 100644
index 0000000..a597d08
--- /dev/null
+++ b/tests/qtuitest/tst_qtestprotocol/testprotocol.cpp
@@ -0,0 +1,49 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testprotocol.h"
+
+QList<QTestMessage>& TestProtocol::messages()
+{ return m_messages; }
+
+void TestProtocol::processMessage(QTestMessage* message)
+{ m_messages << *message; }
+
diff --git a/tests/qtuitest/tst_qtestprotocol/testprotocol.h b/tests/qtuitest/tst_qtestprotocol/testprotocol.h
new file mode 100644
index 0000000..ed926c6
--- /dev/null
+++ b/tests/qtuitest/tst_qtestprotocol/testprotocol.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTPROTOCOL_H
+#define TESTPROTOCOL_H
+
+#include "qtestprotocol_p.h"
+
+/*
+ Test protocol which simply stores received messages in a list.
+*/
+class TestProtocol : public QTestProtocol
+{
+ Q_OBJECT
+
+public:
+ QList<QTestMessage>& messages();
+
+protected:
+ void processMessage(QTestMessage*);
+
+private:
+ QList<QTestMessage> m_messages;
+};
+
+#endif
+
diff --git a/tests/qtuitest/tst_qtestprotocol/testprotocolserver.cpp b/tests/qtuitest/tst_qtestprotocol/testprotocolserver.cpp
new file mode 100644
index 0000000..9ad77cc
--- /dev/null
+++ b/tests/qtuitest/tst_qtestprotocol/testprotocolserver.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "testprotocolserver.h"
+
+TestProtocolServer::TestProtocolServer(QObject* parent)
+ : QTcpServer(parent)
+{}
+
+TestProtocolServer::~TestProtocolServer()
+{}
+
+TestProtocol* TestProtocolServer::nextPendingConnection()
+{
+ if (!m_pendingConnections.count())
+ return 0;
+ return m_pendingConnections.takeFirst();
+}
+
+bool TestProtocolServer::hasPendingConnections() const
+{ return m_pendingConnections.count(); }
+
+void TestProtocolServer::incomingConnection(int socket)
+{
+ if (m_pendingConnections.count() >= maxPendingConnections())
+ return;
+
+ TestProtocol* ret = new TestProtocol;
+ ret->setParent(this);
+ ret->setSocket(socket);
+ m_pendingConnections << ret;
+}
+
diff --git a/tests/qtuitest/tst_qtestprotocol/testprotocolserver.h b/tests/qtuitest/tst_qtestprotocol/testprotocolserver.h
new file mode 100644
index 0000000..b6c2e39
--- /dev/null
+++ b/tests/qtuitest/tst_qtestprotocol/testprotocolserver.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef TESTPROTOCOLSERVER_H
+#define TESTPROTOCOLSERVER_H
+
+#include <QTcpServer>
+#include <QList>
+
+#include "testprotocol.h"
+
+/*
+ TCP server which creates QTestProtocols instead of QTcpSockets.
+*/
+class TestProtocolServer : public QTcpServer
+{
+ Q_OBJECT
+
+public:
+ TestProtocolServer(QObject* =0);
+ virtual ~TestProtocolServer();
+
+ virtual TestProtocol* nextPendingConnection();
+ virtual bool hasPendingConnections() const;
+
+protected:
+ virtual void incomingConnection(int);
+
+private:
+ QList<TestProtocol*> m_pendingConnections;
+};
+
+#endif
+
diff --git a/tests/qtuitest/tst_qtestprotocol/tst_qtestprotocol.cpp b/tests/qtuitest/tst_qtestprotocol/tst_qtestprotocol.cpp
new file mode 100644
index 0000000..cba330e
--- /dev/null
+++ b/tests/qtuitest/tst_qtestprotocol/tst_qtestprotocol.cpp
@@ -0,0 +1,192 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QTest>
+
+// for m_map
+#define protected public
+# include "qtestprotocol_p.h"
+#undef protected
+
+#include "testprotocol.h"
+#include "testprotocolserver.h"
+
+//TESTED_COMPONENT=QA: Testing Framework (18707)
+
+class tst_QTestProtocol : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void postMessage();
+ void postMessage_data();
+};
+
+QTEST_MAIN(tst_QTestProtocol)
+
+/*
+ Comparison for QTestMessage.
+*/
+namespace QTest {
+template<>
+inline bool qCompare
+ (QTestMessage const &m1, QTestMessage const &m2,
+ const char* actual, const char* expected, const char* file, int line)
+{
+#define COMPARE_MEMBER(a,b,args...) \
+ qCompare(a.args, b.args, \
+ qPrintable(QString("%1.%2").arg(actual).arg(#args)), \
+ qPrintable(QString("%1.%2").arg(expected).arg(#args)), \
+ file, line)
+
+ return COMPARE_MEMBER(m1,m2,event())
+ && COMPARE_MEMBER(m1,m2,toString())
+ && COMPARE_MEMBER(m1,m2,m_map);
+
+#undef COMPARE_MEMBER
+}
+}
+
+/*
+ \req QTOPIA-78
+
+ \groups
+ Simply tests that messages can be sent correctly without becoming corrupt.
+*/
+void tst_QTestProtocol::postMessage_data()
+{
+ QTest::addColumn<QTestMessage>("message");
+
+ QTest::newRow("empty")
+ << QTestMessage();
+
+ QTest::newRow("simple, no map")
+ << QTestMessage("foo");
+
+ {
+ QVariantMap vm;
+ vm["foo"] = 1;
+ vm["bar"] = "Hello.";
+
+ QTest::newRow("simple, small map")
+ << QTestMessage("foobar", vm);
+ }
+
+ {
+ QByteArray ba;
+ while (ba.size() < 1024*1024*10)
+ ba.append("zoop");
+
+ QVariantMap vm;
+ vm["aaa"] = "A";
+ vm["bbb"] = ba;
+ vm["ccc"] = "C";
+
+ QTest::newRow("10 Mb")
+ << QTestMessage("big_test", vm);
+ }
+}
+
+// Will try to wait for the condition while allowing event processing
+#define QTRY_COMPARE(__expr, __expected) \
+ do { \
+ const int __step = 50; \
+ const int __timeout = 5000; \
+ if ((__expr) != (__expected)) { \
+ QTest::qWait(0); \
+ } \
+ for (int __i = 0; __i < __timeout && ((__expr) != (__expected)); __i+=__step) { \
+ QTest::qWait(__step); \
+ } \
+ QCOMPARE(__expr, __expected); \
+ } while(0)
+
+void tst_QTestProtocol::postMessage()
+{
+ // Start a server to listen for connections.
+ TestProtocolServer server;
+ QVERIFY(server.listen());
+
+ // Create a test protocol which connects to the server.
+ TestProtocol* clientP = new TestProtocol;
+ clientP->setParent(&server);
+ clientP->connect( "127.0.0.1", server.serverPort() );
+
+ QVERIFY( clientP->waitForConnected(1000) );
+ QVERIFY( server.hasPendingConnections() );
+
+ // Get the protocol which should have been created on the server side
+ TestProtocol* serverP = server.nextPendingConnection();
+ QVERIFY( serverP );
+ // Should be no further connections
+ QVERIFY( !server.hasPendingConnections() );
+
+ // OK, now we have two peers. They should both be connected by now.
+ QVERIFY( clientP->isConnected() );
+ QVERIFY( serverP->isConnected() );
+
+ QList<QTestMessage>& clientMessages = clientP->messages();
+ QList<QTestMessage>& serverMessages = serverP->messages();
+
+ QFETCH(QTestMessage, message);
+
+ // Try sending the message from client to server.
+ uint post_id = clientP->postMessage(message);
+ QVERIFY(post_id);
+ QCOMPARE(serverMessages.count(), 0);
+ QTRY_COMPARE(serverMessages.count(), 1);
+
+ // Verify the message is OK.
+ QCOMPARE(serverMessages.takeFirst(), message);
+
+
+ // Try sending the message from server to client.
+ post_id = serverP->postMessage(message);
+ QVERIFY(post_id);
+ QCOMPARE(clientMessages.count(), 0);
+ QTRY_COMPARE(clientMessages.count(), 1);
+
+ // Verify the message is OK.
+ QCOMPARE(clientMessages.takeFirst(), message);
+}
+
+#include "tst_qtestprotocol.moc"
+
diff --git a/tests/qtuitest/tst_qtestprotocol/tst_qtestprotocol.pro b/tests/qtuitest/tst_qtestprotocol/tst_qtestprotocol.pro
new file mode 100644
index 0000000..3f6e0b4
--- /dev/null
+++ b/tests/qtuitest/tst_qtestprotocol/tst_qtestprotocol.pro
@@ -0,0 +1,19 @@
+TEMPLATE=app
+CONFIG+=unittest
+QT = core network
+TARGET=tst_qtestprotocol
+
+CONFIG-=debug_and_release_target
+
+SOURCES+= \
+ tst_qtestprotocol.cpp \
+ testprotocol.cpp \
+ testprotocolserver.cpp
+
+HEADERS+= \
+ testprotocol.h \
+ testprotocolserver.h
+
+symbian {
+ LIBS+=-L$$OUT_PWD/ -lqtuitest
+}
diff --git a/tests/qtuitest/tst_qtuitestnamespace/tst_qtuitestnamespace.cpp b/tests/qtuitest/tst_qtuitestnamespace/tst_qtuitestnamespace.cpp
new file mode 100644
index 0000000..64b5a32
--- /dev/null
+++ b/tests/qtuitest/tst_qtuitestnamespace/tst_qtuitestnamespace.cpp
@@ -0,0 +1,898 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QT_NO_DEBUG
+#define QT_NO_DEBUG 1
+#endif
+
+#include <QAction>
+#include <QCoreApplication>
+#include <QObject>
+#include <QTest>
+
+#include <qalternatestack_p.h>
+#include <qtuitestconnectionmanager_p.h>
+#include <qtuitestnamespace.h>
+
+#include <QTime>
+#include <QTimer>
+
+class tst_QtUiTestNamespace : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void wait();
+ void connectFirst();
+ void connectFirstIsFirst();
+ void connectFirstDestruction();
+ void connectFirstInvalid();
+ void connectFirstDefaultParam();
+ void disconnectFirstInvalid();
+ void disconnectFirstWildcards();
+};
+
+int g_exit_code;
+int g_argc;
+char** g_argv;
+bool g_test_done;
+QObject* g_test;
+
+void run_test(QAlternateStack*,QVariant const&)
+{
+ g_exit_code = QTest::qExec(g_test, g_argc, g_argv);
+ g_test_done = true;
+}
+
+int main(int argc, char** argv)
+{
+ QCoreApplication app(argc, argv);
+ tst_QtUiTestNamespace test;
+ g_test = &test;
+ g_argc = argc;
+ g_argv = argv;
+
+ // Most QtUiTest code runs in an alternate stack, while the original
+ // stack runs the event loop.
+ // Try to replicate that behavior for this test.
+ QAlternateStack stack;
+
+ g_test_done = false;
+ stack.start(run_test);
+ while (!g_test_done) {
+ app.processEvents(QEventLoop::WaitForMoreEvents);
+ }
+ return g_exit_code;
+}
+
+/*
+ Event loop where 'exec' is a slot, for convenience.
+*/
+class TestEventLoop : public QEventLoop
+{
+ Q_OBJECT
+public:
+ TestEventLoop(QObject* parent =0)
+ : QEventLoop(parent),
+ m_execCount(0),
+ m_exitCount(0)
+ {}
+
+ int m_execCount;
+ int m_exitCount;
+
+public slots:
+ int exec(QEventLoop::ProcessEventsFlags flags = QEventLoop::AllEvents)
+ {
+ ++m_execCount;
+ int ret = QEventLoop::exec(flags);
+ ++m_exitCount;
+ return ret;
+ }
+};
+
+/*
+ Class for emitting a particular integer value.
+*/
+class Emitter : public QObject
+{
+ Q_OBJECT
+
+public:
+ Emitter(QObject* parent =0)
+ : QObject(parent)
+ {}
+
+ void emitValue(int value)
+ {
+ emit valueChanged(value);
+ emit valueChanged2(value);
+ emit valueChangedWithDefault(value);
+ }
+
+ enum Values { DefaultValue = 1338 };
+
+signals:
+ void valueChanged(int);
+ void valueChanged2(int);
+ void valueChangedWithDefault(int = DefaultValue);
+};
+
+/*
+ Class for receiving an emitted value.
+*/
+class Receiver : public QObject
+{
+ Q_OBJECT
+
+public:
+ Receiver(QObject* parent =0)
+ : QObject(parent)
+ {}
+
+ QList<int> values;
+ QList<int> values2;
+
+ enum Values { DefaultValue = 1337 };
+
+public slots:
+ void receive(int value)
+ { values << value; }
+
+ void receive2(int value)
+ { values2 << value; }
+
+ void receiveMultipliedByTwo(int value)
+ { values << 2*value; }
+
+ void receiveDefault(int value = DefaultValue)
+ { values << value; }
+
+ void clear()
+ { values.clear(); }
+
+ void clear2()
+ { values2.clear(); }
+};
+
+// Verify that \a actual is bounded by \a min and \a max.
+#define QCOMPARE_BOUNDED(actual, min, max) \
+ do { \
+ QVERIFY2(actual >= min && actual <= max, qPrintable(QString( \
+ "actual %1, expected to be in range %2 .. %3" \
+ ).arg(actual).arg(min).arg(max))); \
+ } while(0)
+
+/*
+ The most important test ever written.
+
+ Verify that we can wait() for an arbitrary amount of time, while processing
+ events, without hanging if a nested event loop occurs.
+
+ See bug 194361.
+*/
+void tst_QtUiTestNamespace::wait()
+{
+ {
+ QTime t;
+ t.start();
+
+ QtUiTest::wait(1000);
+
+ QCOMPARE_BOUNDED(t.elapsed(), 1000, 30000);
+ }
+
+ // OK, so we can wait when there are no nested event loops.
+ // Big deal. The real test is: if we have a nested event loop, can we
+ // avoid hanging.
+ {
+ TestEventLoop loop;
+
+ QTime t;
+ t.start();
+
+ // The nested event loop will run for 2.5 seconds.
+ // But we only want to wait for 1 second.
+ // What on earth will happen... ???
+ QTimer::singleShot(0, &loop, SLOT(exec()));
+ QTimer::singleShot(2500, &loop, SLOT(quit()));
+ QtUiTest::wait(1000);
+
+ // Verify the loop really did exec.
+ QCOMPARE(loop.m_execCount, 1);
+ // Verify the loop really hasn't exited yet.
+ QCOMPARE(loop.m_exitCount, 0);
+ // Verify that we've waited for about as long as we wanted to wait.
+ QCOMPARE_BOUNDED(t.elapsed(), 1000, 30000);
+
+ // OK, now check inner loop really does exit, to ensure we haven't
+ // screwed things up by switching stacks.
+ for (int i = 0; i < 5000 && !loop.m_exitCount; i+=100, QtUiTest::wait(100))
+ {}
+ QCOMPARE(loop.m_exitCount, 1);
+ QCOMPARE_BOUNDED(t.elapsed(), 2500, 30000);
+ }
+}
+
+/*
+ Tests QtUiTest::connectFirst(), which works like QObject::connect but guarantees
+ that the connection comes before all existing connections.
+*/
+void tst_QtUiTestNamespace::connectFirst()
+{
+ QtUiTestConnectionManager* cm = QtUiTestConnectionManager::instance();
+ if (cm->m_connections.count())
+ QSKIP("Test cannot proceed; previous test left connection manager in incorrect state", SkipAll);
+
+ {
+ // Basic connection
+ Emitter e;
+ Receiver r;
+
+ QVERIFY(QtUiTest::connectFirst(&e, SIGNAL(valueChanged(int)), &r, SLOT(receive(int))));
+ QCOMPARE(cm->m_connections.count(), 1);
+
+ e.emitValue(1024);
+ e.emitValue(1025);
+ QCOMPARE(r.values, QList<int>() << 1024 << 1025);
+ r.values.clear();
+
+ // Basic disconnection
+ QVERIFY(QtUiTest::disconnectFirst(&e, SIGNAL(valueChanged(int)), &r, SLOT(receive(int))));
+ QCOMPARE(cm->m_connections.count(), 0);
+
+ e.emitValue(1027);
+ QCOMPARE(r.values, QList<int>());
+ }
+
+ {
+ // Multiply-connected
+ Emitter e1, e2;
+ Receiver r1, r2;
+
+ QVERIFY(QtUiTest::connectFirst(&e1, SIGNAL(valueChanged(int)), &r1, SLOT(receive(int))));
+ QCOMPARE(cm->m_connections.count(), 1);
+
+ QVERIFY(QtUiTest::connectFirst(&e1, SIGNAL(valueChanged(int)), &r1, SLOT(receive(int))));
+ QCOMPARE(cm->m_connections.count(), 2);
+
+ QVERIFY(QtUiTest::connectFirst(&e1, SIGNAL(valueChanged(int)), &r1, SLOT(receive(int))));
+ QCOMPARE(cm->m_connections.count(), 3);
+
+ // Connect to another object to make sure it doesn't just happen to work when all
+ // connections are identical.
+ QVERIFY(QtUiTest::connectFirst(&e2, SIGNAL(valueChanged2(int)), &r2, SLOT(receive2(int))));
+ QCOMPARE(cm->m_connections.count(), 4);
+
+ e1.emitValue(128);
+ e1.emitValue(129);
+ QCOMPARE(r1.values, QList<int>() << 128 << 128 << 128 << 129 << 129 << 129);
+ QCOMPARE(r1.values2, QList<int>());
+ QCOMPARE(r2.values, QList<int>());
+ QCOMPARE(r2.values2, QList<int>());
+ r1.values.clear();
+
+ e2.emitValue(130);
+ e2.emitValue(150);
+ QCOMPARE(r1.values, QList<int>());
+ QCOMPARE(r1.values2, QList<int>());
+ QCOMPARE(r2.values, QList<int>());
+ QCOMPARE(r2.values2, QList<int>() << 130 << 150);
+ r2.values2.clear();
+
+ // Disconnecting something which is multiply-connected
+ QVERIFY(QtUiTest::disconnectFirst(&e1, SIGNAL(valueChanged(int)), &r1, SLOT(receive(int))));
+ QCOMPARE(cm->m_connections.count(), 1);
+
+ e1.emitValue(1280);
+ e1.emitValue(1290);
+ QCOMPARE(r1.values, QList<int>());
+ QCOMPARE(r1.values2, QList<int>());
+ QCOMPARE(r2.values, QList<int>());
+ QCOMPARE(r2.values2, QList<int>());
+ r1.values.clear();
+
+ e2.emitValue(1300);
+ e2.emitValue(1500);
+ QCOMPARE(r1.values, QList<int>());
+ QCOMPARE(r1.values2, QList<int>());
+ QCOMPARE(r2.values, QList<int>());
+ QCOMPARE(r2.values2, QList<int>() << 1300 << 1500);
+ r2.values2.clear();
+
+ QVERIFY(QtUiTest::disconnectFirst(&e2, SIGNAL(valueChanged2(int)), &r2, SLOT(receive2(int))));
+ QCOMPARE(cm->m_connections.count(), 0);
+
+ e2.emitValue(280);
+ e2.emitValue(290);
+ QCOMPARE(r1.values, QList<int>());
+ QCOMPARE(r1.values2, QList<int>());
+ QCOMPARE(r2.values, QList<int>());
+ QCOMPARE(r2.values2, QList<int>());
+
+ }
+
+ {
+ // Large number of connections
+ QList<Emitter*> emitters;
+ QList<Receiver*> receivers;
+
+ static const int LARGE = 1000;
+ while (emitters.count() < LARGE) {
+ emitters << new Emitter;
+ receivers << new Receiver;
+ }
+
+ for (int i = 0; i < LARGE; ++i) {
+ QVERIFY(QtUiTest::connectFirst(emitters.at(i), SIGNAL(valueChanged(int)), receivers.at(i), SLOT(receive(int))));
+ QVERIFY(QtUiTest::connectFirst(emitters.at(i), SIGNAL(valueChanged(int)), receivers.at(i), SLOT(receive(int))));
+ QVERIFY(QtUiTest::connectFirst(emitters.at(i), SIGNAL(valueChanged2(int)), receivers.at(LARGE-i-1), SLOT(receive2(int))));
+ QVERIFY(QtUiTest::connectFirst(emitters.at(i), SIGNAL(valueChanged2(int)), receivers.at(LARGE-i-1), SLOT(receive2(int))));
+ QCOMPARE(cm->m_connections.count(), (i+1)*4);
+ }
+
+ for (int i = 0; i < LARGE; ++i) {
+ emitters.at(i)->emitValue(i);
+ }
+
+ for (int i = 0; i < LARGE; ++i) {
+ // receiver at i should have received (twice):
+ // value: i
+ // value2: LARGE-i-1
+ QCOMPARE( receivers.at(i)->values, QList<int>() << i << i );
+ QCOMPARE( receivers.at(i)->values2, QList<int>() << (LARGE-i-1) << (LARGE-i-1) );
+ receivers.at(i)->values.clear();
+ receivers.at(i)->values2.clear();
+ }
+
+ // Disconnect half of the objects.
+ for (int i = 0; i < LARGE; i += 2) {
+ QVERIFY(QtUiTest::disconnectFirst(emitters.at(i), SIGNAL(valueChanged(int)), 0, 0));
+ QVERIFY(QtUiTest::disconnectFirst(emitters.at(i), SIGNAL(valueChanged2(int)), 0, 0));
+ }
+ QCOMPARE(cm->m_connections.count(), LARGE*2);
+
+ for (int i = 0; i < LARGE; ++i) {
+ emitters.at(i)->emitValue(i);
+ }
+
+ for (int i = 0; i < LARGE; ++i) {
+ if (i % 2) {
+ QCOMPARE( receivers.at(i)->values, QList<int>() << i << i);
+ receivers.at(i)->values.clear();
+ } else {
+ QCOMPARE( receivers.at(i)->values, QList<int>() );
+ }
+
+ if (!(i % 2)) {
+ QCOMPARE( receivers.at(i)->values2, QList<int>() << (LARGE-i-1) << (LARGE-i-1));
+ receivers.at(i)->values2.clear();
+ } else {
+ QCOMPARE( receivers.at(i)->values2, QList<int>() );
+ }
+ }
+
+ // Delete half of the objects.
+ for (int i = 0; i < LARGE/2; ++i) {
+ delete receivers.takeLast();
+ delete emitters.takeLast();
+ }
+ // All the `2' connections have been severed
+ QCOMPARE(cm->m_connections.count(), LARGE/2);
+
+ for (int i = 0; i < LARGE/2; ++i) {
+ emitters.at(i)->emitValue(i);
+ }
+
+ for (int i = 0; i < LARGE/2; ++i) {
+ if (i % 2) {
+ QCOMPARE( receivers.at(i)->values, QList<int>() << i << i);
+ receivers.at(i)->values.clear();
+ } else {
+ QCOMPARE( receivers.at(i)->values, QList<int>() );
+ }
+ QCOMPARE( receivers.at(i)->values2, QList<int>() );
+ }
+
+ // Delete the rest.
+ while (receivers.count()) {
+ delete receivers.takeFirst();
+ delete emitters.takeFirst();
+ }
+ QCOMPARE(cm->m_connections.count(), 0);
+ }
+}
+
+
+void tst_QtUiTestNamespace::connectFirstIsFirst()
+{
+ QtUiTestConnectionManager* cm = QtUiTestConnectionManager::instance();
+ if (cm->m_connections.count())
+ QSKIP("Test cannot proceed; previous test left connection manager in incorrect state", SkipAll);
+
+ // Tests that connectFirst really does what its name says: establishes a connection which is
+ // activated _before_ all QObject::connect connections.
+ Emitter e;
+ Receiver r;
+
+ static const int LARGE = 200;
+
+ QVERIFY(QtUiTest::connectFirst(&e, SIGNAL(valueChanged(int)), &r, SLOT(receive(int))));
+
+ for (int i = 0; i < LARGE; ++i)
+ QVERIFY(QObject::connect (&e, SIGNAL(valueChanged(int)), &r, SLOT(receiveMultipliedByTwo(int))));
+
+ QVERIFY(QtUiTest::connectFirst(&e, SIGNAL(valueChanged(int)), &r, SLOT(receive(int))));
+
+ for (int i = 0; i < LARGE; ++i)
+ QVERIFY(QObject::connect (&e, SIGNAL(valueChanged(int)), &r, SLOT(receiveMultipliedByTwo(int))));
+
+ QVERIFY(QtUiTest::connectFirst(&e, SIGNAL(valueChanged(int)), &r, SLOT(receive(int))));
+
+ e.emitValue(1);
+ QCOMPARE(r.values.count(), LARGE*2+3);
+
+ // Verify that the QtUiTest-connected signals came first
+ for (int i = 0; i < 3; ++i)
+ QCOMPARE(r.values.at(i), 1);
+ for (int i = 0; i < LARGE*2; ++i)
+ QCOMPARE(r.values.at(i+3), 2);
+}
+
+void tst_QtUiTestNamespace::connectFirstDestruction()
+{
+ QtUiTestConnectionManager* cm = QtUiTestConnectionManager::instance();
+ if (cm->m_connections.count())
+ QSKIP("Test cannot proceed; previous test left connection manager in incorrect state", SkipAll);
+
+ {
+ // Verify connections are destroyed when sender is destroyed
+ Receiver r;
+ {
+ Emitter e;
+
+ QVERIFY(QtUiTest::connectFirst(&e, SIGNAL(valueChanged(int)), &r, SLOT(receive(int))));
+ QCOMPARE(cm->m_connections.count(), 1);
+ }
+ QCOMPARE(cm->m_connections.count(), 0);
+ }
+
+ {
+ // Verify connections are destroyed when receiver is destroyed
+ Emitter e;
+ {
+ Receiver r;
+
+ QVERIFY(QtUiTest::connectFirst(&e, SIGNAL(valueChanged(int)), &r, SLOT(receive(int))));
+ QCOMPARE(cm->m_connections.count(), 1);
+ }
+ QCOMPARE(cm->m_connections.count(), 0);
+ }
+}
+
+void tst_QtUiTestNamespace::connectFirstInvalid()
+{
+ QtUiTestConnectionManager* cm = QtUiTestConnectionManager::instance();
+ if (cm->m_connections.count())
+ QSKIP("Test cannot proceed; previous test left connection manager in incorrect state", SkipAll);
+
+ Emitter e;
+ Receiver r;
+
+ QVERIFY(!QtUiTest::connectFirst(0, 0, 0, 0));
+ QVERIFY(!cm->m_connections.count());
+
+ QVERIFY(!QtUiTest::connectFirst(&e, 0, 0, 0));
+ QVERIFY(!cm->m_connections.count());
+
+ QVERIFY(!QtUiTest::connectFirst(&e, 0, &r, 0));
+ QVERIFY(!cm->m_connections.count());
+
+ QVERIFY(!QtUiTest::connectFirst(0, 0, &r, 0));
+ QVERIFY(!cm->m_connections.count());
+
+ QVERIFY(!QtUiTest::connectFirst(&e, SIGNAL(notexist()), &r, 0));
+ QVERIFY(!cm->m_connections.count());
+
+ QVERIFY(!QtUiTest::connectFirst(&e, SIGNAL(valueChanged(int)), &r, 0));
+ QVERIFY(!cm->m_connections.count());
+
+ QVERIFY(!QtUiTest::connectFirst(&e, SIGNAL(valueChanged(int)), &r, SLOT(notexist())));
+ QVERIFY(!cm->m_connections.count());
+
+ QVERIFY(!QtUiTest::connectFirst(&e, SIGNAL(notexist()), &r, SLOT(receive(int))));
+ QVERIFY(!cm->m_connections.count());
+}
+
+void tst_QtUiTestNamespace::disconnectFirstInvalid()
+{
+ QtUiTestConnectionManager* cm = QtUiTestConnectionManager::instance();
+ if (cm->m_connections.count())
+ QSKIP("Test cannot proceed; previous test left connection manager in incorrect state", SkipAll);
+
+ Emitter e;
+ Receiver r;
+
+ QVERIFY(!QtUiTest::disconnectFirst(0, 0, 0, 0));
+ QVERIFY(!cm->m_connections.count());
+
+ // Not an error but there are no connections
+ QVERIFY(!QtUiTest::disconnectFirst(&e, 0, 0, 0));
+ QVERIFY(!cm->m_connections.count());
+
+ // Not an error but there are no connections
+ QVERIFY(!QtUiTest::disconnectFirst(&e, 0, &r, 0));
+ QVERIFY(!cm->m_connections.count());
+
+ QVERIFY(!QtUiTest::disconnectFirst(0, 0, &r, 0));
+ QVERIFY(!cm->m_connections.count());
+
+ QVERIFY(!QtUiTest::disconnectFirst(&e, SIGNAL(notexist()), &r, 0));
+ QVERIFY(!cm->m_connections.count());
+
+ // Not an error but there are no connections
+ QVERIFY(!QtUiTest::disconnectFirst(&e, SIGNAL(valueChanged(int)), &r, 0));
+ QVERIFY(!cm->m_connections.count());
+
+ QVERIFY(!QtUiTest::disconnectFirst(&e, SIGNAL(valueChanged(int)), &r, SLOT(notexist())));
+ QVERIFY(!cm->m_connections.count());
+
+ QVERIFY(!QtUiTest::disconnectFirst(&e, SIGNAL(notexist2()), &r, SLOT(receive(int))));
+ QVERIFY(!cm->m_connections.count());
+
+ // Not an error but there are no connections
+ QVERIFY(!QtUiTest::disconnectFirst(&e, SIGNAL(valueChanged(int)), &r, SLOT(receive(int))));
+ QVERIFY(!cm->m_connections.count());
+}
+
+/*
+ Tests QtUiTest::connectFirst() for signals/slots which have default parameters.
+*/
+void tst_QtUiTestNamespace::connectFirstDefaultParam()
+{
+ QtUiTestConnectionManager* cm = QtUiTestConnectionManager::instance();
+ if (cm->m_connections.count())
+ QSKIP("Test cannot proceed; previous test left connection manager in incorrect state", SkipAll);
+
+ { // x,x
+ Emitter e;
+ Receiver r;
+
+ QVERIFY(QtUiTest::connectFirst(&e, SIGNAL(valueChangedWithDefault(int)), &r, SLOT(receiveDefault(int))));
+ QCOMPARE(cm->m_connections.count(), 1);
+ e.emitValue(-99);
+ QCOMPARE(r.values, QList<int>() << -99);
+ }
+
+ { // x,0
+ Emitter e;
+ Receiver r;
+
+ QVERIFY(QtUiTest::connectFirst(&e, SIGNAL(valueChangedWithDefault(int)), &r, SLOT(receiveDefault())));
+ QCOMPARE(cm->m_connections.count(), 1);
+ e.emitValue(129);
+ QCOMPARE(r.values, QList<int>() << r.DefaultValue);
+ }
+
+ { // 0,x: can't work
+ Emitter e;
+ Receiver r;
+
+ QVERIFY(!QtUiTest::connectFirst(&e, SIGNAL(valueChangedWithDefault()), &r, SLOT(receiveDefault(int))));
+ QCOMPARE(cm->m_connections.count(), 0);
+ }
+
+ { // 0,0
+ Emitter e;
+ Receiver r;
+
+ QVERIFY(QtUiTest::connectFirst(&e, SIGNAL(valueChangedWithDefault()), &r, SLOT(receiveDefault())));
+ QCOMPARE(cm->m_connections.count(), 1);
+ e.emitValue(130);
+
+ QEXPECT_FAIL("", "Bug 227908: signals with default parameters are discarded by QtUiTest::connectFirst()", Abort);
+
+ QCOMPARE(r.values.count(), 1);
+ QCOMPARE(r.values, QList<int>() << r.DefaultValue);
+ }
+}
+
+void tst_QtUiTestNamespace::disconnectFirstWildcards()
+{
+ QtUiTestConnectionManager* cm = QtUiTestConnectionManager::instance();
+ if (cm->m_connections.count())
+ QSKIP("Test cannot proceed; previous test left connection manager in incorrect state", SkipAll);
+
+#define INIT() \
+ Receiver r1; Emitter e1; \
+ Receiver r2; Emitter e2a; Emitter e2b; \
+ Receiver r3a; Receiver r3b; Emitter e3; \
+ Receiver r4a; Receiver r4b; Emitter e4; \
+\
+ QVERIFY(QtUiTest::connectFirst(&e1, SIGNAL(valueChanged(int)), &r1, SLOT(receive(int)))); \
+ QVERIFY(QtUiTest::connectFirst(&e1, SIGNAL(valueChanged(int)), &r1, SLOT(receive2(int)))); \
+\
+ QVERIFY(QtUiTest::connectFirst(&e2a, SIGNAL(valueChanged(int)), &r2, SLOT(receive(int)))); \
+ QVERIFY(QtUiTest::connectFirst(&e2a, SIGNAL(valueChanged(int)), &r2, SLOT(receive2(int)))); \
+ QVERIFY(QtUiTest::connectFirst(&e2b, SIGNAL(valueChanged(int)), &r2, SLOT(receive(int)))); \
+ QVERIFY(QtUiTest::connectFirst(&e2b, SIGNAL(valueChanged(int)), &r2, SLOT(receive2(int)))); \
+\
+ QVERIFY(QtUiTest::connectFirst(&e3, SIGNAL(valueChanged(int)), &r3a, SLOT(receive(int)))); \
+ QVERIFY(QtUiTest::connectFirst(&e3, SIGNAL(valueChanged(int)), &r3a, SLOT(receive(int)))); \
+ QVERIFY(QtUiTest::connectFirst(&e3, SIGNAL(valueChanged(int)), &r3b, SLOT(receive(int)))); \
+ QVERIFY(QtUiTest::connectFirst(&e3, SIGNAL(valueChanged(int)), &r3b, SLOT(receive2(int)))); \
+\
+ QVERIFY(QtUiTest::connectFirst(&e4, SIGNAL(valueChanged(int)), &r4a, SLOT(receive(int)))); \
+ QVERIFY(QtUiTest::connectFirst(&e4, SIGNAL(valueChanged(int)), &r4a, SLOT(receive2(int)))); \
+ QVERIFY(QtUiTest::connectFirst(&e4, SIGNAL(valueChanged2(int)), &r4a, SLOT(receive(int)))); \
+ QVERIFY(QtUiTest::connectFirst(&e4, SIGNAL(valueChanged2(int)), &r4a, SLOT(receive2(int)))); \
+ QVERIFY(QtUiTest::connectFirst(&e4, SIGNAL(valueChanged(int)), &r4b, SLOT(receive(int)))); \
+ QVERIFY(QtUiTest::connectFirst(&e4, SIGNAL(valueChanged(int)), &r4b, SLOT(receive2(int)))); \
+ QVERIFY(QtUiTest::connectFirst(&e4, SIGNAL(valueChanged2(int)), &r4b, SLOT(receive(int)))); \
+ QVERIFY(QtUiTest::connectFirst(&e4, SIGNAL(valueChanged2(int)), &r4b, SLOT(receive2(int))));
+
+ {
+ INIT();
+
+ // Verify connections for correctness
+ QCOMPARE(cm->m_connections.count(), 18);
+
+ e1. emitValue(10);
+ e2a.emitValue(20);
+ e2b.emitValue(21);
+ e3. emitValue(30);
+ e4. emitValue(40);
+ QCOMPARE(r1.values, QList<int>() << 10);
+ QCOMPARE(r1.values2, QList<int>() << 10);
+ QCOMPARE(r2.values, QList<int>() << 20 << 21);
+ QCOMPARE(r2.values2, QList<int>() << 20 << 21);
+ QCOMPARE(r3a.values, QList<int>() << 30 << 30);
+ QCOMPARE(r3a.values2, QList<int>());
+ QCOMPARE(r3b.values, QList<int>() << 30);
+ QCOMPARE(r3b.values2, QList<int>() << 30);
+ QCOMPARE(r4a.values, QList<int>() << 40 << 40);
+ QCOMPARE(r4a.values2, QList<int>() << 40 << 40);
+ QCOMPARE(r4b.values, QList<int>() << 40 << 40);
+ QCOMPARE(r4b.values2, QList<int>() << 40 << 40);
+ }
+
+ {
+ INIT();
+
+ // All of these disconnects should fail:
+ // 0,0,0,0
+ // 0,0,0,x
+ // 0,0,x,0
+ // 0,0,x,x
+ // 0,x,0,0
+ // 0,x,0,x
+ // 0,x,x,0
+ // 0,x,x,x
+ QVERIFY(!QtUiTest::disconnectFirst(0, 0, 0, 0));
+ QVERIFY(!QtUiTest::disconnectFirst(0, 0, 0, SLOT(receive(int))));
+ QVERIFY(!QtUiTest::disconnectFirst(0, 0, &r1, 0));
+ QVERIFY(!QtUiTest::disconnectFirst(0, 0, &r1, SLOT(receive(int))));
+ QVERIFY(!QtUiTest::disconnectFirst(0, SIGNAL(valueChanged(int)), 0, 0));
+ QVERIFY(!QtUiTest::disconnectFirst(0, SIGNAL(valueChanged2(int)), 0, SLOT(receive(int))));
+ QVERIFY(!QtUiTest::disconnectFirst(0, SIGNAL(valueChanged(int)), &r1, 0));
+ QVERIFY(!QtUiTest::disconnectFirst(0, SIGNAL(valueChanged2(int)), &r2, SLOT(receive2(int))));
+ QCOMPARE(cm->m_connections.count(), 18);
+ }
+
+ {
+ INIT();
+
+ // Test x,0,0,0
+ QVERIFY(QtUiTest::disconnectFirst(&e4,0,0,0));
+ QCOMPARE(cm->m_connections.count(), 10);
+
+ e1. emitValue(10);
+ e2a.emitValue(20);
+ e2b.emitValue(21);
+ e3. emitValue(30);
+ e4. emitValue(40);
+ QCOMPARE(r1.values, QList<int>() << 10);
+ QCOMPARE(r1.values2, QList<int>() << 10);
+ QCOMPARE(r2.values, QList<int>() << 20 << 21);
+ QCOMPARE(r2.values2, QList<int>() << 20 << 21);
+ QCOMPARE(r3a.values, QList<int>() << 30 << 30);
+ QCOMPARE(r3a.values2, QList<int>());
+ QCOMPARE(r3b.values, QList<int>() << 30);
+ QCOMPARE(r3b.values2, QList<int>() << 30);
+ QCOMPARE(r4a.values, QList<int>());
+ QCOMPARE(r4a.values2, QList<int>());
+ QCOMPARE(r4b.values, QList<int>());
+ QCOMPARE(r4b.values2, QList<int>());
+ }
+
+ {
+ INIT();
+
+ // Test x,0,0,x: should fail
+ QVERIFY(!QtUiTest::disconnectFirst(&e4, 0, 0, SLOT(receive2(int))));
+ QCOMPARE(cm->m_connections.count(), 18);
+ }
+
+ {
+ INIT();
+
+ // Test x,0,x,0
+ QVERIFY(QtUiTest::disconnectFirst(&e4, 0, &r4a, 0));
+ QCOMPARE(cm->m_connections.count(), 14);
+
+ e1. emitValue(10);
+ e2a.emitValue(20);
+ e2b.emitValue(21);
+ e3. emitValue(30);
+ e4. emitValue(40);
+ QCOMPARE(r1.values, QList<int>() << 10);
+ QCOMPARE(r1.values2, QList<int>() << 10);
+ QCOMPARE(r2.values, QList<int>() << 20 << 21);
+ QCOMPARE(r2.values2, QList<int>() << 20 << 21);
+ QCOMPARE(r3a.values, QList<int>() << 30 << 30);
+ QCOMPARE(r3a.values2, QList<int>());
+ QCOMPARE(r3b.values, QList<int>() << 30);
+ QCOMPARE(r3b.values2, QList<int>() << 30);
+ QCOMPARE(r4a.values, QList<int>());
+ QCOMPARE(r4a.values2, QList<int>());
+ QCOMPARE(r4b.values, QList<int>() << 40 << 40);
+ QCOMPARE(r4b.values2, QList<int>() << 40 << 40);
+ }
+
+ {
+ INIT();
+
+ // Test x,0,x,x
+ QVERIFY(QtUiTest::disconnectFirst(&e4, 0, &r4a, SLOT(receive2(int))));
+
+ QCOMPARE(cm->m_connections.count(), 16);
+
+ e1. emitValue(10);
+ e2a.emitValue(20);
+ e2b.emitValue(21);
+ e3. emitValue(30);
+ e4. emitValue(40);
+ QCOMPARE(r1.values, QList<int>() << 10);
+ QCOMPARE(r1.values2, QList<int>() << 10);
+ QCOMPARE(r2.values, QList<int>() << 20 << 21);
+ QCOMPARE(r2.values2, QList<int>() << 20 << 21);
+ QCOMPARE(r3a.values, QList<int>() << 30 << 30);
+ QCOMPARE(r3a.values2, QList<int>());
+ QCOMPARE(r3b.values, QList<int>() << 30);
+ QCOMPARE(r3b.values2, QList<int>() << 30);
+ QCOMPARE(r4a.values, QList<int>() << 40 << 40);
+ QCOMPARE(r4a.values2, QList<int>());
+ QCOMPARE(r4b.values, QList<int>() << 40 << 40);
+ QCOMPARE(r4b.values2, QList<int>() << 40 << 40);
+ }
+
+ {
+ INIT();
+
+ // Test x,x,0,0
+ QVERIFY(QtUiTest::disconnectFirst(&e4, SIGNAL(valueChanged(int)), 0, 0));
+ QCOMPARE(cm->m_connections.count(), 14);
+
+ e1. emitValue(10);
+ e2a.emitValue(20);
+ e2b.emitValue(21);
+ e3. emitValue(30);
+ e4. emitValue(40);
+ QCOMPARE(r1.values, QList<int>() << 10);
+ QCOMPARE(r1.values2, QList<int>() << 10);
+ QCOMPARE(r2.values, QList<int>() << 20 << 21);
+ QCOMPARE(r2.values2, QList<int>() << 20 << 21);
+ QCOMPARE(r3a.values, QList<int>() << 30 << 30);
+ QCOMPARE(r3a.values2, QList<int>());
+ QCOMPARE(r3b.values, QList<int>() << 30);
+ QCOMPARE(r3b.values2, QList<int>() << 30);
+ QCOMPARE(r4a.values, QList<int>() << 40);
+ QCOMPARE(r4a.values2, QList<int>() << 40);
+ QCOMPARE(r4b.values, QList<int>() << 40);
+ QCOMPARE(r4b.values2, QList<int>() << 40);
+ }
+
+ {
+ INIT();
+
+ // Test x,x,0,x: should fail
+ QVERIFY(!QtUiTest::disconnectFirst(&e2a, SIGNAL(valueChanged(int)), 0, SLOT(receive(int))));
+
+ QCOMPARE(cm->m_connections.count(), 18);
+ }
+
+ {
+ INIT();
+
+ // Test x,x,x,0
+ QVERIFY(QtUiTest::disconnectFirst(&e1, SIGNAL(valueChanged(int)), &r1, 0));
+
+ QCOMPARE(cm->m_connections.count(), 16);
+
+ e1. emitValue(10);
+ e2a.emitValue(20);
+ e2b.emitValue(21);
+ e3. emitValue(30);
+ e4. emitValue(40);
+ QCOMPARE(r1.values, QList<int>());
+ QCOMPARE(r1.values2, QList<int>());
+ QCOMPARE(r2.values, QList<int>() << 20 << 21);
+ QCOMPARE(r2.values2, QList<int>() << 20 << 21);
+ QCOMPARE(r3a.values, QList<int>() << 30 << 30);
+ QCOMPARE(r3a.values2, QList<int>());
+ QCOMPARE(r3b.values, QList<int>() << 30);
+ QCOMPARE(r3b.values2, QList<int>() << 30);
+ QCOMPARE(r4a.values, QList<int>() << 40 << 40);
+ QCOMPARE(r4a.values2, QList<int>() << 40 << 40);
+ QCOMPARE(r4b.values, QList<int>() << 40 << 40);
+ QCOMPARE(r4b.values2, QList<int>() << 40 << 40);
+ }
+
+ {
+ INIT();
+
+ // Test x,x,x,x
+ QVERIFY(QtUiTest::disconnectFirst(&e3, SIGNAL(valueChanged(int)), &r3a, SLOT(receive(int))));
+
+ QCOMPARE(cm->m_connections.count(), 16);
+
+ e1. emitValue(10);
+ e2a.emitValue(20);
+ e2b.emitValue(21);
+ e3. emitValue(30);
+ e4. emitValue(40);
+ QCOMPARE(r1.values, QList<int>() << 10);
+ QCOMPARE(r1.values2, QList<int>() << 10);
+ QCOMPARE(r2.values, QList<int>() << 20 << 21);
+ QCOMPARE(r2.values2, QList<int>() << 20 << 21);
+ QCOMPARE(r3a.values, QList<int>());
+ QCOMPARE(r3a.values2, QList<int>());
+ QCOMPARE(r3b.values, QList<int>() << 30);
+ QCOMPARE(r3b.values2, QList<int>() << 30);
+ QCOMPARE(r4a.values, QList<int>() << 40 << 40);
+ QCOMPARE(r4a.values2, QList<int>() << 40 << 40);
+ QCOMPARE(r4b.values, QList<int>() << 40 << 40);
+ QCOMPARE(r4b.values2, QList<int>() << 40 << 40);
+ }
+
+}
+
+#include "tst_qtuitestnamespace.moc"
diff --git a/tests/qtuitest/tst_qtuitestnamespace/tst_qtuitestnamespace.pro b/tests/qtuitest/tst_qtuitestnamespace/tst_qtuitestnamespace.pro
new file mode 100644
index 0000000..eba25e3
--- /dev/null
+++ b/tests/qtuitest/tst_qtuitestnamespace/tst_qtuitestnamespace.pro
@@ -0,0 +1,9 @@
+TEMPLATE=app
+CONFIG+=unittest
+QT = core gui
+TARGET=tst_qtuitestnamespace
+
+CONFIG-=debug_and_release_target
+
+SOURCES+= \
+ tst_qtuitestnamespace.cpp
diff --git a/tests/qtuitest/tst_qtuitestwidgets/tst_qtuitestwidgets.cpp b/tests/qtuitest/tst_qtuitestwidgets/tst_qtuitestwidgets.cpp
new file mode 100644
index 0000000..544d030
--- /dev/null
+++ b/tests/qtuitest/tst_qtuitestwidgets/tst_qtuitestwidgets.cpp
@@ -0,0 +1,554 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QTest>
+
+#define private public
+#include <qtuitestwidgets_p.h>
+#undef private
+
+#include <qtuitestnamespace.h>
+
+#include <QLabel>
+#include <QCheckBox>
+#include <qplugin.h>
+
+//TESTED_COMPONENT=QA: Testing Framework (18707)
+
+using namespace QtUiTest;
+
+class tst_QtUiTestWidgets : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void cast_zero();
+ void cast_inherit_single();
+ void cast_self();
+ void cast();
+ void cast_unregistered();
+
+ void cleanup();
+};
+
+QTEST_MAIN(tst_QtUiTestWidgets)
+
+class WidgetObject : public QObject, public Widget
+{
+ Q_OBJECT
+ Q_INTERFACES(QtUiTest::Widget)
+
+public:
+ WidgetObject(QObject *_wrappee)
+ : QObject(), wrappee(_wrappee), geometryCalls(0)
+ { ++constructed; }
+
+ virtual ~WidgetObject()
+ { ++destructed; }
+
+ virtual const QRect& geometry() const
+ { ++geometryCalls; static QRect nullRect; return nullRect; }
+
+ virtual QRect rect() const
+ { return QRect(); }
+
+ virtual bool isVisible() const
+ { return false; }
+
+ virtual QRegion visibleRegion() const
+ { return QRegion(); }
+
+ virtual QRegion childrenVisibleRegion() const
+ { return QRegion(); }
+
+ virtual const QObjectList &children() const
+ { static QObjectList c; return c; }
+
+ virtual QObject *parent() const
+ { return 0; }
+
+ virtual QString windowTitle() const
+ { return QString(); }
+
+ virtual QPoint mapToGlobal(QPoint const&) const
+ { return QPoint(); }
+
+ virtual QPoint mapFromGlobal(QPoint const&) const
+ { return QPoint(); }
+
+ virtual bool setFocus()
+ { return false; }
+
+ virtual bool setEditFocus(bool)
+ { return false; }
+
+ virtual void focusOutEvent()
+ {}
+
+ virtual bool hasFocus() const
+ { return false; }
+
+ virtual bool hasEditFocus() const
+ { return false; }
+
+ virtual bool ensureVisibleRegion(QRegion const&)
+ { return false; }
+
+ QObject *wrappee;
+ mutable int geometryCalls;
+
+ static int constructed;
+ static int destructed;
+};
+int WidgetObject::constructed = 0;
+int WidgetObject::destructed = 0;
+
+class TextWidgetObject : public WidgetObject, public TextWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(QtUiTest::TextWidget)
+
+public:
+ TextWidgetObject(QObject *_wrappee)
+ : WidgetObject(_wrappee)
+ { ++constructed; }
+
+ virtual ~TextWidgetObject()
+ { ++destructed; }
+
+ virtual QString text() const
+ {
+ QLabel const *label = qobject_cast<QLabel*>(wrappee);
+ return label ? label->text() : QString();
+ }
+
+ virtual QString selectedText() const
+ { return text(); }
+
+ static int constructed;
+ static int destructed;
+
+ static QObject* constructor(QObject* wrappee)
+ { return new TextWidgetObject(wrappee); }
+};
+int TextWidgetObject::constructed = 0;
+int TextWidgetObject::destructed = 0;
+
+
+class TestableCheckBox : public QCheckBox,
+ public Widget, public CheckWidget, public TextWidget
+{
+ Q_OBJECT
+ Q_INTERFACES(
+ QtUiTest::Widget
+ QtUiTest::CheckWidget
+ QtUiTest::TextWidget)
+
+public:
+ TestableCheckBox(QWidget *parent = 0)
+ : QCheckBox(parent)
+ { ++constructed; }
+
+ virtual ~TestableCheckBox()
+ { ++destructed; }
+
+ virtual const QRect& geometry() const
+ { return QCheckBox::geometry(); }
+
+ virtual QRect rect() const
+ { return QCheckBox::rect(); }
+
+ virtual bool isVisible() const
+ { return QCheckBox::isVisible(); }
+
+ virtual QRegion visibleRegion() const
+ { return QCheckBox::visibleRegion(); }
+
+ virtual QRegion childrenVisibleRegion() const
+ { return QRegion(); }
+
+ virtual const QObjectList &children() const
+ { return QCheckBox::children(); }
+
+ virtual QObject *parent() const
+ { return QCheckBox::parent(); }
+
+ virtual QString windowTitle() const
+ { return QCheckBox::windowTitle(); }
+
+ virtual QString text() const
+ { return QCheckBox::text(); }
+
+ virtual QString selectedText() const
+ { return QCheckBox::text(); }
+
+ virtual bool isTristate() const
+ { return QCheckBox::isTristate(); }
+
+ virtual Qt::CheckState checkState() const
+ { return QCheckBox::checkState(); }
+
+ virtual QPoint mapToGlobal(QPoint const &p) const
+ { return QCheckBox::mapToGlobal(p); }
+
+ virtual QPoint mapFromGlobal(QPoint const &p) const
+ { return QCheckBox::mapFromGlobal(p); }
+
+ virtual bool setFocus()
+ { QCheckBox::setFocus(); return true; }
+
+ virtual bool setEditFocus(bool)
+ { return false; }
+
+ virtual void focusOutEvent()
+ {}
+
+ virtual bool ensureVisibleRegion(QRegion const&)
+ { return false; }
+
+ virtual bool hasFocus() const
+ { return QCheckBox::hasFocus(); }
+
+ virtual bool hasEditFocus() const
+ { return hasFocus(); }
+
+ static QObject* constructor(QObject* wrappee)
+ { return qobject_cast<TestableCheckBox*>(wrappee); }
+
+ static int constructed;
+ static int destructed;
+};
+int TestableCheckBox::constructed = 0;
+int TestableCheckBox::destructed = 0;
+
+
+class TestWidgetFactory : public QObject, public WidgetFactory
+{
+ Q_OBJECT
+ Q_INTERFACES(QtUiTest::WidgetFactory)
+
+ public:
+ QObject* create(QObject *wrappee)
+ {
+ QObject *ret = 0;
+ if (!ret && wrappee->inherits("QLabel"))
+ ret = new TextWidgetObject(wrappee);
+ if (!ret && wrappee->inherits("QWidget"))
+ ret = new WidgetObject(wrappee);
+ return ret;
+ }
+
+ QStringList keys() const
+ { return QStringList() << "QLabel" << "QWidget"; }
+};
+Q_EXPORT_PLUGIN2(testwidgetfactory, TestWidgetFactory)
+
+Q_IMPORT_PLUGIN(testwidgetfactory)
+
+
+/*
+ \req QTOPIA-78
+
+ \groups
+*/
+void tst_QtUiTestWidgets::cast_unregistered()
+{
+ // Test that casting without calling registerClass fails.
+ QObject obj;
+ QVERIFY(!qtuitest_cast<Widget*>(&obj));
+ // Cast again to ensure any caching code path gets executed.
+ QVERIFY(!qtuitest_cast<Widget*>(&obj));
+}
+
+/*
+ \req QTOPIA-78
+
+ \groups
+*/
+void tst_QtUiTestWidgets::cast()
+{
+ QtUiTestWidgets::instance()->clear();
+
+ QCOMPARE(WidgetObject::constructed, 0);
+ QCOMPARE(WidgetObject::destructed, 0);
+
+ Widget *wrapper = 0;
+ WidgetObject *wo = 0;
+
+ {
+ QWidget widget;
+
+ QtUiTestWidgets::instance()->refreshPlugins();
+
+ QCOMPARE(WidgetObject::constructed, 0);
+ QCOMPARE(WidgetObject::destructed, 0);
+
+ wrapper = qtuitest_cast<Widget*>(&widget);
+ wo = static_cast<WidgetObject*>(wrapper);
+ QVERIFY(wrapper);
+ QVERIFY(wo);
+ QCOMPARE(wo->wrappee, &widget);
+ QCOMPARE(wo->geometryCalls, 0);
+
+ QCOMPARE(WidgetObject::constructed, 1);
+ QCOMPARE(WidgetObject::destructed, 0);
+
+ // Cast something that's already a wrapper
+ QCOMPARE(qtuitest_cast<Widget*>(wo), wrapper);
+
+ QCOMPARE(WidgetObject::constructed, 1);
+ QCOMPARE(WidgetObject::destructed, 0);
+
+ // Verify that WidgetObject's functions are really being called
+ wrapper->geometry();
+ QCOMPARE(wo->geometryCalls, 1);
+
+ // Cast again and verify that it returns the object we already have
+ QCOMPARE( qtuitest_cast<Widget*>(&widget), wrapper );
+ QCOMPARE(WidgetObject::constructed, 1);
+ QCOMPARE(WidgetObject::destructed, 0);
+
+ // Delete wrapped object and verify that testwidget gets deleted
+ }
+ QCOMPARE(WidgetObject::constructed, 1);
+ QCOMPARE(WidgetObject::destructed, 1);
+
+ // Construct and test again
+ {
+ QWidget widget;
+ wrapper = qtuitest_cast<Widget*>(&widget);
+ wo = static_cast<WidgetObject*>(wrapper);
+ QVERIFY(wrapper);
+ QVERIFY(wo);
+ QCOMPARE(wo->wrappee, &widget);
+ QCOMPARE(wo->geometryCalls, 0);
+
+ QCOMPARE(WidgetObject::constructed, 2);
+ QCOMPARE(WidgetObject::destructed, 1);
+
+ // Delete wrapper without deleting object
+ delete wrapper;
+ QCOMPARE(WidgetObject::constructed, 2);
+ QCOMPARE(WidgetObject::destructed, 2);
+
+ // Verify new wrapper can be obtained after deleting old wrapper
+ wrapper = qtuitest_cast<Widget*>(&widget);
+ wo = static_cast<WidgetObject*>(wrapper);
+ QVERIFY(wrapper);
+ QVERIFY(wo);
+ QCOMPARE(wo->wrappee, &widget);
+ QCOMPARE(wo->geometryCalls, 0);
+
+ QCOMPARE(WidgetObject::constructed, 3);
+ QCOMPARE(WidgetObject::destructed, 2);
+
+ QCOMPARE( qtuitest_cast<Widget*>(&widget), wrapper );
+ QCOMPARE(WidgetObject::constructed, 3);
+ QCOMPARE(WidgetObject::destructed, 2);
+ }
+ QCOMPARE(WidgetObject::constructed, 3);
+ QCOMPARE(WidgetObject::destructed, 3);
+}
+
+/*
+ \req QTOPIA-78
+
+ \groups
+ Test case where an interface is implemented by a class which inherits a
+ class which implements one other interface.
+*/
+void tst_QtUiTestWidgets::cast_inherit_single()
+{
+ QCOMPARE(WidgetObject::constructed, 0);
+ QCOMPARE(WidgetObject::destructed, 0);
+ QCOMPARE(TextWidgetObject::constructed, 0);
+ QCOMPARE(TextWidgetObject::destructed, 0);
+
+ QtUiTestWidgets::instance()->refreshPlugins();
+
+ Widget *w;
+ TextWidget *tw;
+
+ {
+ QWidget widget;
+ QLabel label;
+
+ w = qtuitest_cast<Widget*>(&widget);
+ tw = qtuitest_cast<TextWidget*>(&label);
+
+ QVERIFY(w);
+ QVERIFY(tw);
+ QCOMPARE(TextWidgetObject::constructed, 1);
+ QCOMPARE(TextWidgetObject::destructed, 0);
+
+ /* One or more widget objects may have been constructed while finding
+ * the interfaces for QLabel. However there should be exactly 2
+ * still existing. */
+ QCOMPARE(WidgetObject::constructed - WidgetObject::destructed, 2);
+
+ QCOMPARE(tw->text(), QString());
+ label.setText("Hi there");
+ QCOMPARE(tw->text(), QString("Hi there"));
+ }
+
+ QCOMPARE(TextWidgetObject::constructed, 1);
+ QCOMPARE(TextWidgetObject::destructed, 1);
+ QCOMPARE(WidgetObject::constructed - WidgetObject::destructed, 0);
+}
+
+/*
+ \req QTOPIA-78
+
+ \groups
+ Test casting of a widget class which implements its own interfaces.
+*/
+void tst_QtUiTestWidgets::cast_self()
+{
+ QtUiTestWidgets::instance()->clear();
+
+ QCOMPARE( TestableCheckBox::constructed, 0 );
+ QCOMPARE( TestableCheckBox::destructed, 0 );
+
+ Widget *w;
+ TextWidget *tw;
+ CheckWidget *cw;
+
+ {
+ TestableCheckBox tcb;
+ QCheckBox *cb = &tcb;
+
+ QCOMPARE( TestableCheckBox::constructed, 1 );
+ QCOMPARE( TestableCheckBox::destructed, 0 );
+
+ /* Doesn't need to be registered before cast. */
+ QVERIFY( w = qtuitest_cast<Widget*>(&tcb) );
+ QVERIFY( tw = qtuitest_cast<TextWidget*>(&tcb) );
+ QVERIFY( cw = qtuitest_cast<CheckWidget*>(&tcb) );
+
+ QCOMPARE( w, &tcb );
+ QCOMPARE( tw, &tcb );
+ QCOMPARE( cw, &tcb );
+
+ /* However, should still work when other classes are registered...*/
+ QtUiTestWidgets::instance()->refreshPlugins();
+ QCOMPARE( qtuitest_cast<Widget*>(&tcb), w );
+ QCOMPARE( qtuitest_cast<TextWidget*>(&tcb), tw );
+ QCOMPARE( qtuitest_cast<CheckWidget*>(&tcb), cw );
+ QCOMPARE( WidgetObject::constructed, 0 );
+ QCOMPARE( WidgetObject::destructed, 0 );
+
+ QCOMPARE( TestableCheckBox::constructed, 1 );
+ QCOMPARE( TestableCheckBox::destructed, 0 );
+
+ /* Use it a bit and make sure it works as expected. */
+ QCOMPARE( w->geometry(), tcb.geometry() );
+
+ tcb.setText("Walk the Dog");
+ QCOMPARE( tw->text(), tcb.text() );
+
+ tcb.setTristate(true);
+ cb->setCheckState(Qt::PartiallyChecked);
+ QCOMPARE( cw->isTristate(), tcb.isTristate() );
+ QCOMPARE( cw->checkState(), tcb.checkState() );
+ }
+
+ /* Ensure we didn't double-delete */
+ QCOMPARE( TestableCheckBox::constructed, 1 );
+ QCOMPARE( TestableCheckBox::destructed, 1 );
+
+ /* Ensure we can make another one with no problems */
+ {
+ TestableCheckBox tcb;
+
+ QCOMPARE( TestableCheckBox::constructed, 2 );
+ QCOMPARE( TestableCheckBox::destructed, 1 );
+
+ QVERIFY( w = qtuitest_cast<Widget*>(&tcb) );
+ QVERIFY( tw = qtuitest_cast<TextWidget*>(&tcb) );
+ QVERIFY( cw = qtuitest_cast<CheckWidget*>(&tcb) );
+
+ QCOMPARE( w, &tcb );
+ QCOMPARE( tw, &tcb );
+ QCOMPARE( cw, &tcb );
+ }
+ QCOMPARE( TestableCheckBox::constructed, 2 );
+ QCOMPARE( TestableCheckBox::destructed, 2 );
+
+ /* Ensure casting a null pointer has no ill effects */
+ w = qtuitest_cast<Widget*>( static_cast<TestableCheckBox*>(0) );
+ QVERIFY( !w );
+
+ QCOMPARE( TestableCheckBox::constructed, 2 );
+ QCOMPARE( TestableCheckBox::destructed, 2 );
+
+ QCOMPARE( WidgetObject::constructed, 0 );
+ QCOMPARE( WidgetObject::destructed, 0 );
+}
+
+/*
+ \req QTOPIA-78
+
+ \groups
+*/
+void tst_QtUiTestWidgets::cast_zero()
+{
+ QtUiTestWidgets::instance()->clear();
+
+ QVERIFY( !qtuitest_cast<Widget*>(static_cast<QObject*>(0)) );
+
+ QtUiTestWidgets::instance()->refreshPlugins();
+
+ QVERIFY( !qtuitest_cast<Widget*>(static_cast<QObject*>(0)) );
+}
+
+void tst_QtUiTestWidgets::cleanup()
+{
+ QtUiTestWidgets::instance()->clear();
+ QtUiTestWidgets::instance()->refreshPlugins();
+ WidgetObject::constructed = 0;
+ WidgetObject::destructed = 0;
+ TextWidgetObject::constructed = 0;
+ TextWidgetObject::destructed = 0;
+ TestableCheckBox::constructed = 0;
+ TestableCheckBox::destructed = 0;
+}
+
+#include "tst_qtuitestwidgets.moc"
diff --git a/tests/qtuitest/tst_qtuitestwidgets/tst_qtuitestwidgets.pro b/tests/qtuitest/tst_qtuitestwidgets/tst_qtuitestwidgets.pro
new file mode 100644
index 0000000..57742c0
--- /dev/null
+++ b/tests/qtuitest/tst_qtuitestwidgets/tst_qtuitestwidgets.pro
@@ -0,0 +1,19 @@
+TEMPLATE=app
+CONFIG+=unittest
+QT = core gui
+TARGET=tst_qtuitestwidgets
+
+CONFIG-=debug_and_release_target
+
+SOURCES+= \
+ tst_qtuitestwidgets.cpp
+
+DEFINES+=QT_STATICPLUGIN
+
+symbian {
+ LIBS+=-L$$OUT_PWD -lqtuitest -lqtwidgets
+}
+
+win32 {
+ LIBS+=$$OUT_PWD/../../lib/qtuitest.lib
+}
diff --git a/tests/shared/filedialog.js b/tests/shared/filedialog.js
new file mode 100644
index 0000000..0a4f904
--- /dev/null
+++ b/tests/shared/filedialog.js
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of QtUiTest.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+FileDialog = {
+
+ dialog: function() {
+ return findByProperty( { className: "QFileDialog" } );
+ },
+
+ openFile: function(path) {
+ var viewMode = getProperty(FileDialog.dialog(), "viewMode");
+ var lookIn = findByProperty( { objectName: "lookInCombo" } );
+ if (viewMode == 1) {
+ var view = findByProperty( { objectName: "listView" } );
+ } else {
+ view = findByProperty( { objectName: "treeView" } );
+ }
+
+ // The "Look in:" QFileDialogComboBox gets populated in showPopup, so it is
+ // necessary to make the popup appear before we can use it...
+ mouseClick(lookIn);
+
+ // FIXME: Unix only. Should make this work cross-platform
+ select("/", lookIn);
+
+ var pathSplit = path.split("/");
+ for (var i=1; i<pathSplit.length; ++i) {
+ select(pathSplit[i], view);
+ activate( translate("QFileDialog", "&Open") );
+ }
+ },
+
+ newFolder: function(name) {
+ var nf = findByProperty( { objectName: "newFolderButton" } );
+ activate(nf);
+ enter(name);
+ keyClick(Qt.Key_Enter);
+ if (currentTitle() == translate("QFileSystemModel", "Invalid filename")) {
+ fail("Invalid filename");
+ }
+ },
+
+ rename: function(oldName, newName) {
+ var lv = findByProperty( { objectName: "listView" } );
+ select(oldName, lv);
+ keyClick(Qt.Key_Menu);
+ select( translate("QFileDialog", "&Rename"), findByProperty( { className: "QMenu" } ));
+ enter(newName);
+ keyClick(Qt.Key_Enter);
+ if (currentTitle() == translate("QFileSystemModel", "Invalid filename")) {
+ fail("Invalid filename");
+ }
+ },
+
+ back: function() {
+ return ( findByProperty( { objectName: "backButton" } ) );
+ },
+
+ forward: function() {
+ return ( findByProperty( { objectName: "forwardButton" } ) );
+ },
+
+ parentDir: function() {
+ return ( findByProperty( { objectName: "toParentButton" } ) );
+ },
+
+ listView: function() {
+ return ( findByProperty( { objectName: "listModeButton" } ) );
+ },
+
+ detailView: function() {
+ return ( findByProperty( { objectName: "detailModeButton" } ) );
+ }
+}
diff --git a/tests/tests.pro b/tests/tests.pro
new file mode 100644
index 0000000..7b62cb1
--- /dev/null
+++ b/tests/tests.pro
@@ -0,0 +1,3 @@
+TEMPLATE=subdirs
+CONFIG+=systemtest
+SUBDIRS+=qtuitest